Example usage for org.dom4j.io XMLWriter startDTD

List of usage examples for org.dom4j.io XMLWriter startDTD

Introduction

In this page you can find the example usage for org.dom4j.io XMLWriter startDTD.

Prototype

public void startDTD(String name, String publicID, String systemID) throws SAXException 

Source Link

Usage

From source file:org.safehaus.penrose.config.PenroseConfigWriter.java

License:Open Source License

public void write(File file, PenroseConfig penroseConfig) throws Exception {

    Element element = createElement(penroseConfig);

    file.getParentFile().mkdirs();/*www .j ava 2  s. c o m*/
    Writer writer = new FileWriter(file);

    OutputFormat format = OutputFormat.createPrettyPrint();
    format.setTrimText(false);

    XMLWriter xmlWriter = new XMLWriter(writer, format);
    xmlWriter.startDocument();

    xmlWriter.startDTD("server", "-//Penrose/DTD Server " + Penrose.SPECIFICATION_VERSION + "//EN",
            "http://penrose.safehaus.org/dtd/server.dtd");

    xmlWriter.write(element);
    xmlWriter.close();

    writer.close();
}

From source file:org.safehaus.penrose.federation.FederationWriter.java

License:Open Source License

public void write(File file, FederationConfig federationConfig) throws Exception {

    log.debug("Writing " + file + ".");

    Element element = createElement(federationConfig);

    FileWriter fw = new FileWriter(file);
    OutputFormat format = OutputFormat.createPrettyPrint();
    format.setTrimText(false);/*  w  w w .  jav  a  2s .c  o  m*/

    XMLWriter writer = new XMLWriter(fw, format);
    writer.startDocument();

    writer.startDTD("federation",
            "-//Penrose/DTD Federation " + getClass().getPackage().getSpecificationVersion() + "//EN",
            "http://penrose.safehaus.org/dtd/federation.dtd");

    writer.write(element);
    writer.close();
}

From source file:org.safehaus.penrose.log.log4j.Log4jConfigWriter.java

License:Open Source License

public void write(File file, Log4jConfig config) throws Exception {

    Element element = createConfigElement(config);

    Writer out;/*from   www  .  j  a  v a2  s  .  c  o  m*/
    if (file == null) {
        out = new PrintWriter(System.out, true);
    } else {
        file.getParentFile().mkdirs();
        out = new FileWriter(file);
    }

    OutputFormat format = OutputFormat.createPrettyPrint();
    format.setTrimText(false);

    XMLWriter writer = new XMLWriter(out, format);
    writer.startDocument();

    writer.startDTD("log4j:configuration", "-//Apache//DTD Log4j 1.2//EN",
            "http://logging.apache.org/log4j/docs/api/org/apache/log4j/xml/log4j.dtd");

    writer.write(element);
    writer.close();

    out.close();
}

From source file:org.safehaus.penrose.partition.PartitionWriter.java

License:Open Source License

public void writePartitionXml(File directory, PartitionConfig partitionConfig) throws Exception {
    File file = new File(directory, "partition.xml");

    log.debug("Writing " + file + ".");

    Element element = createElement(partitionConfig);

    FileWriter fw = new FileWriter(file);
    OutputFormat format = OutputFormat.createPrettyPrint();
    format.setTrimText(false);//from   ww w . j  ava  2 s  . c o m

    XMLWriter writer = new XMLWriter(fw, format);
    writer.startDocument();

    writer.startDTD("partition",
            "-//Penrose/DTD Partition " + getClass().getPackage().getSpecificationVersion() + "//EN",
            "http://penrose.safehaus.org/dtd/partition.dtd");

    writer.write(element);
    writer.close();
}