Results 1 to 4 of 4
- 07-19-2007, 01:47 PM #1
Member
- Join Date
- Jul 2007
- Posts
- 41
- Rep Power
- 0
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:
It works in my computer but don't in others.Java 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">
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:
But this has thrown NotRecognizedException.Java 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));
any ideas?
thanks
- 07-30-2007, 11:52 PM #2
Senior Member
- Join Date
- Jul 2007
- Posts
- 135
- Rep Power
- 0
I don't think that the standard SAX parser can validate a file against a schema. They can using DTD's but, I do not think against schemas. You can use the MSV project to validate your documents though. I use it a lot in unit tests for XML validation.
- 08-01-2007, 04:54 PM #3
Member
- Join Date
- Jul 2007
- Posts
- 41
- Rep Power
- 0
why does sax can't validate a file?
anyway I will try to use MSV project
thanks
- 08-01-2007, 05:15 PM #4
Senior Member
- Join Date
- Jul 2007
- Posts
- 135
- Rep Power
- 0
Similar Threads
-
How to validate date using SampleDateFormat
By Java Tip in forum java.textReplies: 0Last Post: 04-04-2008, 02:38 PM -
repaint validate doLayout
By Gajesh Tripathi in forum AWT / SwingReplies: 1Last Post: 10-27-2007, 06:53 PM -
How to validate date using SampleDateFormat
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 09:31 PM -
validate hex character
By paul in forum New To JavaReplies: 1Last Post: 07-25-2007, 09:08 PM -
AxisFault faultCode:{http://schemas.xmlsoap.org/soap/envelope/
By Jack in forum Advanced JavaReplies: 2Last Post: 07-02-2007, 05:07 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks