Re: what is the correct for xpath selector for xsi:type

I think that this is a namespace issue.  You will need to register the 
"xsi" namespace to the libXML2 engine and then use its prefix in your 
XPath expressions.

The way to do that varies by language.



On 12/08/2011 06:08 PM, Andy Davidson wrote:
> Hi
>
> I am trying use libxml2 to parse the following xml.
>
> <?xmlversion="1.0"encoding="UTF-8"?>
> <zoo:cageRequest
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:zoo="http://www.example.org/Zoo"
> xsi:schemaLocation="http://www.example.org/Zoo ../XSD/ZooRequest.xsd ">
> <animalxsi:type="zoo:Fish">
> <name>tuna</name>
> <numberOfFins>4</numberOfFins>
> </animal>
> </zoo:cageRequest>
>
> I need to do some special processing based on the value of xsi:type. 
>  I eventual get a a xmlNodePtr that points to
>
> <animalxsi:type="zoo:Fish">
> <name>tuna</name>
> <numberOfFins>4</numberOfFins>
> </animal>
>
> I can not seem to select the attribute. "@*" works but is not going to 
> work long term.
>
> "@xsi:type" and "@type" did not work
>
> thanks
>
> Andy

Received on Monday, 12 December 2011 12:32:09 UTC