File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Clarifying about namespace URI and validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Clarifying about namespace URI and validation" Watch "Clarifying about namespace URI and validation" New topic
Author

Clarifying about namespace URI and validation

Rajeev Trikha
Ranch Hand

Joined: Jan 29, 2010
Posts: 85
"It's important to remember that the URI used for the XML namespace should be unique to that markup language, but it doesn't have to point to an actual resource or document." states RM. I understand the comment and get the idea that the namespace-engendered uniqueness will ensure that there are no collisions in names so the prefix is more important than the actual presence. But am I right in saying that if we are validating a document then the schemaLocation URI has to point to an actual schema but the URI for the other standard namespaces still do not have to physically point to anything because the document is only validated against the schema defined in the schemaLocation and the rest of the namespaces are just there to confer uniqueness. Please clarify.


Rajeev Trikha (SCJP 6)
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Yes, I think you understood it correctly.
The namespace name is just a string (URI) that may happen to look like an URL. Some examples:


The XML schema specification says that the second URI in the schemaLocation attribute value is only a hint on where the schema document for the namespace in question may be found. Reference: http://www.w3.org/TR/xmlschema-0/#schemaLocation
Best wishes!
Rajeev Trikha
Ranch Hand

Joined: Jan 29, 2010
Posts: 85
Thanks Ivan for the clarification and your study notes. I am currently going through your study notes and they seem to be a fairly comprehensive resource.

For validation, the parser has to know the actual details of the schema, so "the schemaLocation attribute value is only a hint on where the schema document for the namespace in question may be found" presumably just means that either use the given location or if you have already obtained the schema details and put them in your cache then use that for efficiency.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clarifying about namespace URI and validation