# Issue while Parsing XML data

**URL:** <https://discuss.elastic.co/t/issue-while-parsing-xml-data/196988>\
**Category:** Logstash\
**Created:** [August 27, 2019, 6:20pm UTC](https://discuss.elastic.co/t/issue-while-parsing-xml-data/196988 "2019-08-27T18:20:52Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [August 27, 2019, 7:03pm UTC](https://discuss.elastic.co/t/issue-while-parsing-xml-data/196988/4 "2019-08-27T19:03:12Z")

</div>

> [@satyam2593](#):
>
> INFO | jvm 1 | 2019/08/27 12:47:51.895 |

If you are using store\_xml =\> true then the xml filter does not care about random text prefixing the XML. However, the xpath option most certainly does. Try

```
    mutate { gsub => ["message", "^[^<]+<", "<" ] }
    xml {
        source => "message"
        store_xml => false
        force_array => false
        remove_namespaces => true
        xpath => {
            "/FileTransferOperationRequest/fromUrl/text()" => "fromurl"
            "/FileTransferOperationRequest/toUrl/text()" => "tourl"
            "/FileTransferOperationRequest/filename/text()" => "filename"
        }
    }

```

which gets me

```
   "fromurl" => "/talendprojects/fileServices/workingFolder",
     "tourl" => "/mnt/gis/Input/NEMs/AvailabilityHuawei",
  "filename" => "pmresult_1526726662_15_201908271215_201908271230_201908271247.csv.gz",

```

---

_[View the full topic](https://discuss.elastic.co/t/issue-while-parsing-xml-data/196988)._
