View Single Post
  #1 (permalink)  
Old 07-19-2007, 03:47 PM
oregon oregon is offline
Member
 
Join Date: Jul 2007
Posts: 41
oregon is on a distinguished road
how to validate a xml file with schemas via SAX
I want to validate XML documents with schemas via SAX
I have problems when asigning an *.xsd file to *.xml document

My code:
Code:
<p:user xmlns:p="http://www.google.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wsf.net user.xsd">
It works in my computer but don't in others.
The SAX parser fails to recognize that user.xsd is located in the same folder as XMl document.

So I decided to assign the schema document programmatically:

Code:
static final String = JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; theParser.setProperty(JAXP_SCHEMA_SOURCE, new File(...some *.xsd file full path));
But this has thrown NotRecognizedException.

any ideas?
thanks
Reply With Quote
Sponsored Links