DOMNode->lookupNamespaceURI()

(no version information, might be only in CVS)

DOMNode->lookupNamespaceURI() --  Gets the namespace URI of the node based on the prefix

说明

class DOMNode {

string lookupNamespaceURI ( string prefix )

}

Gets the namespace URI of the node based on the prefix.

参数

prefix

The prefix of the namespace.

返回值

The namespace URI of the node.


add a note add a note User Contributed Notes
Richard Remer
16-Sep-2006 01:51
One might expect DOMNode::lookupNamespaceURI( null ) to return the default namespace of the node (as the XML DOM spec indicates), but in fact it return nothing.

Added to this problem is the fact that DOMNode::getAttribute( 'xmlns' ) will not return the value of the xmlns attribute, so it is not possible to "walk" the tree back to find the default namespace.

As far as I can tell, there is no way in PHP 5 DOM to determine what the default namespace is in an XML document.