Let me restate the problem.

If I use an editor to manually create this XML document and save it to 
MarkLogic 
via WebDav or other means:

<?xml version="1.0" encoding="UTF-8"?>
<doc>
   <line>line 1</line>
   <line>line2</line>
</doc>

then when I subsequently open that document from the database via WebDav or a 
doc() call, it arrives with its indentation preserved. I want to know how to 
generate a new file via XQuery such that it will have indentation when 
subsquently opened via WebDav or a doc() call.

(It's not mission-critical, but I'm auto-generating a 50MB data file that I 
would like to be able to open in oXygen via WebDav with its elements already 
indented, since thing go much faster that way.)

DAvid

On Tue, 14 Oct 2014, Mary Holstege wrote:

> On Tue, 14 Oct 2014 12:28:52 -0700, David Sewell <dsew...@virginia.edu>
> wrote:
>
>> Given this code:
>>
>> xquery version "1.0-ml";
>> declare option xdmp:output "indent-untyped=yes";
>> declare option xdmp:output "omit-xml-declaration=yes";
>> xdmp:document-insert(
>>    "/test.xml",
>>    <doc>
>>      <line>line 1</line>
>>      <line>line2</line>
>>    </doc>
>> ) ;
>>
>> doc("/test.xml")
>>
>> The output I'm getting is
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <doc><line>line 1</line><line>line2</line></doc>
>>
>> which is disobeying both serialization optinons I specified. ML version
>> 7.0-4.
>> Are other people seeing this? Am I missing something?
>>
>> David
>>
>
>
> Two things:
> (1) If you are running this in QConsole all bets are off, because the
> serialization
> options apply in the query that does the serialization and everything in
> QConsole
> is run in a separate eval.
>
> (2) The serialization options are before the semi-colon, that is, they
> only apply to
> the xdmp:document-insert part of this file. If you want them to apply to
> the
> serialization of doc("/test.xml") you need to put them into that query.
>
> //Mary
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
>

-- 
David Sewell, Editorial and Technical Manager
ROTUNDA, The University of Virginia Press
PO Box 400314, Charlottesville, VA 22904-4314 USA
Email: dsew...@virginia.edu   Tel: +1 434 924 9973
Web: http://rotunda.upress.virginia.edu/
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to