Constructing DOM (Document Object Model) to generate or represent XML is easy. The basic steps are as follows
> Create the XML Document object using the Document Builder Factory.
>Build your model by adding nodes and attributes etc. in the hierarchical order
> Once done, transform your XML Document to XML String representation by using an Transformer .