I want to write tags into .txt file with DOMDocument parser and read them but sometimes at the end I get `<` instead of `<` and `>` instead of `>`
I have sort of rendering depends on `<`and `>` so when the change into `<` and `>` it doesn't match. but in a different part of the project everything is fine (writing, reading, rendering).
write
$fh = fopen($fn, 'wb'); $str = $this->saveXML($node); fwrite($fh, $str ); fclose($fh);
where $fn is a string the holds the file path and the $node is the current node in the tree I'm navigating through
read
$fh = fopen($fn, 'rb'); $str = fread($fh, filesize($fn));
$renderer->doc .= $renderer->_xmlEntities($str);
sample input
<par><id>22</id><date>2012-04-10T14:53:06+02:00</date>
<P_title>title</P_title>
<P_body>
body
</P_body>
<keywords>keys</keywords>
</par>
result in page source
<par><id>22</id><date>2012-04-10T14:53:06+02:00</date>
<P_title>title</P_title>
<P_body>
body
</P_body>
<keywords>keys</keywords>
</par>