|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Validate XMLagainst schema
I'm pretty new to XML. Pardon me if the question is naive. I need the reply
pretty urgent.
I'm trying to validate a XML file against XML schema using a java
program.I've xerces 2.6(xercesImpl,xalan et.al). It seems to parse and
gives out errors like "tag not closed" and stuff like that. But it doesn't
validate against the schema file(namely tableSchema.xsd). Can anyone help
me?
My java code:
String schemaSource="tableSchema.xsd";
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
factory.setFeature
("http://apache.org/xml/features/validation/schema", true);
SAXParser saxParser = factory.newSAXParser();
XMLReader xmlReader = saxParser.getXMLReader();
xmlReader.setProperty
("http://apache.org/xml/properties/schema/external-schemaLocation",
"http://localhost:8080/ParkSeed/"
+schemaSource);
xmlReader.setErrorHandler(new DefaultHandler());
xmlReader.parse("database.xml");
Thanks,
Madhan Lakshmanan(Maddy)
Park Seed Inc
864-941-4232
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








