Source xml File = new Stream Source(new File("web.xml")); Schema Factory schema Factory = Schema Factory Instance(XMLConstants. URL schema File = new URL(" // webapp example xsd: // URL schema File = new URL(" // local file example: // File schema File = new File("/location/to/localfile.xsd"); // etc.
As for DTD validation to find little on the Internet, I would like to explain briefly how this is possible by simply using Java resources. An external component has delivered a XHTML file, which should have been “xhtml1-strict” according to the W3C schema definition.
But unfortunately, this file was incorrectly because no schema validation check took place during/after the generation.
The DOM interface in Java is well documented and managed by the World-Wide Web Consortium (W3C).
The SAX interface is modular, and in SAX 2 includes several classes specifically designed for tracking SAX events.
It can also be invoked implicitly as part of the XML parsing process when running the various Java-based XSLT engines, such as Saxon and Xalan-J.