Code example for Document

Methods: appendChild, createElement

0
    public Document represent() {
        final XmlUtilService xmlUtils = getService(XmlUtilService.class);
 
        document = xmlUtils.createEmptyDocument();
 
        final Element root = document.createElement(TEST_ROOT);
        document.appendChild(root);
         
        appendTestElementTo(root);
        appendTestElementTo(root);
        appendTestElementTo(root);
 
        return xmlUtils.createResult(document);
    } 
 
    private void appendTestElementTo(Element root) {
        final Element element = document.createElement(TEST_ELEMENT);
        root.appendChild(element);
    } 
}