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 21931 - app/Demos/currencysvg-result.xml should not have an XML declaration.
Summary: app/Demos/currencysvg-result.xml should not have an XML declaration.
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3 & XPath 3 Test Suite (show other bugs)
Version: Working drafts
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: O'Neil Delpratt
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-05 21:08 UTC by Leo Wörteler
Modified: 2014-03-19 10:49 UTC (History)
2 users (show)

See Also:


Attachments

Description Leo Wörteler 2013-05-05 21:08:28 UTC
The documentation of `<assert-xml>` says:

> Asserts the result of the query by providing a serialization of the expression
> result using the default serialization parameters method="xml" indent="no"
> omit-xml-declaration="yes".

As the file "app/Demos/currencysvg-result.xml" has an XML declaration, I don't think the test case "currencysvg" can succeed:

>   <test-case name="currencysvg">
>      [...]
>      <test file="Demos/currencysvg.xq"/>
>      <result>
>         <assert-xml file="Demos/currencysvg-result.xml"/>
>      </result>   
>   </test-case>
Comment 1 Michael Kay 2013-05-05 21:35:11 UTC
You're correct that the test isn't following the authoring guidelines. However, this shouldn't cause the test to fail. The documentation also states (on the "running tests" page): 

The assert-xml assertion succeeds if the result is an XML document that compares deep-equal to the document contained (in XML form) in the assertion.

And it also says (in the schema documentation): The assertion is true if the result of parsing and canonicalizing the XML given in the body of the assert-xml element is the same (byte-for-byte) as the result of canonicalizing the XML result of the query. 

Clearly the presence of the XML declaration does not affect the comparison if it is done according to these rules.

Assert-xml should not be interpreted as a comparison of serialized results; the schema comments make this clear.
Comment 2 Leo Wörteler 2013-05-05 21:46:20 UTC
Correct, I misinterpreted the part saying:

> The value will not necessarily be a well-formed document (it may be a fragment). 
> The comparison can be done by converting the string into a well-formed
> document by adding a wrapper element.

Doing this textually yields invalid XML if an XML declaration is present.
Comment 3 O'Neil Delpratt 2013-06-12 15:33:50 UTC
(In reply to comment #2)
> Correct, I misinterpreted the part saying:
> 
> > The value will not necessarily be a well-formed document (it may be a fragment). 
> > The comparison can be done by converting the string into a well-formed
> > document by adding a wrapper element.
> 
> Doing this textually yields invalid XML if an XML declaration is present.

No it does not. An XML declaration is optional and if included does not count towards the well-formedness of an XML document.
Comment 4 Christian Gruen 2013-06-26 14:01:51 UTC
I agree with Leo that the XML declaration should be removed in this test. First, the resulting XML will indeed be invalid if the string with the XML declaration is converted "into a well-formed document by adding a wrapper element.", as proposed in the documentation. Second, it seems to be the only test case that does not follow the authoring guidelines, so it’s probably less effort than aligning the documentation.
Comment 5 O'Neil Delpratt 2013-07-02 15:47:23 UTC
I withdraw my comment in #3. If we all agree I will will remove the XML declaration
Comment 6 Leo Wörteler 2013-07-02 16:19:10 UTC
That would be great.
Comment 7 O'Neil Delpratt 2014-03-19 10:49:01 UTC
Bug fixed and committed to cvs