<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Get the value of an attribute by localname and URI</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="xmlreader.getattributeno.html">XMLReader::getAttributeNo</a></div> <div class="next" style="text-align: right; float: right;"><a href="xmlreader.getparserproperty.html">XMLReader::getParserProperty</a></div> <div class="up"><a href="class.xmlreader.html">XMLReader</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="xmlreader.getattributens" class="refentry"> <div class="refnamediv"> <h1 class="refname">XMLReader::getAttributeNs</h1> <p class="verinfo">(PHP 5 >= 5.1.0, PHP 7)</p><p class="refpurpose"><span class="refname">XMLReader::getAttributeNs</span> — <span class="dc-title">Get the value of an attribute by localname and URI</span></p> </div> <div class="refsect1 description" id="refsect1-xmlreader.getattributens-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>XMLReader::getAttributeNs</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$localName</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$namespaceURI</code></span> )</div> <p class="para rdfs-comment"> Returns the value of an attribute by name and namespace URI or an empty string if attribute does not exist or not positioned on an element node. </p> </div> <div class="refsect1 parameters" id="refsect1-xmlreader.getattributens-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter">localName</code></dt> <dd> <p class="para"> The local name. </p> </dd> <dt> <code class="parameter">namespaceURI</code></dt> <dd> <p class="para"> The namespace URI. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-xmlreader.getattributens-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The value of the attribute, or an empty string (before PHP 5.6) or <strong><code>NULL</code></strong> (from PHP 5.6 onwards) if no attribute with the given <code class="parameter">localName</code> and <code class="parameter">namespaceURI</code> is found or not positioned of element. </p> </div> <div class="refsect1 changelog" id="refsect1-xmlreader.getattributens-changelog"> <h3 class="title">Changelog</h3> <p class="para"> <table class="doctable informaltable"> <thead> <tr> <th>Version</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td>5.6.0</td> <td> <span class="methodname"><strong>XMLReader::getAttributeNS()</strong></span> now returns <strong><code>NULL</code></strong> if the attribute doesn't exist. </td> </tr> </tbody> </table> </p> </div> <div class="refsect1 seealso" id="refsect1-xmlreader.getattributens-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><span class="methodname"><a href="xmlreader.getattribute.html" class="methodname" rel="rdfs-seeAlso">XMLReader::getAttribute()</a> - Get the value of a named attribute</span></li> <li class="member"><span class="methodname"><a href="xmlreader.getattributeno.html" class="methodname" rel="rdfs-seeAlso">XMLReader::getAttributeNo()</a> - Get the value of an attribute by index</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="xmlreader.getattributeno.html">XMLReader::getAttributeNo</a></div> <div class="next" style="text-align: right; float: right;"><a href="xmlreader.getparserproperty.html">XMLReader::getParserProperty</a></div> <div class="up"><a href="class.xmlreader.html">XMLReader</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>