Advanced XPath Q: Select tags not having a sibling
Is the Mysql implementation of EXTRACTVALUE able to select tags not having certain sibling tag?
I have a huge XML data set derived from the XTM (TopicMap) standard. I want use the EXTRACTVALUE function to get the content of all the <baseNameString> tags which do not have a <scope> tag as sibling.
<topic>
<baseName>
<scope>
<topicRef xlink:href="1" />
</scope>
<baseNameString> I dont care about this element </baseNameString>
</baseName>
<baseName>
<baseNameString> THIS IS THE ELEMENT I WANT TO SELECT! </baseNameString>
</baseName>
<baseName>
<scope>
<topicRef xlink:href="111" />
</scope>
<baseNameString> I dont care about this data either ... </baseNameString>
</baseName>
</topic>
These Xpaths will not work:
EXTRACTVALUE(xmldata, '//baseName/baseNameString') # also selects with the unwanted <scope> sibling
EXTRACTVALUE(xmldata, '//baseName/baseNameString[1]') # won't work if the baseNameString without scope sibling i #2 or #3
EXTRACTVALUE(xmldata, '/topic/baseName/scope/../baseNameString') # selects the disjunct set of baseNameString cp. the desired ones
EXTRACTVALUE(xmldata, '/topic/baseName/baseNameString | /topic/baseName/scope') # only selects if the element without the <scope> sibling is first
Subject
Written By
Posted
Advanced XPath Q: Select tags not having a sibling
July 09, 2009 12:15PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.