November 2006
Intermediate to advanced
224 pages
3h 29m
English
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); DocumentBuilder builder = factory.newDocumentBuilder(); |
A Document Type Definition (DTD) file defines how a particular XML document type should be structured. For example, a DTD will specify which elements, attributes, and so on are permitted in a document. An XML document that conforms to a DTD is considered to be valid. An XML document that is syntactically correct, but does not conform to a DTD, is said to be well-formed.
To validate a document using a DTD, we simply need to call the setValidating() method of the DocumentBuilderFactory instance and pass a value of true. Any XML documents that we parse will ...
Read now
Unlock full access