[xml] Newbie question - Getting Node Content from XPath



Dear List,
sorry, this is a newbie question. I've already looked through examples, and through the library sourcecode, but couldn't find what I was looking for.
Suppose I have some XML:

<?xml version="1.0" encoding="ISO-8859-1"?>
<PMML >
  <Header copyright="mine">
     Hello World!
     <Application> foo </Application>
  </Header>
</PMML>

The corresponding XPath nodes are:

/PMML
/PMML/Header
/PMML/Header/Application

This much I can work out (xmlNodePath is your friend)...

However, I don't know how to get the content of each of the nodes. For example, given the full XPath "/PMML/Header" how do I obtain the string "Hello World!"? I've tried using xmlXPathCastNodeToString, on the "/PMML/Header" Xpath, but also get foo printed out. I'm thinking that I may have to use xmlXPathEval, am I heading along the right lines?

I'm sorry if this is a simple question.

regards,
Andy







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