# Xml parser with xpath not giving result

**URL:** <https://discuss.elastic.co/t/xml-parser-with-xpath-not-giving-result/153566>\
**Category:** Logstash\
**Created:** [October 23, 2018, 9:43am UTC](https://discuss.elastic.co/t/xml-parser-with-xpath-not-giving-result/153566 "2018-10-23T09:43:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![clementb](https://avatars.discourse-cdn.com/v4/letter/c/3bc359/32.png) [@clementb](https://discuss.elastic.co/u/clementb)\
**Post date:** [October 23, 2018, 9:43am UTC](https://discuss.elastic.co/t/xml-parser-with-xpath-not-giving-result/153566/1 "2018-10-23T09:43:28Z")

</div>

Hi,  
I'm trying to parse xml files with the xpath plugin but it doesn't give me any result,

Here are my xml data and logstash conf.

```
<?xmlversion="1.0" encoding="utf-8"?>
<testResult>
   <executionLog>
      <numberOfTestCases>15</numberOfTestCases>
      <numberOfTestCasesPassed>9</numberOfTestCasesPassed>
      <numberOfTestCasesFailed>6</numberOfTestCasesFailed>
      <numberOfTestCasesNotExecuted>0</numberOfTestCasesNotExecuted>
    </executionLog>
</testResult>

```

input{  
file{  
path =\> "path"  
start\_position =\> "beginning"  
exclude =\> "\*.gz"  
codec =\> multiline{  
pattern =\> "﻿\<?xml version="1.0" encoding="utf-8"?\>"  
what =\> "next"  
negate =\> true  
max\_lines =\> 5000000  
}

```
}

```

}

filter{  
xml{   
remove\_namespaces =\> "true"  
source =\> "message"  
xpath =\> ["testResult/executionLog/numberOfTestCases/text()","total"]  
}  
}

output {  
elasticsearch {  
hosts =\> ["localhost:9200"]  
index =\> "toscatest"

}  
stdout { codec =\> rubydebug }

}

Is something wrong with my conf ?

Thanks for helping 🙂

---

<div class="post-metadata">

**Author:** ![balumurari1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/balumurari1/32/39203_2.png) [@balumurari1](https://discuss.elastic.co/u/balumurari1)\
**Post date:** [October 23, 2018, 9:55am UTC](https://discuss.elastic.co/t/xml-parser-with-xpath-not-giving-result/153566/2 "2018-10-23T09:55:32Z")

</div>

hope this helps you,

> [@Unable to load xml file in logstash](https://discuss.elastic.co/t/unable-to-load-xml-file-in-logstash/151318):
>
> Hello, can you please provide a sample example to upload xml file using logstash. I have tried a lot but unable to upload an xml file in logstash in windows machine. Waiting for the response. Ex: My XML file is as follows, --stations-- --station-- --id--Value1--/id-- --name\>Value2--/name-- --/station-- --/stations-- My conf file is as follows, input { file { path =\> "C:\Users\LENOVO\Downloads\stations.xml" start\_position =\> "beginning" #sincedb\_path =\> "/dev/null" exclude =\> "\*.…

---

<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:** [November 20, 2018, 10:06am UTC](https://discuss.elastic.co/t/xml-parser-with-xpath-not-giving-result/153566/3 "2018-11-20T10:06:14Z")

</div>

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