I'd wager that you're calling getNodeValue() on an element node.
Elements have no value; they have children.  In your example, the item
element has a single text node child.  I suspect you want the value of
that node.  As I mentioned, you may want to use DOMText::getWholeText()
to be sure any adjacent text nodes are included.

Or you can use a handy-dandy new DOM 3 function to get the text of any
given node and its descendants: DOMNode::getTextContent().  This should
return "varun" if you call it on the item element.  It's probably not
appropriate if you want to have elements with both text and element
content, though.

-----Original Message-----
From: varun.81 [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 07, 2007 5:48 AM
To: c-dev@xerces.apache.org
Subject: RE: Re: parsing xml


thanx a lot for the help....i have been able to parse the file with
indentation......but now in my node when i call getNodeValue().
i am not getting the value i expected.
my node is like 
<item>varun</item>
when i say getNodeValue()
and try to print it i get a blank value. Can you tell my why ?

Jesse Pelton wrote:
> 
> I always wondered what that flag was for! 
> 
> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Boris Kolpackov
> Sent: Tuesday, February 06, 2007 3:11 PM
> To: c-dev@xerces.apache.org
> Subject: Re: parsing xml
> 
> Hi Jesse,
> 
> "Jesse Pelton" <[EMAIL PROTECTED]> writes:
> 
>> Alternatively, you can write a DTD or schema for your documents and
> let
>> Xerces sort out which nodes are white space in element content.
> You'll
>> still need to check whether the node you're processing is a text
node;
>> if it is, DOMText::getIsWhitespaceInElementContent() will tell you
>> whether it's white space in element content.
> 
> There is actually a parsing feature, fgDOMWhitespaceInElementContent,
> when set to false it results in all ignorable whitespaces being
removed
> from the resulting DOM document. Very handy.
> 
> 
> hth,
> -boris
> 
> 
> -- 
> Boris Kolpackov
> Code Synthesis Tools CC
> http://www.codesynthesis.com
> Open-Source, Cross-Platform C++ XML Data Binding
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/parsing-xml-tf3181498.html#a8843236
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


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


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

Reply via email to