Re: Tests that depend on node being inserted for default attributes

On Fri, 2002-03-08 at 10:44, Curt Arnold wrote:
> Mary Brady wrote:
> >Did anyone try the suggestion of creating an internal dtd instead of
> external?
> >Will this fix the problem without requiring validation?
> 
> I would consider those as a distinct new tests.  We do not have clear enough
> guidance from the WG to know if default attributes from an internal subset
> should be considered "known" and therefore should be provided.

The DOM specification does not require a validating XML processor,
therefore:
[[
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.
]]
http://www.w3.org/TR/2000/REC-xml-20001006#proc-types

With the following XML document:

<?xml version='1.0'?>
<!DOCTYPE foo [
 <!ELEMENT foo EMPTY>
 <!ATTLIST foo
    bar CDATA "my_default">
]>
<foo/>

if the DOM tree does not contain the default attribute, it could be an
error from the XML processor and not necessarily from the DOM
implementation, hence the resolution from the WG to suggest a warning in
this case and not an error. If the foo attribute is present but its
specified property is true, it is not an error either since the XML
processor is not required to pass the "specified" information to the
application. 

> We do know from the WG that they believed the existing tests over-reached
> and tested behavior that was not always required.  However, they didn't
> state the conditions under which the behavior was required.

Even if the test suite has a way to determine if the underlying XML
processor is validating or not, generating an error on the DOM
implementation may be inappropriate if the default attribute is not
there since it can be a problem with the XML processor. Now, if we have
a way to ensure that the XML processor did the right thing underneath,
then it is certainly an error. One solution would be to say in the
documentation that the DOM test suite assumes that the XML processor is
XML 1.0 conformant (and points them to the XML test suite). Therefore,
not having the foo attribute would be an error.

> If the behavior was never required, then the tests should be deprecated.

The behavior was never required by the XML specification at the first
place.

Philippe

Received on Monday, 11 March 2002 17:05:06 UTC