[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML processor behavior with unused NS declarations

  • From: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>
  • To: Chuck Bearden <cbearden@rice.edu>
  • Date: Tue, 14 Jul 2009 11:53:14 -0600

Re:  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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.