answersLogoWhite

0

AllQ&AStudy Guides
Best answer

The namespace in XML is used to prevent tag naming collisions.

Because XML is a meta-language that allows you to define your own elements and attributes, there is significant concern that both you and I might define an element with the same name. For instance, let's imagine that you've created a DTD (Document Type Definition -- the definition file of an XML language) which allows you to define where people sit in a banquet hall. Further, let's pretend I'm hosing a Poker Tournament at your banquet hall.

In both DTDs, we have an element called "table." But they mean different things. If we tried to use both DTDs together, a hot mess would ensue. You're data type wouldn't validate against my DTD, and vice versa.

So we use namespaces. In XML, we use a namespace by adding the xmlns attribute (that's XML Namespace.) The attribute takes a unique URL as it's value. It's important to note that this value is simply for uniqueness (in other words, it doesn't have to exist. The XML parser will not go looking for it.)

I can now attach my namespace directly to my table elements:

<table xmlns:p = "http://www.example.com/pokerTable">

...

</table>

Further, I define a "prefix" which in this case is p. Now, I can use the prefix when I add a tag. For instance

<p:seat>Data</seat>

You would use a separate prefix and xlmns value, and this would keep us from stepping on each other's toes.

This answer is:
Related answers

The namespace in XML is used to prevent tag naming collisions.

Because XML is a meta-language that allows you to define your own elements and attributes, there is significant concern that both you and I might define an element with the same name. For instance, let's imagine that you've created a DTD (Document Type Definition -- the definition file of an XML language) which allows you to define where people sit in a banquet hall. Further, let's pretend I'm hosing a Poker Tournament at your banquet hall.

In both DTDs, we have an element called "table." But they mean different things. If we tried to use both DTDs together, a hot mess would ensue. You're data type wouldn't validate against my DTD, and vice versa.

So we use namespaces. In XML, we use a namespace by adding the xmlns attribute (that's XML Namespace.) The attribute takes a unique URL as it's value. It's important to note that this value is simply for uniqueness (in other words, it doesn't have to exist. The XML parser will not go looking for it.)

I can now attach my namespace directly to my table elements:

<table xmlns:p = "http://www.example.com/pokerTable">

...

</table>

Further, I define a "prefix" which in this case is p. Now, I can use the prefix when I add a tag. For instance

<p:seat>Data</seat>

You would use a separate prefix and xlmns value, and this would keep us from stepping on each other's toes.

View page

That depends on what you want to do, xml tools include;

xml parsers

xml validators

xml editors

xml schema editors

xml code generators

View page

what are the component of xml document what are the component of xml document

View page

They are(simply put) the things that you import....

EXAMPLE:

VB

Import (namespace)

C#

Using (namespace)

View page

there is no source code, xml is not a programming language, its a markup language for which you create your own tags, the basic xml syntax is <xml> to start an xml file, and </xml> to end the xml file.

View page
Featured study guide
📓
See all Study Guides
✍️
Create a Study Guide
Search results