# Xml can't be parsed!

**URL:** <https://discuss.elastic.co/t/xml-cant-be-parsed/196221>\
**Category:** Logstash\
**Created:** [August 22, 2019, 2:56am UTC](https://discuss.elastic.co/t/xml-cant-be-parsed/196221 "2019-08-22T02:56:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![wzxmt\_l](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wzxmt_l/32/46888_2.png) [@wzxmt\_l](https://discuss.elastic.co/u/wzxmt_l)\
**Post date:** [August 22, 2019, 2:56am UTC](https://discuss.elastic.co/t/xml-cant-be-parsed/196221/1 "2019-08-22T02:56:18Z")

</div>

hi  
Here are my xml data and logstash conf.The entire event is entered when the data is entered into logstash;I'm trying to parse xml files with the xpath plugin but it doesn't give me any result!

> ```
> <holding_stock_response msgnum="8">
> <result>1</result>
> <stock_qty>10</stock_qty>
> <records>
> <row pos_str="00100000P000011210000BABA" market_code="USA" stock_code="BABA" stock_name="Alibaba Group Holding Limited American D" qty="1110.000000" qty_use="1110.000000" qty_onhold="0.000000" cost_price="167.72287400" av_buy_price="167.72287000" price="110.00000000" real_buy_amount="0.000000" real_sell_amount="0.000000" sum_buy_amount="" sum_sell_amount="" correct_amount=""/>
> <row pos_str="00100000K0000112100077700" market_code="HKG" stock_code="77700" stock_name="QQ RIGHT" qty="11000.000000" qty_use="11000.000000" qty_onhold="0.000000" cost_price="0.00000000" av_buy_price="0.00000000" price="0.00000000" real_buy_amount="0.000000" real_sell_amount="0.000000" sum_buy_amount="" sum_sell_amount="" correct_amount=""/>
> <row pos_str="00100000K0000112100044048" market_code="HKG" stock_code="44048" stock_name="44048" qty="100000.000000" qty_use="100000.000000" qty_onhold="0.000000" cost_price="0.00000000" av_buy_price="0.00000000" price="0.00000000" real_buy_amount="0.000000" real_sell_amount="0.000000" sum_buy_amount="" sum_sell_amount="" correct_amount=""/>
> </records>
> 
> ```

> ```
> xml {
> source => "message"
> target => "XML"
> store_xml => false
> remove_namespaces => "true"
> xpath => [
> "/holding_stock_response/@msgnum","msgnum",
> "/result/text()","result",
> "/stock_qty/text()","stock_qty",
> "/row/@pos_str","pos_str",
> "/row/@market_code","market_code",
> "/row/@stock_code","stock_code",
> "/row/@stock_name","stock_name",
> "/row/@qty","qty",
> "/row/@qty_use","qty_use",
> "/row/@qty_onhold","qty_onhold",
> "/row/@av_buy_price","av_buy_price",
> "/row/@price","price",
> "/row/@real_buy_amount","real_buy_amount",
> "/row/@real_sell_amount","real_sell_amount",
> "/row/@sum_buy_amount","sum_buy_amount",
> "/row/@sum_sell_amount","sum_sell_amount",
> "/row/@correct_amount","correct_amount"
> ]
> }
> 
> ```

Is something wrong with my conf ? What should I do？ Thanks for helping！

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [August 22, 2019, 4:21am UTC](https://discuss.elastic.co/t/xml-cant-be-parsed/196221/2 "2019-08-22T04:21:47Z")

</div>

Hi,

This forum is targeted to Portuguese only, please let me in know if you speak Portuguese, otherwise I'll move your post to the proper category

Thanks

---

<div class="post-metadata">

**Author:** ![wzxmt\_l](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wzxmt_l/32/46888_2.png) [@wzxmt\_l](https://discuss.elastic.co/u/wzxmt_l)\
**Post date:** [August 22, 2019, 5:30am UTC](https://discuss.elastic.co/t/xml-cant-be-parsed/196221/4 "2019-08-22T05:30:06Z")

</div>

Sorry, I have changed！

---

<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 22, 2019, 12:32pm UTC](https://discuss.elastic.co/t/xml-cant-be-parsed/196221/5 "2019-08-22T12:32:45Z")

</div>

With that XML and that xml filter I get

```
    "msgnum" => [
    [0] "8"
],

```

If you add

```
</holding_stock_response>

```

at the end then everything else gets parsed.

---

<div class="post-metadata">

**Author:** ![wzxmt\_l](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wzxmt_l/32/46888_2.png) [@wzxmt\_l](https://discuss.elastic.co/u/wzxmt_l)\
**Post date:** [August 22, 2019, 1:00pm UTC](https://discuss.elastic.co/t/xml-cant-be-parsed/196221/6 "2019-08-22T13:00:07Z")

</div>

> [@Badger](#):
>
> 有了这个XML和我得到的xml过滤器

Thanks your help!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 19, 2019, 1:13pm UTC](https://discuss.elastic.co/t/xml-cant-be-parsed/196221/7 "2019-09-19T13:13:45Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
