devxlogo

Validate an XML Document Only When a DTD Exists

Validate an XML Document Only When a DTD Exists

Learn how to use the DOMImplementationDS and DOMConfiguration classes to validate an XML document only when a DTD document can be found:

DOMImplementationLS DOMiLS=null;?  //get a LSParser object  LSParser LSP=DOMiLS.createLSParser(                DOMImplementationLS.MODE_SYNCHRONOUS,                                                    "http://www.w3.org/TR/REC-xml");        //get a DOMConfiguration object  DOMConfiguration DOMc=LSP.getDomConfig();  //use validate-if-schema option  if(DOMc.canSetParameter("validate-if-schema",true))     DOMc.setParameter("validate-if-schema",true);        else System.out.println("Error...");?
See also  The Art of AI-Generated Meeting Minutes
devxblackblue

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