DomNode->add_namespace

Adds a namespace declaration to a node ()

DOMNode {
  bool add_namespace(string uri,
                     string prefix);

}

This method adds a namespace declaration to a node.

注意:

This method is not part of the DOM specification.

参数

uri

The namespace URI of the node.

prefix

The namespace prefix of the node.

返回值

如果成功则返回 TRUE,失败则返回 FALSE

Migrating to PHP 5

You can set the namespace URI and prefix of a DOMElement or a DOMAttr at creation time by using DOMDocument->createElementNS() or DOMDocument->createAttributeNS().

注意:

Remember the an attribute does not inherit its namespace from the element it is attached to.