OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Namespace conformance & SAX2



Chris Nokleberg <chris@sixlegs.com> wrote:


> The Namespace spec adds additional conformance constraints beyond XML 1.0:
>   * All element types and attribute names contain either zero or one
colon.
>   * 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 [1] 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
dictates.

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 [2].

The rec [1] 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
application.

- 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 [2] as a well-formedness constraint.  Therefore they should be
reported as fatal errors.

[1] http://www.w3.org/TR/REC-xml-names/
[2] http://www.w3.org/TR/REC-xml

Regards
Rob Lugt
ElCel Technology
http://www.elcel.com/