[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Validate XMLagainst schema


how to validate a 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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.