# Handle empty node in XPATH for xml filter

**URL:** <https://discuss.elastic.co/t/handle-empty-node-in-xpath-for-xml-filter/98674>\
**Category:** Logstash\
**Created:** [August 29, 2017, 11:09am UTC](https://discuss.elastic.co/t/handle-empty-node-in-xpath-for-xml-filter/98674 "2017-08-29T11:09:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkhapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rkhapre/32/48333_2.png) [@rkhapre](https://discuss.elastic.co/u/rkhapre)\
**Post date:** [August 29, 2017, 11:09am UTC](https://discuss.elastic.co/t/handle-empty-node-in-xpath-for-xml-filter/98674/1 "2017-08-29T11:09:45Z")

</div>

Hi All

I have a XML file with 100 records, in one of the record the xml node is missing as the value is not available in system

The xml path is like this

`/Envelope/Body/response/table/row/description/text`

in other record the path is until here`

`/Envelope/Body/response/table/row/description`

The node is missing as there is no value

How can we define the XPATH for such situation

```
  xpath => [
        "/Envelope/Body/response/table/row/description/text()","description",		
        ]
```

---

<div class="post-metadata">

**Author:** ![rkhapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rkhapre/32/48333_2.png) [@rkhapre](https://discuss.elastic.co/u/rkhapre)\
**Post date:** [August 29, 2017, 5:20pm UTC](https://discuss.elastic.co/t/handle-empty-node-in-xpath-for-xml-filter/98674/2 "2017-08-29T17:20:15Z")

</div>

Can we apply if condition, i want to execute XPATH if the node/tag is available and supply a text "null" if it is not available

---

<div class="post-metadata">

**Author:** ![rkhapre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rkhapre/32/48333_2.png) [@rkhapre](https://discuss.elastic.co/u/rkhapre)\
**Post date:** [August 30, 2017, 2:25pm UTC](https://discuss.elastic.co/t/handle-empty-node-in-xpath-for-xml-filter/98674/3 "2017-08-30T14:25:56Z")

</div>

Please let me know, if this feature is not supported with XPATH of xml filter.  
Did anyone faced this issue?

---

<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 27, 2017, 2:25pm UTC](https://discuss.elastic.co/t/handle-empty-node-in-xpath-for-xml-filter/98674/4 "2017-09-27T14:25:58Z")

</div>

Closed on September 27, 2017, 2:25pm UTC

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