# I get XML elements back when using xpath

**URL:** <https://discuss.elastic.co/t/i-get-xml-elements-back-when-using-xpath/164423>\
**Category:** Logstash\
**Created:** [January 16, 2019, 9:17am UTC](https://discuss.elastic.co/t/i-get-xml-elements-back-when-using-xpath/164423 "2019-01-16T09:17:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![humalog](https://avatars.discourse-cdn.com/v4/letter/h/cc9497/32.png) [@humalog](https://discuss.elastic.co/u/humalog)\
**Post date:** [January 16, 2019, 9:17am UTC](https://discuss.elastic.co/t/i-get-xml-elements-back-when-using-xpath/164423/1 "2019-01-16T09:17:10Z")

</div>

Hello,  
when using XPATH to parse my XML file, i get the correct field but in the content I also get the element name back, what I dont want.  
What I need to change?

My XML looks like this:

```
<VULN_DETAILS>
    <CVSS_SCORE>
        <CVSS_BASE>5</CVSS_BASE>
        <CVSS_TEMPORAL>3.7</CVSS_TEMPORAL>
    </CVSS_SCORE>
</VULN_DETAILS>

```

My config looks like this:

```
xpath => [
    "/VULN/CVSS_SCORE/CVSS_BASE", "CVSS_Base_Score",
    "/VULN/CVSS_SCORE/CVSS_TEMPORAL", "CVSS_Temporal_Score"
]

```

My output:

```
field: CVSS3_Base_Score content: <CVSS_BASE>5</CVSS_BASE>
field: CVSS_Temporal_Score content: <CVSS_TEMPORAL>3.7</CVSS_TEMPORAL> 

```

When I'm using the filter

```
store_xml => "true"

```

I get the following output:

```
 {
    "CVSS_BASE": [
         "5"
   ],
     "CVSS_TEMPORAL": [
          "3.7"
   ]
}
```

---

<div class="post-metadata">

**Author:** ![humalog](https://avatars.discourse-cdn.com/v4/letter/h/cc9497/32.png) [@humalog](https://discuss.elastic.co/u/humalog)\
**Post date:** [January 16, 2019, 10:07am UTC](https://discuss.elastic.co/t/i-get-xml-elements-back-when-using-xpath/164423/2 "2019-01-16T10:07:34Z")

</div>

> [@humalog](#):
>
> xpath =\> ["/VULN/CVSS\_SCORE/CVSS\_BASE", "CVSS\_Base\_Score", "/VULN/CVSS\_SCORE/CVSS\_TEMPORAL", "CVSS\_Temporal\_Score"]

edited to:

```
xpath => [
    "/VULN/CVSS_SCORE/CVSS_BASE/text()", "CVSS_Base_Score",
    "/VULN/CVSS_SCORE/CVSS_TEMPORAL/text()", "CVSS_Temporal_Score"
]

```

will 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:** [February 13, 2019, 10:07am UTC](https://discuss.elastic.co/t/i-get-xml-elements-back-when-using-xpath/164423/3 "2019-02-13T10:07:49Z")

</div>

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