Hi people

I'm trying to extract a number from an XML element...for now, just a simple test - and that is creating problems for me!
Can someone please tell me what I'm doing wrong in this short example?

My XML test file:

<level1Product xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:noNamespaceSchemaLocation="mytest_tiny.xsd">
   <imageDataInfo>
     <pixelValueID>RADAR BRIGHTNESS</pixelValueID>
     <imageRaster>
       <numberOfRows>3600</numberOfRows>
     </imageRaster>
   </imageDataInfo>
 </level1Product>

My code extract:

    XMLCh* numberOfRows = XMLString::transcode("numberOfRows");
     doc->getElementsByTagName(numberOfRows);
cout << "# elems found: " << doc->getElementsByTagName(numberOfRows)->getLength() << endl; // returns 1 (as expected) cout << "The number of rows is: " << XMLString::transcode(doc[0].getTextContent()) << endl; // returns nothing - why?


When I do this, an empty string is output. I can add ->getLength() and it returns 1, so I know it got the element.
What do I need to change to actually retrieve the value "3600" ?

Thanks lot!
Adrian

Reply via email to