Hi,
        take a look at the following code which is operating on your XML.

        DOMDocument                     *doc = parser->getDocument();

        //the url element
        DOMNode *Url = 
doc->getDocumentElement()->getFirstChild()->getNextSibling();

        //the text content
        DOMNode *text = Url->getFirstChild();

        cerr << "text node value: '" << 
XMLString::transcode(text->getNodeValue()) << "'" << endl;


        //or using textContent

        cerr << "text node value: '" << 
XMLString::transcode(Url->getTextContent()) << "'" << endl;


output:

text node value: 'url configuration'
text node value: '(null)'


unfortunately the second approach does not work as getTextContent has not 
yet been implemented (sorry, I forgot that).



> Given:
> > <XmlConfiguration>
> >   <Url>url configuration</Url>
> > </XmlConfiguration>
> 
> When I got a list of children for the 'Url' node and got an empty list
> as one would expect. I don't understand what you mean by getting
> children of that element and filtering out for a TEXT_NODE.

When a document is parsed a tree of objects is created. An element has a 
list of children of other nodes. In your case the only child of the Url 
element is a text node with value "url configuration". You could also have 
other elements, comments etc. 

> 
> My expectation is that because I am not validating, xerces takes the
> 'Url' element to be of type ELEMENT_NODE even when it's contents are
> just text. 

The fact you are not validating has no bearing on the DOMNodes created 
when parsing. When you say "of type" it is not referring to a schema 
type.


I have reviewed the documentation but failed to figure this
> out. If you could point me to specific part of documentation I should be
> looking at I would appreciated that. I have so far read the DOXYGEN
> generated files for DOMNode, DOMText, DOMElement, DOMNodeList and


All the navigation call I use above are in DOMNode. Take a look at the 
examples - they are helpful.

Gareth


-- 
Gareth Reakes, Head of Product Development  
DecisionSoft Ltd.            http://www.decisionsoft.com
Office: +44 (0) 1865 203192



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to