Example usage for org.dom4j DocumentFactory createDocument

List of usage examples for org.dom4j DocumentFactory createDocument

Introduction

In this page you can find the example usage for org.dom4j DocumentFactory createDocument.

Prototype

public Document createDocument() 

Source Link

Usage

From source file:org.orbeon.oxf.xml.dom4j.Dom4jUtils.java

License:Open Source License

public static Document createDocument() {
    final DocumentFactory factory = NonLazyUserDataDocumentFactory.getInstance();
    return factory.createDocument();
}

From source file:org.sipfoundry.sipxconfig.admin.commserver.imdb.DataSetGenerator.java

License:Contributor Agreement License

/**
 * This is for testing only.//  www . j  a  v a 2  s  . c o m
 *
 * @return XML representation of dataset
 */
@Deprecated
public Document generateXml() {
    List<Map<String, String>> items = generate();

    DocumentFactory factory = DocumentFactory.getInstance();
    Document document = factory.createDocument();
    Element itemsEl = document.addElement("items");
    itemsEl.addAttribute("type", getType().getName());

    for (Map<String, String> item : items) {
        Element itemEl = itemsEl.addElement("item");
        for (Map.Entry<String, String> entry : item.entrySet()) {
            itemEl.addElement(entry.getKey()).setText(entry.getValue());
        }
    }
    return document;
}

From source file:org.sipfoundry.sipxconfig.rest.ActiveGreetingResource.java

License:Contributor Agreement License

private Document getDom(String greeting) {
    DocumentFactory factory = DocumentFactory.getInstance();
    Document document = factory.createDocument();
    document.addElement("activegreeting").addText(greeting);

    return document;
}

From source file:org.sipfoundry.sipxconfig.rest.PhonebookResource.java

License:Contributor Agreement License

static Document getPhonebookXml(Collection<PhonebookEntry> entries) {
    DocumentFactory factory = DocumentFactory.getInstance();
    Document document = factory.createDocument();
    Element rootItem = document.addElement("phonebook");
    for (PhonebookEntry entry : entries) {
        Element entryEl = rootItem.addElement("entry");
        entryEl.addElement("first-name").setText(entry.getFirstName());
        entryEl.addElement("last-name").setText(entry.getLastName());
        entryEl.addElement("number").setText(entry.getNumber());
    }//from w w w.j  ava 2s . c  o m

    return document;
}

From source file:org.sipfoundry.sipxconfig.rest.PhonebooksResource.java

License:Contributor Agreement License

private Document getDom() {
    DocumentFactory factory = DocumentFactory.getInstance();
    Document document = factory.createDocument();
    Element rootItem = document.addElement("phonebooks");
    for (Phonebook phonebook : m_phonebookManager.getPhonebooks()) {
        Element phonebookEl = rootItem.addElement("phonebook");
        phonebookEl.addAttribute("name", phonebook.getName());
    }/* w ww .  j a v  a2  s . c om*/
    return document;
}