Java tutorial
//package com.java2s; import java.io.IOException; import javax.xml.transform.dom.DOMSource; import javax.xml.validation.Schema; import org.w3c.dom.Document; import org.xml.sax.SAXException; public class Main { public static void validate(Schema schema, Document document) throws SAXException, IOException { schema.newValidator().validate(new DOMSource(document)); } }