You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by Lev Lvovsky <li...@sonous.com> on 2007/06/26 02:13:17 UTC

getting element text?

I'm addmitedly new to DOM, but I'm a bit confused by what should seem  
to work based on the W3 DOM tutorial.

if I have a Xerces::DOMElement, and I want to get the value of that  
element, one would assume that getNodeValue would get me the text  
string within the element tags:

<Element>Some Text</Element>

So if I have a DOMNode where getNodeType() returns 1, and getNodeName  
returns 'Element', shouldn't getNodeValue return 'Some Text'?  I'm  
consistently getting emtpy strings for any Element that I use the  
getNodeValue method on.  getTextContent gives me the text, however I  
would think that that's the wrong way to go about things.


Any help would be appreciated!

thanks,
-lev

---------------------------------------------------------------------
To unsubscribe, e-mail: p-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: p-dev-help@xerces.apache.org


Re: Fwd: getting element text?

Posted by David Bertoni <db...@apache.org>.
Jason Stewart wrote:
> Hey Lev,
> 
> I'm forwarding your query to the Xerces-C guys - maybe there is
> something different with how Xerces is implementing the DOM3 API?

No, this is the expected behavior.  The value of that element node is the 
value of its text node child.  You can also call DOMNode::getTextContent().

Dave

> 
> Cheers, jas.
> 
> ---------- Forwarded message ----------
> From: Lev Lvovsky <li...@sonous.com>
> Date: Jun 26, 2007 5:43 AM
> Subject: getting element text?
> To: p-dev@xerces.apache.org
> 
> 
> I'm addmitedly new to DOM, but I'm a bit confused by what should seem
> to work based on the W3 DOM tutorial.
> 
> if I have a Xerces::DOMElement, and I want to get the value of that
> element, one would assume that getNodeValue would get me the text
> string within the element tags:
> 
> <Element>Some Text</Element>
> 
> So if I have a DOMNode where getNodeType() returns 1, and getNodeName
> returns 'Element', shouldn't getNodeValue return 'Some Text'?  I'm
> consistently getting emtpy strings for any Element that I use the
> getNodeValue method on.  getTextContent gives me the text, however I
> would think that that's the wrong way to go about things.
> 
> 
> Any help would be appreciated!
> 
> thanks,
> -lev
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: p-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: p-dev-help@xerces.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: c-dev-help@xerces.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Fwd: getting element text?

Posted by Jason Stewart <ja...@gmail.com>.
Hey Lev,

I'm forwarding your query to the Xerces-C guys - maybe there is
something different with how Xerces is implementing the DOM3 API?

Cheers, jas.

---------- Forwarded message ----------
From: Lev Lvovsky <li...@sonous.com>
Date: Jun 26, 2007 5:43 AM
Subject: getting element text?
To: p-dev@xerces.apache.org


I'm addmitedly new to DOM, but I'm a bit confused by what should seem
to work based on the W3 DOM tutorial.

if I have a Xerces::DOMElement, and I want to get the value of that
element, one would assume that getNodeValue would get me the text
string within the element tags:

<Element>Some Text</Element>

So if I have a DOMNode where getNodeType() returns 1, and getNodeName
returns 'Element', shouldn't getNodeValue return 'Some Text'?  I'm
consistently getting emtpy strings for any Element that I use the
getNodeValue method on.  getTextContent gives me the text, however I
would think that that's the wrong way to go about things.


Any help would be appreciated!

thanks,
-lev

---------------------------------------------------------------------
To unsubscribe, e-mail: p-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: p-dev-help@xerces.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: p-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: p-dev-help@xerces.apache.org


Fwd: getting element text?

Posted by Jason Stewart <ja...@gmail.com>.
Hey Lev,

I'm forwarding your query to the Xerces-C guys - maybe there is
something different with how Xerces is implementing the DOM3 API?

Cheers, jas.

---------- Forwarded message ----------
From: Lev Lvovsky <li...@sonous.com>
Date: Jun 26, 2007 5:43 AM
Subject: getting element text?
To: p-dev@xerces.apache.org


I'm addmitedly new to DOM, but I'm a bit confused by what should seem
to work based on the W3 DOM tutorial.

if I have a Xerces::DOMElement, and I want to get the value of that
element, one would assume that getNodeValue would get me the text
string within the element tags:

<Element>Some Text</Element>

So if I have a DOMNode where getNodeType() returns 1, and getNodeName
returns 'Element', shouldn't getNodeValue return 'Some Text'?  I'm
consistently getting emtpy strings for any Element that I use the
getNodeValue method on.  getTextContent gives me the text, however I
would think that that's the wrong way to go about things.


Any help would be appreciated!

thanks,
-lev

---------------------------------------------------------------------
To unsubscribe, e-mail: p-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: p-dev-help@xerces.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org