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

 

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to