[MarkLogic Dev General] Appending the XML declaration when making a document available for download
Tim Meagher
tim at aaom.net
Mon Jun 7 16:45:49 PDT 2010
Hi Danny,
That works - BTW, after posting the question I noticed I had pretty much
asked the same thing back in 2009 and you gave me an example then. Thanks
again and again!
Tim
_____
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Danny Sokolsky
Sent: Monday, June 07, 2010 7:41 PM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] Appending the XML declaration when
making a document available for download
Hi Tim,
How about if you make your $xml-header a string:
let $xml-header := '<?xml version="1.0" encoding="UTF-8" ?>'
-Danny
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Tim Meagher
Sent: Monday, June 07, 2010 4:28 PM
To: 'General Mark Logic Developer Discussion'
Subject: [MarkLogic Dev General] Appending the XML declaration when making a
document available for download
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/7664cc8d/attachment.html
More information about the General
mailing list