[Home] [By Thread] [By Date] [Recent Entries]
Dear all, I would like clarification and consensus on how to treat PEs within default attribute values. The Oasis test suite contains a good example within the James Clark tests: xmltest/valid/sa/094.xml. For convenience I will repeat the test files here:- <!DOCTYPE doc [ <!ENTITY % e "foo"> <!ELEMENT doc (#PCDATA)> <!ATTLIST doc a1 CDATA "%e;"> ]> <doc></doc> At first sight it appears that the "%e;" should be dealt with as a PE in a similar way to an entity literal value. However, this is open to some interpretation. The canonical output file from James Clark's test looks like this: <doc a1="%e;"></doc> which clearly indicates that the %e; is not recognised as a PE at all. One justification for this way of thinking can be found in XML 1.0 Section 4.4 which states that PEs referenced in Attribute Values are "not recognised". But it could be argued they are not recognised simply because Attribute Values only occur outside of DTDs. Section 3.3.2 (production [60] DefaultDecl) only states that the processor should "behave as though the attribute were present with the declared default value". It does not mention "replacement text" which is the term used for entity values. When we wrote the ElCel parser we took James' test as an indication of the way to go. But I see that the Oasis tests have now been amended to show that this test was in error. Clearly there is some ambiguity here. Either they should be treated in a similar way to literal entity values (where the PEs are expanded into their replacement text without the addition of 0x20 on either side), or they should be "not recognised" as James Clark's example indicates. For parser writers the latter is probably cleaner and more efficient, but what is the consensus? Kind regards Rob Lugt http://www.elcel.com
|

Cart



