import junit.framework.TestCase;
public class ValidatorTest extends TestCase {
public void test() throws Exception {
SchemaFactory factory = new XMLSchemaFactory();
DocumentBuilderFactory dbf = new DOOMDocumentBuilderFactory();
DocumentBuilder builder = dbf.newDocumentBuilder();
Schema schema = factory.newSchema(new DOMSource(
builder.parse(ValidatorTest.class.getResourceAsStream("ipo.xsd"))));
Validator validator = schema.newValidator();
validator.validate(new DOMSource(
builder.parse(ValidatorTest.class.getResourceAsStream("ipo_1.xml"))));
}