0% found this document useful (0 votes)
25 views

XML Namespace

Uploaded by

ARBAAZ ALI
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

XML Namespace

Uploaded by

ARBAAZ ALI
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

XML Namespace

XML Namespace

 XML namespace is a simple collection of names, such as the names of the elements and
attributes allocated in the XML document.
 It allows each element and attribute in a document to be placed in a different namespace
mapped to a particular URI (Uniform Resource Identifier) which is used to define a
unique name for the namespace.
 It helps to avoid element name conflict.
Purposes

 To distinguish between elements and attributes from different vocabularies with different
meanings and that happen to share the same name.
 To group all the related elements and attributes from different from a single XML
application together so that software can easily recognize them.
Two types

 Prefixed Namespace
  xmlns:prefix_name=“URI”

 Default Namespace
  xmlns=“URI”
Problem in prefix

 There is a drawback to the prefix approach of the namespaces in xml document. The
reason for prefixing an element in an xml document is to prevent it from being duplicated.
However, if the prefixes are not unique, the original problem of duplication would still
exist.
 To solve this problem, each namespace prefix is added to a uniform resource identifier or
URI that uniquely identifies the namespace.
 URI is a series of characters used to differentiate names . To guarantee name uniqueness
in any xml documents that the company creates, the documents are associated with their
namespace.
xmlns attrribute

 The Xml namespace attribute is placed in the start tag of an element.


 xmlns: The xmlns attribute is what notifies an xml processor that a namespace is declared.
Xmlns stands for xml namespace.
 URI: A uri is a string of characters which identifies an internet resource.
 Uniform resource name(URN) and a uniform resource locator(URL). URLs contain the
reference for the document or an HTML page on the web. URIs are also case sensitive.

You might also like