Hi

I've tried the following code:

$dom = new DOMDocument();
$element = $dom->appendChild(new DOMElement('root'));
$attr = new DOMAttr('attr', 'attrvalue');
$element->setAttributeNode($attr);
$newNode = new DOMCdataSection('root value');
$attr->appendChild($newNode);
echo $dom->saveXML();

In the second appenChild method I'm trying to append a Cdata section as a
child of an Attribute, which is not allowed. According to the PHP manual it
should raised a DOM HIERARCHY_REQUEST error.  But although the Cdata
section is not added, it doesn't show any error message.

I'm a bit confused about the proper behavior of this method in this
particular case.
Could somebody clarify this point?

Thanks
Regards

Antonio

Reply via email to