# How to parse xml from a single line

**URL:** https://discuss.elastic.co/t/how-to-parse-xml-from-a-single-line/131975
**Category:** Logstash
**Created:** [May 15, 2018, 3:36pm UTC](https://discuss.elastic.co/t/how-to-parse-xml-from-a-single-line/131975 "2018-05-15T15:36:35Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![motts](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@motts](https://discuss.elastic.co/u/motts)
#### Post date: [May 15, 2018, 8:22pm UTC](https://discuss.elastic.co/t/how-to-parse-xml-from-a-single-line/131975/3 "2018-05-15T20:22:21Z")

</div>

I may be mistaken, but my experience with the "target" options is that data will not go into a field that is not already defined or created. I would try adding the "xml\_content" field before designating the data to go there.

@magnusbaeck stated something similar in the article here:

> [@Set target of xml filter to root?](https://discuss.elastic.co/t/set-target-of-xml-filter-to-root/80770):
>
> I want the store\_xml setting of the xml filter to store child elements of the input XML event as top-level fields. Is this possible? Or should I create an issue in GitHub for this? For example, given this input XML event: \<event\> \<property1\>v1\</property1\> \<property2\>v2\</property2\> \</event\> I want this output: "@timestamp":"...", "property1":"v1", "property2":"v2" not, say: "@timestamp":"...", "xml\_content": { "property1":"v1", "property2":"v2" } And to do that, I’d prefer not to …

---

_[View the full topic](https://discuss.elastic.co/t/how-to-parse-xml-from-a-single-line/131975)._
