W3C home > Mailing lists > Public > public-qt-comments@w3.org > October 2008

[Bug 6152] New: Superfluous Namespace Declarations

From: <bugzilla@wiggum.w3.org>
Date: Fri, 10 Oct 2008 08:39:42 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-6152-523@http.www.w3.org/Bugs/Public/>

http://www.w3.org/Bugs/Public/show_bug.cgi?id=6152

           Summary: Superfluous Namespace Declarations
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Serialization
        AssignedTo: zongaro@ca.ibm.com
        ReportedBy: tim@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


Consider the query:

declare default element namespace 'http://www.example.org";

element a { element b {} }

or the equivalent query:

declare default element namespace 'http://www.example.org";

<a><b/></a>

We believe the serialized result of this is:

<a xmlns="http://www.example.org/">
  <b xmlns="http://www.example.org/"/>
</a>

Each namespace binding here is created as a result of the rule in Section 3.7.4
(In-scope Namespaces of a Constructed Element):

"For each namespace used in the name of the constructed element or in the names
of its attributes, a namespace binding must exist. If a namespace binding does
not already exist for one of these namespaces, a new namespace binding is
created for it. "

and the namespace binding on element b is retained during the copying of
content described in XQ 3.7.1.3 Content.  As we understand it, the namespace
binding on element a is only created _after_ its content has been evaluated,
following the pattern in 3.7.3.1 Computed Element Constructors:

1.  Deal with the element name
2.  Deal with the element content
3.  Create the element

Clearly the resulting namespace declaration on element b is superfluous. 
However, we can't find any text in the serialization specification which would
lead be to believe we are allowed to strip such superfluous namespace
declarations.

The only reference I can find to removing namespace declarations is section 5
(XML Output Method) 

"The result tree MAY contain namespace nodes that are not present in the
reconstructed tree, as the process of creating an instance of the data model
MAY ignore namespace declarations in some circumstances. See Section 6.2.3
Construction from an InfosetDM and Section 6.2.4 Construction from a PSVIDM of
[XQuery 1.0 and XPath 2.0 Data Model] for additional information."

and from the referenced documents

"Implementations may ignore namespace information items for namespaces which
are not known to be used. A namespace is known to be used if:

    * It appears in the expanded QName of the node-name of the element.
    * It appears in the expanded QName of the node-name of any of the element's
attributes.
    * It appears in the expanded QName of any values of type xs:QName that
appear among the element's children or the typed values of its attributes."

None of these appear to apply in this case.

Section 4.6 of Canonical XML Version 1.0 (Superfluous Namespace Declarations)
covers the issue, but this isn't part of the serialization process.

I would be grateful for some help with this issue.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Friday, 10 October 2008 08:39:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:53 GMT