The following figure shows the general procedure for creating a sample program that uses the DOM parser.
Figure 5-2 General procedure for creating a sample program that uses the DOM parser
![[Figure]](figure/zu050200.gif)
- Create a Document object.
Create a new Document object.
- Create the Document node.
By using the Document object you created in step 1, create the Document node that is the parent of the DOM tree.
- Create the Element nodes.
Create the necessary Element nodes from the Document node to create the DOM tree.
- Create the Text nodes.
Create the character strings that are the contents of the elements.