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 Certification (SCDJWS/OCEJWSD) and the fly likes Validating XML document if URI is invalid Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Validating XML document if URI is invalid" Watch "Validating XML document if URI is invalid" New topic
Author

Validating XML document if URI is invalid

tanu dua
Ranch Hand

Joined: Apr 05, 2004
Posts: 145
In J2EE Web Services book , I have just read that URI may or may not point to an actual document or resource . If it could not point to the actual document or resource then how XML document be validated ?

If I have used URL as URI and my internet is down , how it will be able to access the schema and validate XML document.

Thanks,
Tanu
Shiva.Om Kumar
Ranch Hand

Joined: Jun 14, 2010
Posts: 68
tanu dua wrote:In J2EE Web Services book , I have just read that URI may or may not point to an actual document or resource . If it could not point to the actual document or resource then how XML document be validated ?

If I have used URL as URI and my internet is down , how it will be able to access the schema and validate XML document.

Thanks,
Tanu


If runtime resource is not available then, you will get the Exception.
To avoid above:-
If I want to validate generated XML document, first of all I would have access to schema then only I would be able to program to generate XML document, so schema can be used locally.


P.S. I am just beginner.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
The URI that makes up a namespace does not have to point to an actual document or resource (as said before).
However, in an XML document you can use the schemaLocation attribute to specify a number of mappings between an URI and the location of the corresponding resource (XML schema).
Example:

In the above example, the URI http://www.ivan.com/schemas is mapped to the personSchema.xsd, which is a file containing the XML schema of the XML document above.

If you want to modify the schema locations used by, for instance, a web service, without touching the WSDL documents and XML schemas then you can use the OASIS XML Catalog, provided that it is supported by the web service stack etc.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Validating XML document if URI is invalid