title: How to escape special characters present in xml string in MarkLogic?
body: <p>I have a XML string coming from Java in base64 encoded format.      </p>
  
  <pre><code>PHJvb3Q+PGNoaWxkPiY8L2NoaWxkPjxjaGlsZD48PC9jaGlsZD48Y2hpbGQ+PjwvY2hpbGQ+PGNoaWxkPns8L2NoaWxkPjxjaGlsZD59PC9jaGlsZD4vcm9vdD4=
  </code></pre>
  
  <p>I decode it using <code>xdmp:base64-decode()</code>. It gives me output as </p>
  
  <pre><code>&lt;root&gt;&lt;child&gt;&amp;&lt;/child&gt;&lt;child&gt;&lt;&lt;/child&gt;&lt;child&gt;&gt;&lt;/child&gt;&lt;child&gt;{&lt;/child&gt;&lt;child&gt;}&lt;/child&gt;/root&gt;
  </code></pre>
  
  <p>The output is a string. In order to convert it to XML, I use <code>xdmp:unquote()</code>, but the special characters present here produces an error.</p>
  
  <p>I also tried using the <code>repair-full</code> option with <code>xdmp:unquote()</code>, but it didn't resolve the issue.</p>
  
  <p>Note: I have some special characters present in my actual data those are causing some unwanted errors.</p>
  
  <p>How to handle such type of scenario to insert the XML in MarkLogic?</p>