Using XMLSchema DOM and SAX in JAXP 1.2

Using XMLSchema DOM and SAX in JAXP 1.2

To take advantage of the power of XMLSchema in a SAX or DOM application, you simply have to set two properties. In JAXP 1.3, use the javax.xml.validation package.

The two properties are:

In a “SAX application”:

...SAXParserFactory SAXpf=SAXParserFactory.newInstance();...                      SAXpf.setNamespaceAware(true); SAXpf.setValidating(true); ...SAXParser SAXparser=SAXpf.newSAXParser();                      ...try{                         SAXparser.setProperty ("",      "");}catch (SAXNotRecognizedException e) {   System.out.println("ERROR:"+e.getMessage());}SAXparser.setProperty( "",   new File("C://Data_Local//XML//XMLSchema//AutoDealer.xsd"));

– in a “DOM application”:

...DBF=DocumentBuilderFactory.newInstance();...       DBF.setNamespaceAware(true);DBF.setValidating(true);...try{                         DBF.setAttribute( "",      "");}catch (SAXNotRecognizedException e) {   System.out.println("ERROR:"+e.getMessage());}DBF.setAttribute( "",    "C://Data_Local//XML//XMLSchema//AutoDealer.xsd");
See also  11 Effective Keyword Research Tools and Techniques

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist