Entity processing (was new msxml behaviour)

Richard Tobin richard at cogsci.ed.ac.uk
Wed Nov 5 17:39:07 GMT 1997


>Could somebody post the result of parsing the files Tim Bray posted according 
>to spec since there seems to be some question as to whether or not msxml is 
>doing it properly.

Well here's what my XML parser makes of them.  It's *intended* to
parse according to spec :-)

-- Richard

EntVal.xml:

<?XML VERSION="1.0" ENCODING="ISO-8859-1" RMD="ALL"?>
<!doctype TEST [
<!ELEMENT test (#PCDATA) >
<!ENTITY % xx '&#37;zz;'>
<!ENTITY % zz '&#60;!ENTITY tricky "error-prone" >' >
%xx;
<!ENTITY example "<p>An ampersand (&#38;#38;) may be escaped
 numerically (&#38;#38;#38;) or with a general entity
 (&amp;amp;).</p>" >
<!ENTITY % pub    "&#Xc9;ditions Gallimard" >
<!ENTITY   rights "All rights reserved" >
<!ENTITY   book   "La Peste: Albert Camus, &#Xa9; 1947 %pub;. &rights;" >
<!ENTITY   rights " - all rights reserved - ">
]>
<TEST>
<E1>This sample shows a error-prone method.</E1>
<E2><P>An ampersand (&) may be escaped
 numerically (&#38;) or with a general entity
 (&amp;).</P></E2>
<E3>La Peste: Albert Camus, © 1947 Éditions Gallimard. All rights reserved</E3>
</TEST>

It also produces the following warnings:

Warning: Ignoring redefinition of entity rights
 in unnamed entity at line 13 char 47 of file:/home/richard/XML/EntVal.xml
Warning: start tag for undeclared element E1; declaring it to have content ANY
 in unnamed entity at line 16 char 4 of file:/home/richard/XML/EntVal.xml
Warning: start tag for undeclared element E2; declaring it to have content ANY
 in unnamed entity at line 17 char 4 of file:/home/richard/XML/EntVal.xml
Warning: start tag for undeclared element P; declaring it to have content ANY
 in entity "example" defined at line 7 char 1 of file:/home/richard/XML/EntVal.xml
 in unnamed entity at line 17 char 14 of file:/home/richard/XML/EntVal.xml
Warning: start tag for undeclared element E3; declaring it to have content ANY
 in unnamed entity at line 18 char 4 of file:/home/richard/XML/EntVal.xml

EntVal2.xml:

<!doctype FOO [
 <!ENTITY lt "&#60;">
 <!ENTITY  b "{Value of b}">
 <!ENTITY weird 'fo&#77;o&lt;bar'>
 <!ENTITY % d '{Value of d}'>
 <!ENTITY % defatt1 'DEF1 CDATA "{default 1}"'>
 <!ENTITY % bazatt '<!ATTLIST BAZ BIFF CDATA "QuidNunc" BAR CDATA "xyxy">'>
 <!ELEMENT FOO - - (#PCDATA|BAZ|BUM)*>
 <!ELEMENT BAZ - - (#PCDATA)>
 <!ELEMENT BUM - - (#PCDATA)>
 <!ATTLIST FOO BAR CDATA "A&b;C%d;E&#77;F">
         
 <!ATTLIST FOO BAR CDATA "Should not appear"> 
 %bazatt;
 <!ATTLIST BAZ %defatt1;> 
]>
<!--<FOO test='KL&#77;NO'>hi &lt;there--><FOO BAR="A{Value of b}C%d;EMF">
<BAZ BAR="A{Value of b}C%d;EMF" DEF1="{default 1}" BIFF="QuidNunc"></BAZ>
<BUM>foMo<bar</BUM>
</FOO>

Warnings:

Warning: Ignoring redeclaration of attribute BAR
 in unnamed entity at line 14 char 45 of file:/home/richard/XML/EntVal2.xml

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list