Main Page

Previous Next


In this chapter we have discussed how we can use a DOM parser to analyze XML and how JAXP supports the synthesis and modification of XML documents using DOM. The key points we have covered include the following:

  • An object of type DocumentBuilder encapsulates a DOM parser.

  • You create an object encapsulating a DOM parser by using a DocumentBuilderFactory object that you obtain by calling the static newInstance() method that is defined in the DocumentFactoryBuilder class.

  • You can parse an XML document by passing the document as an argument to the parse() method for a DocumentBuilder object.

  • A DOM parser creates a Document object that encapsulates an entire XML document as a tree of Node objects.

  • The DOM API defines the methods that a Document object has that enable you to analyze an XML document by navigating through the nodes in the Document object.

  • The DOM API also defines methods for creating a new XML document encapsulated by a Document object.

  • When you want to create a new XML document that includes a DTD you should use the createDocument() method for a DOMImplementation object rather than the newDocument() method for a DocumentBuilder object.

Previous Next
JavaScript Editor Java Tutorials Free JavaScript Editor