This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 4217 - xml prefix should be optional in K2-DirectConElem-38 expected output
Summary: xml prefix should be optional in K2-DirectConElem-38 expected output
Status: CLOSED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Frans Englich
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-15 08:40 UTC by Per Bothner
Modified: 2007-01-16 01:40 UTC (History)
0 users

See Also:


Attachments

Description Per Bothner 2007-01-15 08:40:16 UTC
K2-DirectConElem-38 evalutes:
<e xmlns:xml="http://www.w3.org/XML/1998/namespace"/>
The required output in K2-DirectConElem-38.txt is:
<e xmlns:xml="http://www.w3.org/XML/1998/namespace"/>
Since the xml prefix declaration is redundant, it seems like it should be optional in the output, so this should also be allowed:
<e/>
Comment 1 Per Bothner 2007-01-15 09:06:53 UTC
In fact, I might make a stronger statement:
(1) All elements provide a namespace binding for the xml prefix.
(2) The xml namespace binding should not be printed when it is implicit.
(3) There is no provision in the data model for a flag to indicate whether there was an explicit binding for the xml prefix.
(4) Hence, the xml namespace binding should not be printed when it is explicit either.
Comment 2 Michael Kay 2007-01-15 11:13:40 UTC
Oh dear, can of worms here.

The serialization spec does NOT prohibit the output of redundant namespace declarations (such as the declaration of the XML namespace).

The canonicalization spec, which we use to compare results, does say (see [1]) that superfluous namespace declarations should be ignored. However, a literal reading of that section suggests that declaring the XML namespace is considered superfluous if it appears on a child element, but not if it appears on the outermost element.

In practice, I think it would be sensible for your XML comparator to ignore any declaration of the XML namespace, wherever it appears. (It would also be sensible for published test results not to include a declaration of the XML namespace, since I would think that most serializers will remove it even though they aren't strictly required to.)

[1] http://www.w3.org/TR/xml-c14n#SuperfluousNSDecl
Comment 3 David Carlisle 2007-01-15 13:42:18 UTC
section 2.3 of c14n explicitly says
...except omit namespace node with local name xml, which defines the xml prefix, if its string value is http://www.w3.org/XML/1998/namespace.

So I think that the canonical form never has a declaration of the xml namespace.
Since the published results are not in canonical form but the xml comparison is supposed to involve generating the canonical form of each and comparing them,
I think that the expected result files are technically OK as they are, although,
there's no reason not to make the expected result files be in canon form, which in this case would mean removing the declartion.

David

Comment 4 Michael Kay 2007-01-15 13:51:38 UTC
>section 2.3 of c14n explicitly says ...except omit namespace node with local name xml

Thanks, I missed that one.
Comment 5 Frans Englich 2007-01-15 16:46:06 UTC
An attempted fix has been committed to CVS, and should be part of
XQTS_current.zip. Feel free to verify that the fix is acceptable, and if so,
change status to CLOSED. If the attempted fix is not acceptable, reopen this
report.

If no opinion about this resolution is expressed within two weeks, it will be
closed.
Comment 6 Per Bothner 2007-01-16 01:40:49 UTC
Works for me.  Thanks.