C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » XML »

Purpose of XML Namespaces


Posted Date: 21 Apr 2009    Resource Type: Articles    Category: XML
Author: Deepika HaridasMember Level: Diamond    
Rating: 1 out of 5Points: 9



An XML Namespace is collection of element types and attribute names. It consists of two parts :

1) The first part is the URI used to identify the namespace
2) The second part is the element type or attribute name itself.

Together they form a unique name.

The various purpose of XML Namespace are
1. Combine fragments from different documents without any naming conflicts.
2. Write reusable code modules that can be invoked for specific elements and attributes. Universally unique names guarantee that
such modules are invoked only for the correct elements and attributes.
3. Define elements and attributes that can be reused in other schemas or instance documents without fear of name collisions.

For
example, you might use XHTML elements in a parts catalog of shopping cart to provide part descriptions. Or you might use the nil attribute
defined in XML Schemas to indicate a missing value.


< Department >
< Name >XYZ< /Name >
< addr:Address xmlns:addr="[URL link here]" >
< addr:Street >Gold Street. 7< /addr:Street >
< addr:City >Ahmedabad< /addr:City >
< addr:State >gujarat< /addr:State >
< addr:Country >India< /addr:Country >
< addr:PostalCode >D-64285< /addr:PostalCode >
< /addr:Address >
< serv:Server xmlns:serv="[URL link here]" >
< serv:Name >OurWebServer< /serv:Name >
< serv:Address >123.45.67.8< /serv:Address >
< /serv:Server >
< /Department >



Responses

Author: greeny_1984    22 Apr 2009Member Level: Diamond   Points : 0
Hi,

Nice of piece of info on xml namespaces...

regards,

greeny


Author: Sra1    22 Apr 2009Member Level: Silver   Points : 2
Hi Deepika,

Thanks for sharing this article, one question from my side do the XML which gets generated from oracle will have the same approach.
I mean the first part is URI and the second part is attribute name.

Best Regards,
Sra1

Today is Earth Day join to celebrate


Author: Pradeep Iyer    22 Apr 2009Member Level: Diamond   Points : 1
Hi,

Good one..

Keep posting more articles..

Very informative indeed..

Regards,
Pradeep


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Xml  .  Purpose  .  Namespaces  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Use XSLT for Transformation of XML into HTML
Previous Resource: Show XML Content Using XSLT Using C#
Return to Discussion Resource Index
Post New Resource
Category: XML


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use