PHP | DOMNode lookupNamespaceUri() Function Last Updated : 02 Mar, 2020 Comments Improve Suggest changes Like Article Like Report The DOMNode::lookupNamespaceUri() function is an inbuilt function in PHP which is used to get the namespace URI of the node based on the prefix. Syntax: string DOMNode::lookupNamespaceUri( string $prefix ) Parameters: This function accepts a single parameter $prefix which holds the prefix. Return Value: This function returns namespace URI of the node. Below examples illustrate the DOMNode::lookupNamespaceUri() function in PHP: Example 1: php <?php // Create a new DOMDocument instance $document = new DOMDocument(); // Create a XML variable with no namespace $xml = <<<XML <?xml version="1.0" encoding="utf-8"?> <root> <h1>GeeksforGeeks</h1> </root> XML; // Load the XML $document->loadXML($xml); // Get the default namespace URI $uri = $document->documentElement->lookupnamespaceURI(null); echo $uri; ?> Output: // Empty string which means no namespace is there. Example 2: php <?php // Create a new DOMDocument instance $document = new DOMDocument(); // Load the XML with a namespace with prefix x $document->loadXML("<?xml version=\"1.0\"?> <div xmlns:x=\"my_namespace\"> <x:h1 x:style=\"color:red;\"> GeeksforGeeks </x:h1> </div> "); // Get the URI with prefix x $uri = $document->documentElement->lookupnamespaceURI('x'); echo $uri; ?> Output: my_namespace Reference: https://www.php.net/manual/en/domnode.lookupnamespaceuri.php Comment More infoAdvertise with us Next Article PHP | DOMNode lookupNamespaceUri() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-DOM Similar Reads PHP | DOMNode lookupPrefix() Function The DOMNode::lookupPrefix() function is an inbuilt function in PHP which is used to get the namespace prefix of the node based on the namespace URI.Syntax:Â Â string DOMNode::lookupPrefix( string $namespaceURI ) Parameters: This function accepts a single parameter $namespaceURI which holds the namesp 1 min read PHP | DOMNode isDefaultNamespace() Function The DOMNode::isDefaultNamespace() function is an inbuilt function in PHP which is used to check if the specified namespaceURI is the default namespace or not. Syntax: bool DOMNode::isDefaultNamespace( string $namespaceURI ) Parameters: This function accepts a single parameter $namespaceURI which hol 1 min read PHP | XMLReader lookupNamespace() Function The XMLReader::lookupNamespace() function is an inbuilt function in PHP which is used to lookup in scope namespace for a given prefix. Syntax: string XMLReader::lookupNamespace( string $prefix ) Parameters: This function accepts a single parameter $prefix which holds the string containing the prefix 1 min read PHP | DOMNode normalize() Function The DOMNode::normalize() function is an inbuilt function in PHP which is used to remove empty text nodes and merge adjacent text nodes in this node and all its children. Syntax: void DOMNode::normalize( void ) Parameters: This function doesnât accept any parameters. Return Value: This function does 2 min read PHP | DOMNode isSameNode() Function The DOMNode::isSameNode() function is an inbuilt function in PHP which indicates if two nodes are the same node or not. Syntax: bool DOMNode::isSameNode( DOMNode $node ) Parameters: This function accepts a single parameter $node which holds the node to be compared. Return Value: This function return 2 min read Like