![]() |
|
| • All Online Courses • New Courses • QuickTips • Word Definitions • Submit a Tutorial • Links • |
|
Learn XML programming in this free XML training course Section 4: Working With XMLWhat are XML namespaces, and how are they used?XML namespaces are useful little pieces of programming that are used to make your elements unique among the entire world of XML pages. They allow you to specify a URI, or Uniform Resource Identifier, such as an internet address, and define your elements in such a way that the browser will be able to see that your elements are unique from those that your friend Bob is using on his page about his cats, Tudor and Shady. To create a namespace, you have to define it. This is done using the following format: <namespace:element xmlns:namespace=”unique_URI”> </ namespace:element> You also need to apply the namespace to any attributes or elements contained within the particular element that you’re naming. An example of a namespace in a file would be as follows: <my_cats:cats_info xmlns:my_cats=http://www.mycatwebsite.org/cats> <my_cats:cats>Tooter and Shade are the best cats in the world!</ my_cats:cats> <my_cats:friends>Loki and Sally are pretty cool cats as well, though.</ my_cats:friends> </ my_cats:cats_info> When a browser runs across this code, you can be sure that it’s not going to mistake anything inside of <cats_info> for information defined on any other site. The namespace makes sure that it’s unique across the entire Internet by linking it to your URL (though the URI that you use doesn’t have to be the site’s URL.)
by John Casteele Find more free Internet tutorials from Learnthat.com. More Information:
Help us by rating this tutorial: [---] [--] [+] [++] [+++] [---] lowest; [+++] highest
|
|
||||||
![]() |
Learn: Free
Tutorials - Links
to Free Tutorials
Understand: Free Technical Definitions
- ExplainThat Whitepapers
Use: Certification Section -
Discussion Forum
Visit Our Network Sites:
About Us : Contact Us : Advertise : Privacy Information