Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Namespaces in XML

 
Sandeep Jindal
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I am very much confused bout the namescpaes. I know that(from some examples) namespace in XML is just to make the tags differee for same or diff xml files(am i right). If this is the case then why one have to write xsd as namespace for every element of XSD? I mean what is the need of that when the namespace five from namespace prefix "xsd", is alwayts the standard one(some org.xml url)?
Please explain it breifly.
Thnaks and regrds
Sandeep Jindal
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact, you don't need to add the prefix "xsd" for all XSD elements if you define the schema namespace as the default namespace (<schema xmlns="http://www.w3.org/2001/XMLSchema">). Of course then you would have to prefix all non-XSD elements with some namespace so that the parser won't try to find a "customer" element from the standard XSD schema and complain when it doesn't find such an element...
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps this will also help you, read for sure.
http://www.rpbourret.com/xml/NamespacesFAQ.htm
 
Sandeep Jindal
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Balaji,
Your document really helped me. This document is very detialed though too long. I have read bout half the document and will read the rest soon.
Sir, can u please tell me the link whether i can find other general frequenly asked XML interview questions, or java questions.
Thanks and regards
Sandeep Jindal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic