1

I have an xml that I must sign, however when I send it it has a structure something like this:

<cbc:EncodingCode>UTF-8</cbc:EncodingCode>
<cbc:Description>
    <![CDATA[<ApplicationResponse xmlns="urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2".....

After passing it through the conocalization with C14N(), you are like this

<cbc:EncodingCode>UTF-8</cbc:EncodingCode>
<cbc:Description>
    &lt;ApplicationResponse xmlns="urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2"

Changing the characters < > by &gt; &lt; and remove <![CDATA[]]>

What do I do, help?

  • It's parsed correctly. Instead of using C14N, you should reach for saveXML. For example: `echo htmlentities($dom->saveXML($dom->getElementsByTagNameNS('*','Description')[0]->firstChild));` – Kevin Y Jul 13 '22 at 05:04
  • Hi, thanks for your response. However the result remains the same. <![CDATA[<ApplicationResponse xmlns="urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" – Camilo Castilla Jul 14 '22 at 14:25
  • Remove the htmlentities. That was for outputting it to browser. – Kevin Y Jul 14 '22 at 14:40
  • I see the desired CDATA in the output you're showing with my code. – Kevin Y Jul 14 '22 at 14:46

0 Answers0