Adrian Schubert wrote:
> Can someone please tell me what I'm doing wrong in this short example?
> 
> 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?

Did you mean to write this?

doc->getElementsByTagName(numberOfRows)[0]->getTextContent()

I think you are calling getTextContent() on the document node, which is
returning you 0 since it's only defined on element nodes.

John

-- 
John Snelson, Oracle Corporation            http://snelson.org.uk/john
Berkeley DB XML:        http://www.oracle.com/database/berkeley-db/xml
XQilla:                                  http://xqilla.sourceforge.net

Reply via email to