import javax.xml.validation.*; import javax.xml.XMLConstants; import javax.xml.transform.dom.DOMSource; import javax.xml.parsers.*; import org.w3c.dom.*; import java.io.*; public class SkeemiKontroll{ public static void main(String[] argumendid) throws Exception{ if(argumendid.length!=2){ System.out.println("Kasuta kujul: java SkeemiKontroll skeem.xsd andmefail.xml"); System.exit(0); } Validator validaator=SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI). newSchema(new File(argumendid[0])).newValidator(); Document dokument=DocumentBuilderFactory.newInstance().newDocumentBuilder(). parse(new File(argumendid[1])); validaator.validate(new DOMSource(dokument)); } }