Re: [xml] Value out of ellement?



Hi Rob,

On Thu, Oct 6, 2011 at 1:08 PM, Rob Eisink  wrote:
Hi

Part of my xml file looks like:
<Device>device_name</Device>

the element has a value, how do i get the value (device_name) out of it?

That depends on how you process the XML.

If using SAX, you will get a callback (xmlSAX2Characters).
If using the reader, you navigate to the XML_READER_TYPE_TEXT and call
xmlTextReaderValue.
If using XPath, you need to use "...../Device/text()"; and get the
data from xmlXPathObject::nodesetval->nodeTab[i]->value
If using the DOM, you'll have to figure it out yourself because I
never used that.

Hope this helps,
Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds



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