Hello,
the following code shows my problem:
<?php
class MyElement extends DomElement {
function __construct($name) {
parent::__construct($name);
}
}
$doc = new DomDocument();
$node = new MyElement("test");
$node = $doc->appendChild($node);
$node->setAttribute("xmlns", "http://www.somedomain.de/");
print("Namespace: '" . $node->namespaceURI . "'");
$xmlCode = $doc->saveXML();
print("<pre>" . htmlspecialchars($xmlCode) . "</pre>");
?>
the output would be:
> Namespace: ''
> <?xml version="1.0"?>
> <test xmlns="http://www.somedomain.de/"/>
As you can see it is impossible to set the namespace manually! I tried to
set it with the help of a DomNamespaceNode-object but those objects are no
"real" nodes (why!?!) and the consequence is that you couldn't append such
a node with $node->appendChild($domnamspacenode_object); ...
Further it isn't possible to use the function $doc->createElementNS(...)
because this function returns a domelement-object but i want the element to
be my own MyElement-object.
So how to get a namespace in my node???
thanks in advance,
vivi
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php