Hi,

I am having two problems with processing instructions.

First, in general it seems I cannot create one that is before the root
element.

I can type this into QC and run it and the result is as expected:

  <?hi there?>

I can also have one embedded in an element and again it is preserved
in the output:

  <Root><?hi there?></Root>

But it seems I cannot have a PI before a root element. This does not
work when I enter it into QC, and I get “unexpected token syntax
error”:

  <?hi there?>
  <Root><?hi there?></Root>

However, that is a side issue to my main concern…

I can import an XML document that has a leading PI, store it in ML,
and it is still there when I query the document. I can even save it
using xdmp:save() and the PI is still there, as I would expect. But
when I store the XML file in a ZIP instead, it is removed!

Here is sample code that saves a ZIP file that removes the leading PI
from the document:

  let $Doc := doc("/MyDoc.xml")
 let $Parts := <parts xmlns="xdmp:zip"><part>MyDoc.xml</part></parts>
  let $ZIP := xdmp:zip-create($Parts, $Doc)
  return
    xdmp:save("c:/TEST/test.zip", $ZIP,  <options
xmlns="xdmp:save"><encoding>utf8</encoding></options>)

Does anyone have experience of this, and know any workaround. It is
really important that I preserve the PIs at the top of documents and
place them in a ZIP.

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

Reply via email to