Example usage for org.jdom2.output XMLOutputter outputString

List of usage examples for org.jdom2.output XMLOutputter outputString

Introduction

In this page you can find the example usage for org.jdom2.output XMLOutputter outputString.

Prototype

public final String outputString(EntityRef entity) 

Source Link

Document

Return a string representing an EntityRef .

Usage

From source file:cz.cesnet.shongo.connector.device.AdobeConnectConnector.java

@Override
public String exportRoomSettings(String roomId) throws CommandException {
    Element scoInfo = getScoInfo(roomId);
    Document document = scoInfo.getDocument();
    XMLOutputter xmlOutput = new XMLOutputter(Format.getPrettyFormat());
    return xmlOutput.outputString(document);
}

From source file:cz.cesnet.shongo.connector.device.AdobeConnectConnector.java

@Override
public void importRoomSettings(String roomId, String settings) throws CommandException {
    SAXBuilder saxBuilder = new SAXBuilder();
    Document document;/*from w  ww . j  a  v a2  s. c  o m*/
    try {
        document = saxBuilder.build(new StringReader(settings));
    } catch (Exception exception) {
        throw new CommandException(exception.getMessage(), exception);
    }

    XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
    String xmlString = outputter.outputString(document);

    RequestAttributeList attributes = new RequestAttributeList();

    attributes.add("sco-id", roomId);
    //        attributes.add("date-begin", document.getRootElement().getChild("sco").getChild("date-begin").getText());
    //        attributes.add("date-end", document.getRootElement().getChild("sco").getChild("date-end").getText());
    if (document.getRootElement().getChild("sco").getChild("description") != null) {
        attributes.add("description",
                document.getRootElement().getChild("sco").getChild("description").getText());
    }
    attributes.add("url-path", document.getRootElement().getChild("sco").getChild("url-path").getText());
    attributes.add("name", document.getRootElement().getChild("sco").getChild("name").getText());

    execApi("sco-update", attributes);
}

From source file:ddf.catalog.source.opensearch.impl.OpenSearchSource.java

License:Open Source License

private List<Metacard> processAdditionalForeignMarkups(Element element, String id) {
    List<Metacard> metacards = new ArrayList<>();
    if (CollectionUtils.isNotEmpty(markUpSet) && markUpSet.contains(element.getName())) {
        XMLOutputter xmlOutputter = new XMLOutputter();
        Metacard metacard = parseContent(xmlOutputter.outputString(element), id);
        metacards.add(metacard);/*from w w  w  .ja  v a  2  s.c  o m*/
    }
    return metacards;
}

From source file:de.bund.bfr.knime.pmm.common.PmmXmlDoc.java

License:Open Source License

public String toXmlString() {
    Document doc = toXmlDocument();
    XMLOutputter xmlo = new XMLOutputter();
    return xmlo.outputString(doc);
}

From source file:de.danielluedecke.zettelkasten.util.Tools.java

License:Open Source License

/**
 * This method returns the XML database as string. just for testing purposes.
 * @param dataObj/*w  w  w. ja v a  2  s  . com*/
 * @return
 */
public static String retrieveXMLFileAsString(Daten dataObj) {
    // create a new XML-outputter with the pretty output format,
    // so the xml-file looks nicer
    XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());
    // return XML data base as string
    return out.outputString(dataObj.getZknData());
}

From source file:de.hbrs.oryx.yawl.util.YAWLUtils.java

License:Open Source License

static public String elementToString(final List<Element> list) {
    XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());
    return out.outputString(list);
}

From source file:de.smartics.maven.plugin.jboss.modules.parser.ModulesDescriptorBuilder.java

License:Apache License

