Hi,

The XML Recommendation (Second Edition) states in section 5.1:

"Non-validating processors are required to check only the document entity, including the entire internal DTD subset, for well-formedness. [Definition: While they are not required to check the document for validity, they are required to process all the declarations they read in the internal DTD subset and in any parameter entity that they read, up to the first reference to a parameter entity that they do not read; that is to say, they must use the information in those declarations to normalize attribute values, include the replacement text of internal entities, and supply default attribute values.] Except when standalone="yes", they must not process entity declarations or attribute-list declarations encountered after a reference to a parameter entity that is not read, since the entity may have contained overriding declarations." [1]

This means - as far as I understand it and the E 47 of the Errata as of 2003-03-26 clarifies it [2] - if you have the following example XML document:

<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>

<!DOCTYPE test [

    <!ENTITY % dtd SYSTEM "test.ent">
    %dtd;

    <!ATTLIST test attrB CDATA "surprise">
    <!ENTITY entA "surprise">

]>

<test attrA="XYZ">&entA;</test>

it's not conforming to the XML recommendation to get the output:

<test attrA="XYZ" attrB="surprise">surprise</test>

after parsing.

But that's exactly what I get with Xerces-J 2.4.0. I'm parsing via the DocumentBuilder of JAXP and have set the external-parameter-entities feature to false (of course also the validation feature). After parsing I just serialize the parsed document.

Can someone explain this or supply a solution how to simulate a behaviour which is compliant to the recommendation.

I'm using Xerces-J 2.4.0 with JDK 1.4.2 on a Windows 2000 PC.

[1] http://www.w3.org/TR/REC-xml#proc-types
[2] http://www.w3.org/XML/xml-V10-2e-errata

Thanks for any hints.

Franz-Josef Herpers



--
Franz-Josef Herpers
Puschkinallee 9A
12435 Berlin
030/53 21 33 02
0173/54 23 666
[EMAIL PROTECTED]


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



Reply via email to