// Convert the Node elements to an XML DOM representation
Document tempDocument = new DocumentImpl();
Element tempRootElement = tempDocument.createElement("GISToolkit"); // Create Root Element
addNode(tempDocument, tempRootElement, tempRootNode);
tempDocument.appendChild(tempRootElement);
// write the XML Document
File tempFile = new File(inFileName);
OutputFormat format = new OutputFormat( tempDocument ); //Serialize DOM
format.setIndenting(true);