Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Text Content in 3W DOM Element

Reply
Thread Tools

Text Content in 3W DOM Element

 
 
RC
Guest
Posts: n/a
 
      08-06-2008
If I have a XML file like

<header>
<data>1.0</data>
</header>

In the header element getTextContent() why it return
1.0? Shouldn't it return null?
In the data element getTextContent() should return 1.0, right?
 
Reply With Quote
 
 
 
 
Arne Vajh°j
Guest
Posts: n/a
 
      08-07-2008
RC wrote:
> If I have a XML file like
>
> <header>
> <data>1.0</data>
> </header>
>
> In the header element getTextContent() why it return
> 1.0? Shouldn't it return null?
> In the data element getTextContent() should return 1.0, right?


No.

Docs say:

"This attribute returns the text content of this node and its descendants."

It takes all text for element and all elements below it.

Arne

 
Reply With Quote
 
 
 
 
Roger Lindsj÷
Guest
Posts: n/a
 
      08-27-2008
RC wrote:
> If I have a XML file like
>
> <header>
> <data>1.0</data>
> </header>
>
> In the header element getTextContent() why it return
> 1.0? Shouldn't it return null?
> In the data element getTextContent() should return 1.0, right?


The javadoc starts with "This attribute returns the text content of this
node and its descendants.".

--
Roger Lindsj÷
 
Reply With Quote
 
Roger Lindsj÷
Guest
Posts: n/a
 
      08-27-2008
Roger Lindsj÷ wrote:
> The javadoc starts with "This attribute returns the text content of this
> node and its descendants.".


Oops, didn't see the other (almost identical) answer.

--
Roger Lindsj÷
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
XPath expression for element based on content of other element withsame parent Ian Wilson XML 2 07-26-2007 04:11 PM
set dom element class (if element was dynamically created) ted benedict Javascript 3 01-27-2006 01:29 AM
get element text in DOM? Juliano Freitas Python 4 11-14-2004 10:14 AM



Advertisments