PHP DOMNode and nodeValue objects

When receiving a nodeValue of a DOMNode object that has entities in nodeValue (i.e. a and gt;), it converts the object to its printable character (i.e.>)

Does anyone know how to make him save him as an entity, he really mixes string comparisons when he transforms into something unexpected.

The following code reproduces the problem, you will notice that the dump length is 3, when it should be 6.

<?php
$xml='<?xml version="1.0"?>
<root>
<element>&gt;</element>
</root>';
$a=new DOMDocument();
$a->loadXML($xml);
var_dump($a->childNodes->item(0)->nodeValue);
+2
source share
1 answer

loadXML() options, LIBXML_NOENT, , default loadXML() . , -, libxml , - ,

+5

All Articles