468,107 Members | 1,315 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,107 developers. It's quick & easy.

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

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
1 5900
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.

Similar topics

1 post views Thread by Stefan Siegl | last post: by
reply views Thread by jacksuyu | last post: by
reply views Thread by kolja2003 | last post: by
3 posts views Thread by Lord0 | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.