XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] How can the content of a leaf element be multiple textnodes?

Thank you Michael, Ken, and Liam for your fantastic explanations!

I have one more question, please. 

But first, I would like to summarize what I learned:

Consider this leaf element, in which "abc" and "def" are separated by a space:

<Test>abc def</Test>

How many text nodes are within the <Test> element?

Answer: 1

The text is: "abc def"

Michael Kay said in an earlier post: An element cannot have two adjacent text nodes.

Next, suppose that "abc" and "def" are separated by a comment:

<Test>abc<!-- blah -->def</Test>

Now how many text nodes are within the <Test> element?

Answer: 2

text[1] = "abc" and text[2] = "def"

Suppose that "abc" and "def" are separated by a CDATA section:

<Test>abc<![CDATA[blah]]>def</Test>

Now how many text nodes are within the <Test> element?

Answer: 1

The CDATA section is removed by the parser, so there is just one text string: abcblahdef

Suppose that "abc" and "def" are separated by a PI:

<Test>abc<?foo test?>def</Test>

Now how many text nodes are within the <Test> element?

Answer: 2

The PI is similar to a comment - they both interrupt "abc" and "def"

Lastly, how many text nodes are within this <Test> element?

<Test>abc&amp;def</Test>

Answer: 1

Interesting!

So, what is the text? 

Is it this: abc&def (i.e., the entity is resolved)?

No! 

The text is this: abc&amp;def (the entity is *not* resolved)

Huh? 

Why isn't the entity resolved? 

Why isn't this the text: abc&def (i.e., the entity is resolved)?

/Roger



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS