Antony
Antony

Reputation: 976

Marklogic Encoding Insertion using MLCP

I have inserted following XML content with "&#x2019" in the content to the MarkLogic server using XQuery.

XML content

<?xml version="1.0" encoding="ISO-8859-1"?>
<A>debtor&#x2019;s</A>

Insert XQuery used

 xdmp:document-load("C:/a.xml",
   <options xmlns="xdmp:document-load">
     <uri>a.xml</uri>
     <encoding>ISO-8859-1</encoding>
   </options>)

And I am using the following XQuery for exporting the same document.

Export XQuery used

let $xml := doc("/a.xml")
return
  xdmp:save("c:\export\a.xml", $xml,
    <options xmlns="xdmp:save">
      <output-encoding>ISO-8859-1</output-encoding>
    </options>) 

And the export output XML looks same as source document:

<?xml version="1.0" encoding="ISO-8859-1"?>
<A>debtor&#x2019;s</A>

Similarly I have inserted the source XML using MLCP and if I exported that file, it looks like below:

<?xml version="1.0" encoding="ISO-8859-1"?>
<A>debtor's</A>

But my need is to have same output as like source (i.e. it should be "debtor& #x2019;s" instead of "debtor's") though inserted using MLCP.

Are there any options or work-arounds to export as like source document for the documents inserted through MLCP?

I also tried -content_encoding ISO-8859-1 but I got same answer.

Upvotes: 2

Views: 150

Answers (1)

pythonician_plus_plus
pythonician_plus_plus

Reputation: 1294

What about this

<A><![CDATA[debtor&#x2019;s]]></A>

Upvotes: 1

Related Questions