title: The XML parse error 0xc00ce01d occurred
body: <p>i am getting xml parser error. how to handle this situation.</p>
  
  <h2>my script was</h2>
  
  <pre><code>DECLARE @xmlDoc VARCHAR(MAX)
  DECLARE @handle INT
  SET @xmlDoc = N'
  &lt;DELETED&gt;
    &lt;JID&gt;41185&lt;/JID&gt;
    &lt;WID&gt;0&lt;/WID&gt;
    &lt;AccountReference&gt;LH169&lt;/AccountReference&gt;
    &lt;OEReference&gt;Ari002&lt;/OEReference&gt;
    &lt;InvoiceNumber&gt;0&lt;/InvoiceNumber&gt;
    &lt;OrderPlacedBy&gt;Mark Catterall&lt;/OrderPlacedBy&gt;
    &lt;Specialist&gt;0FFICINA MOTTAUTO&lt;/Specialist&gt;
    &lt;UserName xsi:nil="true" /&gt;
  &lt;/DELETED&gt;'
  
  Declare @SqlQuery varchar(max)
  
  EXEC sp_xml_preparedocument @handle OUTPUT, @xmlDoc
  SET @SqlQuery ='Select '
  SELECT  @SqlQuery = @SqlQuery + LocalName  + ',' FROM OPENXML (@handle, '/DELETED', 1) 
  WHere  localname not like '#%' And id&gt;0 And localname &lt;&gt; 'nil'
  Set @SqlQuery = Substring(@SqlQuery,0,LEN(@SqlQuery)-1) + ' From tablename'
  print @SqlQuery
  --Exec @SqlQuery
  --EXEC sp_xml_removedocument @handle
  </code></pre>
  
  <p>i am getting error for <code>&lt;UserName xsi:nil="true" /&gt;</code> how to handle this situation. what to rectify in the script.</p>
  
  <p>thank</p>