Wrong errors reported for computed elem and attr constructor

Bug #866857 reported by Gabriel Petrovay
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Released
Medium
Gabriel Petrovay

Bug Description

According to the XQuery 1.0 spec, this should fail with error err:XQDY0096
element { "xmlns:foo" } {}

This means that the check for xmlns has to be made before the casting to xs:QName which will throw err:XQDY0074.

Tags: core-runtime
Revision history for this message
Gabriel Petrovay (gabipetrovay) wrote :

I added a test for this which is currently failing:

test/rbkt/zorba/constructors/element_xmlns_prefix

Revision history for this message
Nicolae Brinza (nbrinza) wrote :

This is not correct. Please read the specs more carefully.

http://www.w3.org/TR/xquery/#id-computedElements --

"If conversion of the atomized name expression to an expanded QName is not successful, a dynamic error is raised [err:XQDY0074]."

Revision history for this message
Nicolae Brinza (nbrinza) wrote :

Please also remove the incorrect test and the expected failure.

Revision history for this message
Gabriel Petrovay (gabipetrovay) wrote :

err:XQDY0074 is the general case for:
That is the general case for:
element { "one:two:three" } {}

This means tha an invalid string literal has been passed and cannot be convertd to xs:QName.

But the provided string literal is syntactically correct, like "err:foo". Both have also a defined namespace URI in the static context.
err: http://www.w3.org/2005/xqt-errors
xmlns: http://www.w3.org/2000/xmlns/

The next paragraph in the spec handles specifically this case: invalid values for the namespace prefix and URI.

Do you have case where err:XQDY0096 is thrown? If you don't, that means that this part of the spec is not implemented.

The same problems appear also with attributed: err:XQDY0044

Revision history for this message
Nicolae Brinza (nbrinza) wrote :

I've made the change so that XQDY0096 is reported, but there is an open bug with the W3C that will make XQDY0074 a valid error for this case, see http://www.w3.org/Bugs/Public/show_bug.cgi?id=11434 .

Revision history for this message
Gabriel Petrovay (gabipetrovay) wrote :

And a similar patch for attributes is needed:

element { "err:foo" } { attribute { "xmlns:attr" } {} }

Revision history for this message
Nicolae Brinza (nbrinza) wrote :

Fixed

Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

confirmed (for Gabriel) in rev. 9554

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.