26.01.2019 Views

XML Simplified

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Module 2<br />

Namespaces<br />

Figure 2.1 depicts duplicate elements.<br />

Concepts<br />

Figure 2.1: Duplicate Elements<br />

2.1.3 Namespaces<br />

In <strong>XML</strong>, elements are distinguished by using namespaces. <strong>XML</strong> Namespaces provide a globally unique<br />

name for an element or attribute so that they do not conflict one another.<br />

A namespace is a collection of names that can be used as element names or attribute names in <strong>XML</strong><br />

document.<br />

<strong>XML</strong> namespaces provide the following advantages:<br />

‣ ¾ Reusability<br />

<strong>XML</strong> Namespaces enable reuse of markup by making use of the elements and attributes that were<br />

defined earlier.<br />

‣ ¾ Modularity<br />

Reusable code modules can be written, and these can be invoked for specific elements or attributes.<br />

Elements and attributes from different modules can be integrated into a single <strong>XML</strong> document.<br />

Universally unique element names and attributes guarantee that such modules can be invoked for<br />

certain elements and attributes.<br />

‣ ¾ Extensibility<br />

<strong>XML</strong> Namespaces provide the <strong>XML</strong> documents with the ability to embed elements and attributes<br />

from other vocabularies like MathML, XHTML (Extensible HyperText MarkUp Language), and so<br />

forth.<br />

Version 1.0 © Aptech Limited<br />

<strong>XML</strong> <strong>Simplified</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!