consider a simple xml doc fragment like this:

...
   <anElem>abcd</anElem>
...

when I walk the xml doc containing this fragment (as a DOMDocument) and the 
"anElem" element is reached and passed to a callback function (as a DOMNode),   
its value is NULL (an exception is thrown):

void callback( DOMNode * node )
{
      ...
       getNodeName( node )   // Ok. returns string "anElem" as value (a la 
XMLCh *)
       getNodeValue( node )    // throws exception. expected "abcd" (after 
transcoding)
}

The Node for "anElem" was of type DOMNode::ELEMENT_NODE as expected.
The next node to be passed to the callback was of type DOMNode::TEXT_NODE and 
it had the value I had hoped for previously, namely: "abcd". Hmmmm....

My question is this: can I get the "abcd" value while processing the "anElem" 
Node? Is there some kind of casting that I have to do to the DOMNode pointer 
when it comes into callback()?

it confuses me that i cannot get the value of a simple element. i obviously do 
not understand something about the DOM implementation...

any help appreciated

tx,

- rich

Reply via email to