[xquery-talk] XML prologue

Michael Dyck jmdyck at ibiblio.org
Mon Jul 25 16:14:55 PDT 2005


Frank Cohen wrote:
> 
> let $b :=<?xml version="1.0"?><frank/>
> 
> $b fails with a lexxing error.
> 
> I read the XQuery 4/2005 spec and don't see that this is not allowed
> but the 3 different XQuery processors I ran this on all have a
> problem with it.

There are a couple of things that they might be complaining about.

(1)
To the XQuery grammar, <?xml version="1.0"?> looks like a
DirPIConstructor (direct processing-instruction constructor); however,
'xml' is not allowed as a PITarget.

(2)
If the parser is being lax about PITargets, or is delaying that check to
a later phase, then it's probably complaining that you have a
(top-level) DirPIConstructor followed by a DirElemConstructor, which is
a syntax error. (ExprSingle derives PrimaryExpr derives Constructor, not
Constructor+.) It's syntactically on par with
    let $b := 1 2
or
    let $b := "hello" "world"

-Michael Dyck


More information about the talk mailing list