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


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] XML processor behavior with unused NS declarations

On 14 Jul 2009, at 10:38 , Chuck Bearden wrote:

> Is a namespace-aware XML processor permitted to drop a namespace  
> declaration when no elements or attributes in that namespace are  
> used within the scope of the declaration?

Permitted by whom or what?  Without that detail, no answer to
this question is going to hold any water.

The XML spec does not specify what information an XML parser
must provide to a downstream application (with the exception
of some quixotically detailed information about white space,
which was the one thing that seemed non-obvious enough to
merit specification).  So a parser that silently drops all
attributes with names containing an 'e' or with values containing
the substring '42' is hard to convict of non-conformance,
although it is easy to decide that you don't particularly
want to use it.  (You are right that a namespace-oblivious
XML processor will treat namespace attributes as attributes
-- in the XML grammar they *are* in fact attributes -- but
wrong to believe that the spec requires that all attributes
be 'retained'.)

The XML Infoset spec (which some people expected to provide
the missing normative statements about what a parser should
tell the downstream app) also does not specify what information
an XML parser must provide.  So it may be hard to prove
that my Perec/Adams parser fails to conform to the infoset
spec, either; what the Infoset spec says is that what that
parser provides is not the 'attributes' property of the
element but something else.

The namespaces spec does not, as far as I can see, forbid
the dropping of random information, either (within limits).

The XSLT 1.0 spec explicitly provides for dropping
certain namespace nodes (and I cannot at first glance find
any exception for namespaces that are actually used by
the element on which the namespace node is excluded).

Fortunately, the marketplace is by and large less forgiving
on this subject than the specs.  For the reasons mentioned
by Ken Holman, and possibly just because it's easier to
do it that way, all the widely used processors I know
anything about will retain namespace nodes in the cases
you describe.

* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com
* http://cmsmcq.com/mib
* http://balisage.net

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS