Tuesday 15 April 2014

php - DOMDocument disable character escaping -


I am trying to disable the DOMDocument character escape I

So when JSON From: node: "Something": "<

I want to make it the exact same output in XML: & lt; Some values ​​= "& lt; & gt; Connotascape" /> Instead I get: & lt; Some values ​​= "& amp; lt; amp; gt; connotoscope" / & gt;

I have already tried to shut down the option options and solutions efforts, they have $ this- & gt; Document-> SaveXML ($ this- & gt; Document-> Document Element); But nothing does not work for me

I am not loading XML, instead, I am crossing the JSON tree and making the domains. The values ​​are not saved before saving the values ​​on each element, so I believe, it is any way possible through DOMDocument.

This would be invalid XML, so this is not possible.

Example:

  & lt ;? Php $ dom = new DOMDocument (); $ Dom- & gt; Load xml ('& lt; some value =' & lt;> chronuscope) />;);  

Output:

  WARNING: DOMDocument :: loadXML (): Unspecified '& lt;' Entryboots are not allowed in the value of the entry, warning in the 3 line in / tmp / ... in line: 1: DOMDocument :: loadXML (): Generate an error in the Entrybles unit, in line: 1 / tmp / .. On line 3  

You will need to know that this is only the serialization. If you get the value of the attribute then the institutions will be decoded.

  ;; Php $ dom = new DOMDocument (); $ Dom- & gt; Load xml ('& lt; some values ​​= "& amp; lt; & gt; connotoscope" />); Var_dump ($ Dom-> documentElement-> getAttribute ('value'));  

Output:

  string (17) " 

No comments:

Post a Comment