How to indicate 'missing' tags in XQuery?
Posted
by Stewart
on Stack Overflow
See other posts from Stack Overflow
or by Stewart
Published on 2010-03-28T17:36:19Z
Indexed on
2010/03/28
17:43 UTC
Read the original article
Hit count: 183
I have an XML file:
$xml := <xml>
<element>
<text>blahblah</text>
</element>
<element>
</element>
<element>
<text>blahblah</text>
</element>
</xml>
I can use the query
for $x in $xml/xml/element/text return string($x)
This gives me a list
blahblah
blahblah
with no indication that there is an element which has no element. What I'd like to do is use a query which, if there is no such element, returns, say "missing". How do I do this?
© Stack Overflow or respective owner