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 3635 - prolog-version-2
Summary: prolog-version-2
Status: RESOLVED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 1.0
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Carmelo Montanez
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-26 21:28 UTC by Michael Kay
Modified: 2006-09-01 07:32 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2006-08-26 21:28:46 UTC
The query file prolog-version-2.xq has an encoding declaration asserting that it is encoded in UTF-16 - but it isn't.

The handling of an incorrect encoding declaration is entirely implementation-dependent. In this case it appears that Saxon on the Java platform recovers from the error, but on the .NET platform it falls over with a random syntax error.
Comment 1 Andrew Eisenberg 2006-08-29 19:13:39 UTC
I agree that the query should be UTF-16 encoded to match the declaration in the prolog.

In section 4.1, Version Declaration, XQuery says, "The handling of an encoding declaration is implementation-dependent."

We don't specify an error in this clause, other than XQST0031, which is concerned only with the name of the encoding. I think that this test case should accept a parse error, XPST0003, from implementations that don't support UTF-16 queries.
Comment 2 Michael Kay 2006-08-29 19:24:17 UTC
There's a reason that we don't specify an error code, namely that we recognize that the error might be detected not by the query processor, but by some low-level software perhaps in the operating system, which might be difficult for the query processor to trap and interpret. It might even result in the query processor parsing and executing a different query from the one intended! So I don't think this case belongs in the test suite, since the outcome is so unpredictable.
Comment 3 Carmelo Montanez 2006-08-31 17:30:32 UTC
I sort of agree with Michael on this one.   Perhaps the test does needs to be removed.  Any thoughts?

Carmelo
Comment 4 Frans Englich 2006-08-31 17:38:57 UTC
Accepting XPST0003 would only make the test pass for implementations that issue XPST0003(since it's implementation defined, no one is required to issue XPST0003).

I think it is important to have tests that are in the UTF-16 encoding, so I believe the correct resolution is to keep the test and keep 'xquery version "1.0" encoding "utf-16";', but to convert the file to actually be in UTF-16 encoding.


Frans
Comment 5 Carmelo Montanez 2006-08-31 17:45:59 UTC
Frans:

Thanks.  I can be persuaded either way.  Do you know of any UTF-16 conversion tools?

carmelo
Comment 6 Carmelo Montanez 2006-08-31 18:35:39 UTC
Frans:

Never mind, I found a way to reformat the file.  Submitted new file
on UTF-16 format.

Thanks.

carmelo
Comment 7 David Carlisle 2006-08-31 20:54:49 UTC
I think the catalog ought to flag the encoding of the file (anywhere, eg encoding="utf-16" in the query element). A system might be able to read in utf16 (and check the encoding specified) if it is given warning of the encoding. It needn't be ableto be auto detect the encoding from the prplog (eg the guidelines give examples saying teh query may be embedded in a host language, eg sql in which case the encoding of the file would necessarily be determined by the host language parser.
Comment 8 Tom Brosens 2006-09-01 07:32:00 UTC
That's +1 for David's solution. Although we could auto-detect the encoding it would be a lot easier if the encoding is in the catalog for query files which are not UTF-8 encoded.

Thanks,
Tom.