XML
Namespaces
Declare and use XML namespaces.
By EZ4Code Team
namespacexmlns
Code
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://example.com/default"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:office="urn:office:1.0">
<office:item>Stapler</office:item>
<xs:schema ref="schema.xsd"/>
<element>Default namespace applies here</element>
</root>Explanation
XML namespaces qualify element and attribute names with URIs to avoid collisions between vocabularies. The xmlns attribute declares a default namespace while xmlns:prefix binds a prefix that must precede each namespaced element. Unlike elements, attributes are not affected by a default namespace.