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 multipletext nodes?

On Sat, 2022-02-12 at 00:31 +0000, Roger L Costello wrote:
> Thank you Michael, Ken, and Liam for your fantastic explanations!
> 
> I have one more question, please. 
> 
> Is it this: abc&def (i.e., the entity is resolved)?

Yes, although it's optional with some parsers.

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

It is, although printing out the value will put & back; try string-
length() on it.

$ xmllint --xpath '/Test[text() = "abc&def"]' /tmp/test.xml 
<Test>abc&amp;def</Test>

$ xmllint --xpath 'string-length(/Test)' /tmp/test.xml 
7

% 

Note that if you put a reference to an external parsed entity in there,
you'll get a different result, with the contents of the external
document fragment being included in place. In some implementations
(e.g. DOM-based) an ENTITY node may be retained for an entity
reference; the XDM doesn't have an ENTITY node type, however, so likely
it won't be visible to XPath, but a JavaScript program could see it.

Liam


-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org



[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