Working with xml namespaces
Add a namespace to the document
$xml->addNamespace('my', 'http://www.example.com/mytest/');
will produce
<?xml version="1.0" encoding="utf-8"?>
<root xmlns:my="http://www.example.com/mytest/">
...
</root>
Add a node with a namespace prefix
$xml->appendChild('my:othernodens', 'teste');
Add a node with a namespace
$xml->appendChild('nodens', 'teste', 'http://www.example.com/mytest/');