By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,737 Members | 1,989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,737 IT Pros & Developers. It's quick & easy.

Xerces - How to perfrom schema validations without using "xsi:schemaLocation"

P: n/a
Hi

I'm using SAX Parser of Xerces Java v2.4.0 for XML Parsing.
I want to perform schema validations on the xml.

The problem is that root element of XML document does not have
"xsi:schemaLocation" attribute, which is used to specify the .xsd
file.

Is there any other way for specifying the name of .xsd file?

thanks,
Naresh
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I think you can provide a hint to the parser to the location of the schema file.

You should be able to do something like.

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(true);
dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLocation",
"http://www.example.com/Report.xsd");

Actually i picked the above from this site here.
http://java.sun.com/xml/jaxp/change-requests-12.html

You might want to read through it and see if it would work for you.

Hope that helps.

Dhayanithi.

na******@informatica.com (Naresh Agarwal) wrote in message news:<2b**************************@posting.google. com>...
Hi

I'm using SAX Parser of Xerces Java v2.4.0 for XML Parsing.
I want to perform schema validations on the xml.

The problem is that root element of XML document does not have
"xsi:schemaLocation" attribute, which is used to specify the .xsd
file.

Is there any other way for specifying the name of .xsd file?

thanks,
Naresh

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.