This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Namespaces in XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Namespaces in XML" Watch "Namespaces in XML" New topic
Author

Namespaces in XML

Sandeep Jindal
Ranch Hand

Joined: Aug 25, 2003
Posts: 180
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


SCJP 5.0
http://sites.google.com/site/duddlutechnologies/home
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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...


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Perhaps this will also help you, read for sure.
http://www.rpbourret.com/xml/NamespacesFAQ.htm


Spritle Software Blogs
Sandeep Jindal
Ranch Hand

Joined: Aug 25, 2003
Posts: 180
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Namespaces in XML
 
Similar Threads
JAXB: Two xsd - Create single JAXBContext
Xerces problem with SchemaLocation attribute.
Compare exams objectives of SCDJWS 1.5 to SCDJWS 1.4
How is XSD validation done ?
"force" a namespace?