Example usage for org.dom4j.dom DOMDocumentType setElementName

List of usage examples for org.dom4j.dom DOMDocumentType setElementName

Introduction

In this page you can find the example usage for org.dom4j.dom DOMDocumentType setElementName.

Prototype

public void setElementName(String elementName) 

Source Link

Usage

From source file:org.opencms.configuration.CmsConfigurationManager.java

License:Open Source License

/**
 * Creates the XML document build from the provided configuration.<p>
 * /*from   w w  w.  j  ava  2s. c o m*/
 * @param configuration the configuration to build the XML for
 * @return the XML document build from the provided configuration
 */
public Document generateXml(I_CmsXmlConfiguration configuration) {

    // create a new document
    Document result = DocumentHelper.createDocument();

    // set the document type        
    DOMDocumentType docType = new DOMDocumentType();
    docType.setElementName(N_ROOT);
    docType.setSystemID(configuration.getDtdUrlPrefix() + configuration.getDtdFilename());
    result.setDocType(docType);

    Element root = result.addElement(N_ROOT);
    // start the XML generation
    configuration.generateXml(root);

    // return the resulting document
    return result;
}