OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Validate XMLagainst schema

[ Lists Home | Date Index | Thread Index ]

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






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS