There is no tags in XML

Hello.

How can I write code in if condition, if there is no tags in XML.
For example, my xml source is like this :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<m2m:cin xmlns:m2m="http://www.onem2m.org/xml/protocols"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ty>4</ty>
 </m2m:cin>

And I can write if condition like this, if there is a tag :

filter {
          xml { 
                remove_namespaces => true
                xpath => ["/cin/ty", "ty"]
          }

      if [ty] {
           ...
     }
}

but, if there is no tag, is it right?

if(![ty]) {
        ...
    }

Yes, that should work.

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