mardi 13 mai 2014

Oracle XmlQuery to retrieve the path of the node


Vote count:

0




I am having the below xml and I am having trouble to get the LocationOfNode using xmlquery. Any suggestions how to proceed? Please see the below example to see what I am trying to achieve.



<data>
<type id="01" desc="Doctors">
<type id="02" desc="Private Hospital">
<type id="03" desc="John"></type>
<type id="04" desc="James"></type>
</type>
<type id="05" desc="Public Hospital">
<type id="06" desc="Jacob"></type>
<type id="07" desc="Joseph"></type>
</type>
</type>
<type id="08" desc="Actors">
........
</type>
</data>


Example:


If My Input is:07


Expected output is : Doctors/Public Hospital/Joseph


I am trying to use the below xmlpath with xmlquery



SELECT XMLQuery(
'//*[@id="07"]/ancestor::*[@id="01"][1]'
PASSING MYXMLClob RETURNING CONTENT
) "myXMLQuery"
FROM myTable


asked 3 mins ago






Aucun commentaire:

Enregistrer un commentaire