For some reason (I've never heard a convincing one), the DOM spec doesn't 
say to return a node's text value when you use getNodeValue().  You have to 
have to go down one more level into the node and get its text node, and 
take that node's value.  I don't have the C++ syntax handy, but it's 
probably similar to the Java:

                // Get the text node from an Element called subElem.
                Node textNode = subElem.getFirstChild();
                if((textNode != null) && (textNode.getNodeType() == Node.TEXT_NODE))
                {
                                sValue = textNode.getNodeValue();
                        dValue = Double.parseDouble(sValue);
                }


Some people have argued that there's no way to determine what you'd want 
from a node's getNodeValue() function if it had subnodes or attributes, but 
I think that's bunk.  getNodeValue() should return all text under a node 
that isn't enclosed in any other structure, concatenated if it's not 
contiguous.  XML is text, so a node's value is its text.  But the DOM 
doesn't see it that way, hence the cumbersomeness.

Gavin


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

Reply via email to