Convert & lt to <xml document
I read the XML file and converted to an NSXMLDocument object. But due to the presence of "<" in the string content of the node, it has been converted to "& lt". Therefore, when I write it as an XML document to a file, it has the "& lt" symbol in it.
How can I write the file as a regular XML file, in which "& lt" will be replaced by "<".
Thank you and respect, Lenin
+5
5 answers
& lt < XML php:
$xmlFile = file_get_contents("example.xml");
$xml= str_replace(['<','>'],['<','>'], $xmlFile);
echo $xml;
I get the feed from the server via XML and then save it in another XML file, I get the result with <and >, therefore, I used this method. This is not the smartest way to store XML, but I'm not a senior professional either.
0