Text Content in 3W DOM Element

R

RC

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?
 
A

Arne Vajhøj

RC said:
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
 
R

Roger Lindsjö

RC said:
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.".
 
R

Roger Lindsjö

Roger said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top