Search This Blog

Monday, June 04, 2012

How to Check whether the Schema is Valid or not in a Java Program

 

import java.io.File;
import javax.xml.XMLConstants;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
public class Test {
  public static void main(String[] args) throws Exception{
      SchemaFactory sf =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    Schema schema =    sf.newSchema(new
File("D:\\temp\\xx1\\InstalledBase.xsd"));
  }
}