Validating xml using sax parser

You should not use the DOMParser to validate a document (unless your goal is to create a document object model anyway).

W3C_XML_SCHEMA_NS_URI); try catch (SAXException e) catch (IOException e) but you could just as easily validate against a local file.

Or you can set your own via set Resource Resolver, ex: Source xml File = new Stream Source(xml File Location); Schema Factory schema Factory = Schema Factory Instance(XMLConstants.

W3C_XML_SCHEMA_NS_URI); Schema schema = schema Schema(); Validator validator = Validator(); Resource Resolver(new LSResource Resolver() ); validator.validate(xml File); // parse an XML document into a DOM tree Document Builder parser = Document Builder Instance()Document Builder(); Document document = parser.parse(new File("instance.xml")); // create a Schema Factory capable of understanding WXS schemas Schema Factory factory = Schema Instance(XMLConstants.

is probably a network location, so it'll go out and hit the network with each and every validation, not always optimal.