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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top