I am using PHP to generate XML file. I have to add space and = sign in XML node name like below
<a name="someName">someValue</a>
but it is showing Invalid Character Error when I use code as
$parentnode->appendChild($dom->createElement('a name="somName"'));
Because
createElement()only accept tag name and text content of tag as parameter and you should usesetAttribute()to add attribute to element.You can check result is demo