XML
Beginner
1 min read
Understanding XML Namespaces
Example
<?xml version="1.0" encoding="UTF-8"?>
<!--
Combining two vocabularies: a book record with
Dublin Core metadata and a custom inventory namespace.
-->
<inventory
xmlns="http://example.com/inventory"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.com/inventory inventory.xsd">
<!-- Default namespace: 'item' belongs to example.com/inventory -->
<item id="i001">
<!-- Prefixed namespace: dc:title belongs to Dublin Core -->
<dc:title>XML in a Nutshell</dc:title>
<dc:creator>Elliotte Rusty Harold</dc:creator>
<dc:date>2004-06-01</dc:date>
<dc:format>Book</dc:format>
<!-- Local vocabulary elements (default namespace) -->
<quantity>12</quantity>
<location>Shelf B-4</location>
</item>
</inventory>