Hi Betty, Returning an XML declaration in the response is done by prepending the output with something like: '<?xml version="1.0" encoding="UTF-8" ?>', as simple as that. Perhaps a bit counter-intuitive, but there are not much alternatives.
This should also account for xdmp:save. It is hard to tell without more information, why it goes wrong for you.. Kind regards, Geert > Drs. G.P.H. Josten Consultant http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: [email protected] > [mailto:[email protected]] On Behalf Of > Betty Harvey > Sent: zaterdag 19 september 2009 23:13 > To: General Mark Logic Developer Discussion > Subject: [MarkLogic Dev General] How to Add XML Declaration > > What is the best approach to add the XML Declaration to a > file. I have placed WordML files in the repository. Without > the XML Declaration, Microsoft Word sees the file as an ASCII > file. Saving the file and adding the XML declaration in the > file makes Word happy. > > As a work around I have saved the original file with the XML > Declaration outside of MarkLogic and point to the external > file when a search results points to the document. This is > o.k. for now but not a long-term solution. > > I tried the following approach: > > xdmp:save("temp.xml", document { $declaration, $i } ) > > The result of the above command is that the command and the > entire XML file is dumped to the screen: > > <!-- output --> > xdmp:save("temp.xml", document <?xml version="1.0" > encoding="UTF-8" ?>ERA Vision > StatementnaraBetty222002-04-18T17:10:00Z2009-09-16T14:41:00Z20 > 09-09-16T14:41: > . . . > > Thanks! > > Betty > > /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ > Betty Harvey | Phone: 410-787-9200 FAX: 9830 > Electronic Commerce Connection, Inc. | > [email protected] | Washington,DC XML Users Grp > URL: http://www.eccnet.com | http://www.eccnet.com/xmlug/ > /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/ > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
