How to use getDocNamespaces in PHP
In this article I will explain how getDocNamespaces function used in PHP.
getDocNamespaces() Function
This function receive the namespaces which is declared in an XML document and gives an array of the namespaces in an XML document on success, or FALSE on failure.
Syntax
class SimpleXMLElement
{
string getDocNamespaces(recursive)
} |
Example
XML file
<?xml version="1.0" encoding="ISO-8859-1"?>
<note xmlns:b="https://dotnetheaven.com/articles/">
<to>Sachin</to>
<from>Bhardwaj</from>
<heading>Reminder</heading>
<b:body>Don't forget me this weekend!</b:body>
</note> |
PHP Code
<html>
<body>
<?php
if (file_exists('D:\sachin\parse.xml'))
{
$xml = simplexml_load_file('D:\sachin\parse.xml');
}
print_r($xml->getDocNamespaces());
?>
</html>
</body> |
Output

You may also want to read these related articles Click here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here