private void parseApply(final Builder builder, final Element dependenciesElement) {
    final Element applyElement = dependenciesElement.getChild("apply", NS);
    if (applyElement == null) {
        return;/*w  w w. java 2s .  co m*/
    }

    final String slot = applyElement.getChildText("slot", NS);
    final String skip = applyElement.getChildText("skip", NS);
    final String export = applyElement.getChildText("export", NS);
    final String services = applyElement.getChildText("services", NS);
    final String optional = applyElement.getChildText("optional", NS);

    builder.withSlot(slot);
    builder.withSkip(skip);
    builder.withExport(export);
    builder.withServices(services);
    builder.withOptional(optional);

    final XMLOutputter outputter = new XMLOutputter(Format.getCompactFormat());
    final Element importElement = applyElement.getChild("imports", NS);
    if (importElement != null) {
        adjustNamespaces(importElement);
        final String imports = outputter.outputString(importElement);
        builder.withImportsXml(imports);
    }
    final Element exportElement = applyElement.getChild("exports", NS);
    if (exportElement != null) {
        adjustNamespaces(exportElement);
        final String exports = outputter.outputString(exportElement);
        builder.withExportsXml(exports);
    }
}

From source file:de.smartics.maven.plugin.jboss.modules.parser.ModulesDescriptorBuilder.java

License:Apache License

private void handleChild(final ApplyToModule.Builder mBuilder, final XMLOutputter outputter,
        final Element child) {
    final String elementName = child.getName();
    if ("dependencies".equals(elementName)) {
        handleDependencies(mBuilder, outputter, child);
    } else if ("properties".equals(elementName)) {
        for (final Element propertyElement : child.getChildren("property", ModuleXmlBuilder.NS)) {
            final String name = propertyElement.getAttributeValue("name");
            final String fragment = outputter.outputString(propertyElement);
            mBuilder.addPropertyXml(name, fragment);
        }// w ww.j  av a  2s. co m
    } else if ("exports".equals(elementName)) {
        final String fragment = outputter.outputString(child);
        mBuilder.withExportsXml(fragment);
    } else if ("main-class".equals(elementName)) {
        final String fragment = outputter.outputString(child);
        mBuilder.withMainClassXml(fragment);
    } else if ("resource-root".equals(elementName)) {
        final String fragment = outputter.outputString(child);
        mBuilder.addResourceRootXml(fragment);
    } else {
        // TODO warn or add to end?
    }
}

From source file:de.smartics.maven.plugin.jboss.modules.parser.ModulesDescriptorBuilder.java

License:Apache License

private void handleDependencies(final ApplyToModule.Builder mBuilder, final XMLOutputter outputter,
        final Element child) {
    int nonModuleCounter = 0;

    for (final Element childElement : child.getChildren()) {
        final String childElementName = childElement.getName();
        final String name;
        if ("module".equals(childElementName)) {
            name = childElement.getAttributeValue("name");
        } else {/*www  .  j  av a  2s  .  c om*/
            // i.e. system, maybe others.
            nonModuleCounter++;
            name = "non-module@" + nonModuleCounter;
        }
        final String fragment = outputter.outputString(childElement);
        mBuilder.addDependencyXml(name, fragment);
    }
}

From source file:de.smartics.maven.plugin.jboss.modules.parser.ModulesDescriptorBuilderV2.java

License:Apache License

private void parseApply(final Builder builder, final Element dependenciesElement) {
    if (dependenciesElement == null) {
        return;/*from  w  w  w. j a v a 2s .c  om*/
    }

    final String slot = dependenciesElement.getAttributeValue("slot");
    final String skip = dependenciesElement.getAttributeValue("skip");
    final String export = dependenciesElement.getAttributeValue("export");
    final String services = dependenciesElement.getAttributeValue("services");
    final String optional = dependenciesElement.getAttributeValue("optional");

    builder.withSlot(slot);
    builder.withSkip(skip);
    builder.withExport(export);
    builder.withServices(services);
    builder.withOptional(optional);

    final XMLOutputter outputter = new XMLOutputter(Format.getCompactFormat());
    final Element importElement = dependenciesElement.getChild("imports", NS);
    if (importElement != null) {
        adjustNamespaces(importElement);
        final String imports = outputter.outputString(importElement);
        builder.withImportsXml(imports);
    }
    final Element exportElement = dependenciesElement.getChild("exports", NS);
    if (exportElement != null) {
        adjustNamespaces(exportElement);
        final String exports = outputter.outputString(exportElement);
        builder.withExportsXml(exports);
    }
}