[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Namespace conformance & SAX2
- From: Rob Lugt <email@example.com>
- To: Chris Nokleberg <firstname.lastname@example.org>, email@example.com
- Date: Sat, 19 May 2001 22:22:51 +0100
Chris Nokleberg <firstname.lastname@example.org> wrote:
> The Namespace spec adds additional conformance constraints beyond XML 1.0:
> * All element types and attribute names contain either zero or one
> * No entity names, PI targets, or notation names contain any colons.
> Is a non-validating SAX2 parser required to check these constraints?
> My suggestion is that it should be required to check iff the
> http://xml.org/sax/features/namespaces feature is true.
Firstly, I think after reading the namespaces rec  section 6 carefully,
that the two "constraints" you quote above are not, in fact, namespace
constraints, rather they are just a clarification of the effects of using
the Qname and NCName productions in the places that the recommendation
Therefore, it follows that when namespaces are enabled, any XML processor
(whether SAX or not, validating or not) should report a fatal error when the
QName or NCName productions are not matched. This is because syntax errors
are well-formedness errors and reporting well-formedness errors as fatal
errors is in keeping with XML 1.0 .
The rec  does, however, dictate a number of additional namespace
constraints. It does not dictate the effect that these constraints should
have on processing but it is my belief that nearly are all fatal errors.
Let me explain why.
There is only a short list of namespace constraints (NSC):-
- Namespace Constraint: Leading "XML"
The "XML" prefix is reserved for use by XML-related specifications. It is
unwise for XML processors to actually check for this because they would risk
becoming broken when new specifications are created. I think this is a
directive at document creators, not processor implementers.
- Namespace Constraint: Prefix Declared
A namespace prefix must be declared before it is used. This should be a
fatal error because the XML processor will be unable to report to the
application the correct namespace uri for the name. This should not be
allowed to happen, as it could have unpredictable results for the
- 5.3 Uniqueness of attributes
When a single namespace uri is bound to two different prefixes it is
possible for duplicate attributes to be created, even though they appear to
be different under XML 1.0 rules. Duplicate attributes are disallowed in
XML 1.0  as a well-formedness constraint. Therefore they should be
reported as fatal errors.