[xml] XPath cursor



Hello,

I'm new to xml and libxml and was wondering if it's
possible to 'loop' through a XML file.
Suppose I have a XML file like this:

<SOFTWARE>
   <TYPE name="office">
      <VENDOR name="Microsoft">
         <PACKAGE name="Office" version="97" />
         <PACKAGE name="Office" version="2000" />
      </VENDOR>
      <VENDOR name="Sun">
         <PACKAGE name="Staroffice" />
      </VENDOR>
      <VENDOR name="Kde">
         <PACKAGE name="KOffice" />
      </VENDOR>
   </TYPE>
   <TYPE name="development">
      <VENDOR name="Microsoft">
         <PACKAGE name="Visual Studio" version="6.0"
/>
      </VENDOR>
      <VENDOR name="Kde">
         <PACKAGE name="KDeveloper" version="2.0" />
      </VENDOR>
   </TYPE>
</SOFTWARE>

Is it possible to give me a list of all the software
packages from Microsoft?
I tried something running this statement more than
once:

xmlXPathObjectPtr package_name =
xmlXPathEval((unsigned
char*)"/SOFTWARE/TYPE/VENDOR[ name='Microsoft']/PACKAGE/@name",
ctxt);

but it shows me only the first package.
How can I show the other ones as well?

Kind regards,

Gerry Jacobs







__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]