# Urgent Help : How to Parse nested XML (Key value patterns) with multiple Parent children

**URL:** <https://discuss.elastic.co/t/urgent-help-how-to-parse-nested-xml-key-value-patterns-with-multiple-parent-children/312546>\
**Category:** Logstash\
**Created:** [August 21, 2022, 2:27pm UTC](https://discuss.elastic.co/t/urgent-help-how-to-parse-nested-xml-key-value-patterns-with-multiple-parent-children/312546 "2022-08-21T14:27:21Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![sonirajil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sonirajil/32/99235_2.png) [@sonirajil](https://discuss.elastic.co/u/sonirajil)\
**Post date:** [August 22, 2022, 5:05am UTC](https://discuss.elastic.co/t/urgent-help-how-to-parse-nested-xml-key-value-patterns-with-multiple-parent-children/312546/3 "2022-08-22T05:05:01Z")

</div>

Thanks for your quick response Badger , in interest of time in case If I need just specific fields with corresponding values instead of flattening whole hierarchy e.g. specifically  
BatteryHealthCode  
ChargeCapacity  
PartNumber  
SerialNumber  
from parent xmldata.command.sendTerminalProperties.group.name : **Battery**.  
Is there any other way like split or something you can advise .  
I tried split which you suggested in below (might be ,my code is not correct)

> [@Possible to Parse Nested XML Data structures and combine parent with child](https://discuss.elastic.co/t/possible-to-parse-nested-xml-data-structures-and-combine-parent-with-child/167854/3):
>
> I am starting with that. I can see how to do it if i only ever have 1 parent but when there are muliple parent / children blocks thats what i cant see how to break it down.

```auto
filter {
    grok {
                match => { "message" => "^%{TIMESTAMP_ISO8601:timestamp}\s+%{LOGLEVEL:loglevel}\s+(\[)%{DATA:logger}(\])\s+%{DATA:command} (\|)%{DATA:output}?\s*$(?<stacktrace>(?m:.*))" }
        }
     if "<?xml" in [stacktrace]
      {
      xml {
    source => "stacktrace"
    target => "xmldata"
        }
}
         split { field => "[xmldata][command][sendTerminalProperties][group][name]" }
         split { field => "[xmldata][command][sendTerminalProperties][property][name]" }
         split { field => "[xmldata][command][sendTerminalProperties][property][value]" }

}

```

Request advice.

---

_[View the full topic](https://discuss.elastic.co/t/urgent-help-how-to-parse-nested-xml-key-value-patterns-with-multiple-parent-children/312546)._
