Re: [xml] How to parse and print data



On 10/14/2010 03:16 PM, samaram s wrote:
Thank You John,

I could able to use xpath and used xmlNodeGetContent to get the content
of the node.
By using the below API's
  xpathCtx = xmlXPathNewContext(doc);
xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx);
Given an expression it gives the property of the node.
for ex: if i give '\\Option' i could able to get English, French etc.
But i dont know how to get Value which is under Option node??

I was wondering is there any API which gives the following information.

<Option Value="*00*">English</Option>
<Option Value="*01*">French</Option>

If i would like to get the data of the Values which is under node Option
how can i get?
What is the way to do this?

I suggest you read the documentation for xpath. Asking people on a mailing list how to do something is not a substitute for making the effort to learn the information on your own. How do you think we learned it? BTW, there is a load of doc on xpath on the web. Since xpath is a standard it applies to libxml2 xpath implementation as well. You may find some of other xpath doc easier to digest. You might want to google "xpath examples" as well.

--
John Dennis <jdennis redhat com>

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/



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