[xquery-talk] Strong data checking on @xml:id?

David Sewell dsewell at virginia.edu
Fri Jun 8 10:55:20 PDT 2012

Working within MarkLogic, I just got bitten by a server error caused by 
lexically invalid @xml:id in the input data. Boiled down, this was the 
offending query:

let $in := <input xml:id="-ptr"/>
return element out {
   attribute id { $in/@xml:id }

MarkLogic complains: XDMP-LEXVAL: xs:ID("-ptr") -- Invalid lexical value "-ptr"

So it is obviously trying to cast '-ptr' as xs:ID and failing. But I
notice that Saxon doesn't throw an error in this case. Either processor
is happy if I wrap string() around $in/@xml:id.

I'm just wondering if this is an implementation-dependent matter, or
what the specs might say about such a case.

David S.

David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 400314, Charlottesville, VA 22904-4314 USA
Email: dsewell at virginia.edu   Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/

More information about the talk mailing list