|
DOMDocument::createElementNSCreate new element node with an associated namespace Beschreibung
public DOMElement DOMDocument::createElementNS
( string
$namespaceURI
, string $qualifiedName
[, string $value
] )This function creates a new element node with an associated namespace. Dieser Knoten wird in Ihrem Dokument nicht sichtbar sein, bis dieser zum Beispiel mit der Funktion DOMNode::appendChild eingefügt wird. Parameter-Liste
Rückgabewerte
The new DOMElement or Fehler/Exceptions
Beispiele
Beispiel #1 Creating a new element and inserting it as root
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe: <?xml version="1.0" encoding="utf-8"?> <xfoo:test xmlns:xfoo="http://www.example.com/XFoo">This is the root element!</xfoo:test> Beispiel #2 A namespace prefix example
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe: <?xml version="1.0" encoding="utf-8"?> <element xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0"> <g:item_type>house</g:item_type> </element> http://base.google.com/ns/1.0 g item_type Siehe auch
|