No you must have misunderstood.

As I understand the list it should be like this.

For ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE
the documentation says:
Concatenation of the textContent attribute value of every child node,
excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the
empty string if the node has no children.

  Loop over all childs of the node, run getTextContent on each of the nodes
and concatenate the result.
  But my solution is faster. Just process each node in a depth first search
order.

For ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE,
PROCESSING_INSTRUCTION_NODE:

  Return result from getNodeValue()

For DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE return null.

This results in the following scenarios (using your example below)

poChaperElement->getTextContent() -> "Intro"
poidAttribute->getTextContent() -> "123"

/ Erik

-----Original Message-----
From: Magnus Strand [mailto:[EMAIL PROTECTED]
Sent: den 1 april 2003 11:16
To: [EMAIL PROTECTED]
Subject: RE: Implementing getTextContent


Hi,

Do you know why attribute nodes should be included?

I have just started using DOM.

Does this XML-fragments chapter element have an
attribute node as a child?
<chapter id="123">Intro</chapter >

If so, getTextContent would return "123Intro", seems strange?


Magnus



-----Original Message-----
From: Gareth Reakes [mailto:[EMAIL PROTECTED]
Sent: den 31 mars 2003 18:26
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Implementing getTextContent


Hi,
        Eric is correct. Take a look at

http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/core.html#Node3-t
extContent

for a more full explanation of what the method should do.

Gareth



On Mon, 31 Mar 2003, Erik Rydgren wrote:

> Using my best judgement I'd have to say yes. CDATA section should also
be
> included. CDATA nodes is only a specialization of text nodes to
prevent
> parsing of markup.
>
> / Erik
>
>
> -----Original Message-----
> From: Magnus Strand [mailto:[EMAIL PROTECTED]
> Sent: den 31 mars 2003 16:26
> To: [EMAIL PROTECTED]
> Subject: Implementing getTextContent
>
>
> Hi,
>
> Im trying to implement DOMNode::getTextContent using code from Erik.
>
> I have made simple tests and it works good.
>
> Do you know if getTextContent also should include CDATA-sections?
> I need to in my project.
>
> Regards,
> Magnus Strand
>
> –––––––––––––––––––––––––––––––––––––––––––––––––
> System Developer, MSc
>
> Teknik i Media Sverige AB (publ)
> Södra Förstadsgatan 2, SE-211 43 Malmö, Sweden
> Mobile: +46 704 20 57 16
> Direct: +46 40 601 57 16
> Office: +46 40 601 57 00
> http://www.tim.se
> –––––––––––––––––––––––––––––––––––––––––––––––––
> DISCLAIMER: "The information contained in this email and any
> attachment is confidential. It is intended only for the named
> addressee(s). If you are not the named addressee please notify the
> sender immediately and do not disclose, copy or distribute the
> contents to any other person other than the intended addressee(s)."
>
>
> ---------------------------------------------------------------------
> 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]
>
>

--
Gareth Reakes, Head of Product Development  +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services




---------------------------------------------------------------------
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]


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

Reply via email to