This sounds like a parser error, which means xdmp:unquote should behave the
same. With 6.0-2 a typical XML declaration works for me:
xdmp:unquote(
'<?xml encoding=UTF-8?>
<x/>')
=>
<?xml version="1.0" encoding="UTF-8"?>
<x/>
I can produce parser errors with a strange one:
xdmp:unquote(
'<?xml UTF-8>
<x/>')
=>
[1.0-ml] XDMP-DOCUNEOF: xdmp:unquote("<?xml UTF-8> <x/>") -- Unexpected end
of file at line 2 (processing-instruction starting at line 1)
And here is what might be happening:
xdmp:unquote(
'
<?xml version="1.0" encoding="UTF-8"?>
<x/>')
=>
[1.0-ml] XDMP-BADPINAME: xdmp:unquote(" <?xml version="1.0"
encoding="UTF-8"?>&...") -- Invalid processing instruction name "xml"
at line 2
Or even this is enough:
xdmp:unquote(
' <?xml version="1.0" encoding="UTF-8"?>
<x/>')
Apparently the extra blank line at the beginning is enough cause problems. So
check your input to see if it has leading whitespace of any kind.
I don't know whether this parser behavior is a bug or not. It seems
unforgiving, but http://www.w3.org/TR/REC-xml/#sec-prolog-dtd and
http://www.w3.org/TR/xml11/#sec-prolog-dtd both suggest that it's the correct
behavior. Neither grammar permits whitespace before the XMLDec, as long as one
is present. On the other hand the XMLDecl is optional, and if omitted you can
apparently have as much leading whitespace as you like.
-- Mike
On 14 Dec 2012, at 20:15 , "Tim Meagher" <[email protected]> wrote:
> Well, I tried creating an example using xquery, but trying to add the xml
> declaration to a document results in the following documented error after
> trying to create the record and not during insert:
>
> Processing instructions may not have the target 'XML'
>
> So I'm wondering if the XML declaration should never have been allowed in
> any documents being created externally for insertion and if MarkLogic
> started restricting such documents in ML 5 or 6. I'd sure like to get some
> ideas from MarkLogic about this. It doesn't seem that inserting external
> documents containing an xml declaration should be difficult to insert.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general