[MarkLogic Dev General] Appending the XML declaration when making a document available for download
Tim Meagher
tim at aaom.net
Mon Jun 7 16:27:46 PDT 2010
Hi Folks,
I'm trying to insert the XML header declaration when grabbing an XML
document for download as one of the apps that reads the file needs to know
the type of encoding. I tried prepending the XML declaration and encoding by
doing the following:
let $uri := blahblahblah
let $filename := blahblahblah
let $disposition := concat("attachment; filename=""", $filename, """")
let $xml-header := <?xml version="1.0" encoding="UTF-8" ?>
return
(
xdmp:add-response-header("Content-Disposition", $disposition),
xdmp:set-response-content-type("application/xml; charset=utf-8"),
$xml-header,
doc($uri)
)
but encounter the following error:
XDMP-XMLPI: (err:XPST0003) <?xml version="1.0" encoding="UTF-8" ?> --
Processing instructions may not have the target 'XML'
How can I prepend the XML declaration without getting this error? I noticed
some example of making this work with a document insert, but can't figure
out workaround for the downloading the XML document.
Thank you!
Tim Meagher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20100607/7e53f7da/attachment.html
More information about the General
mailing list