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

David Lee dlee at calldei.com
Fri Jun 8 11:35:21 PDT 2012

I belive the issue is that of validation.
MarkLogic is a validating XQuery parser so is validating xml:id against the standard XML schemas.   "-ptr" is not a valid xml:id

Saxon HE (I presume you are using HE), otoh, is not a validating XQuery engine.

David A. Lee
dlee at calldei.com

> -----Original Message-----
> From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On
> Behalf Of David Sewell
> Sent: Friday, June 08, 2012 1:55 PM
> To: talk at xquery.com
> Subject: [xquery-talk] Strong data checking on @xml:id?
> 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/
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk

More information about the talk mailing list