Example usage for org.jdom2 DocType DocType

List of usage examples for org.jdom2 DocType DocType

Introduction

In this page you can find the example usage for org.jdom2 DocType DocType.

Prototype

public DocType(String elementName, String publicID, String systemID) 

Source Link

Document

This will create the DocType with the specified element name and a reference to an external DTD.

Usage

From source file:com.rometools.rome.io.impl.RSS091NetscapeGenerator.java

License:Open Source License

@Override
protected Document createDocument(final Element root) {
    final Document doc = new Document(root);
    final DocType docType = new DocType(RSS091NetscapeParser.ELEMENT_NAME, RSS091NetscapeParser.PUBLIC_ID,
            RSS091NetscapeParser.SYSTEM_ID);
    doc.setDocType(docType);/*from w  w  w  .  j  av  a  2  s.  co m*/
    return doc;
}

From source file:com.sun.syndication.io.impl.RSS091NetscapeGenerator.java

License:Open Source License

protected Document createDocument(Element root) {
    Document doc = new Document(root);
    DocType docType = new DocType(RSS091NetscapeParser.ELEMENT_NAME, RSS091NetscapeParser.PUBLIC_ID,
            RSS091NetscapeParser.SYSTEM_ID);
    doc.setDocType(docType);//from   w  w  w  .j  a v a2s  .  c om
    return doc;
}

From source file:de.nava.informa.exporters.RSS_0_91_Exporter.java

License:Open Source License

public void write(ChannelIF channel) throws IOException {
    if (writer == null) {
        throw new RuntimeException("No writer has been initialized.");
    }//from w  w  w .j av a  2s .  c o  m

    // create XML outputter with indent: 2 spaces, print new lines.
    Format format = Format.getPrettyFormat();
    format.setEncoding(encoding);
    XMLOutputter outputter = new XMLOutputter(format);

    // ----
    Element rootElem = new Element("rss");
    rootElem.setAttribute("version", RSS_VERSION);
    Element channelElem = new Element("channel");

    channelElem.addContent(new Element("title").setText(channel.getTitle()));

    channelElem.addContent(new Element("description").setText(channel.getDescription()));
    if (channel.getSite() != null) {
        channelElem.addContent(new Element("link").setText(channel.getSite().toString()));
    }
    if (channel.getLanguage() != null) {
        channelElem.addContent(new Element("language").setText(channel.getLanguage()));
    }

    Collection items = channel.getItems();
    Iterator it = items.iterator();
    while (it.hasNext()) {
        channelElem.addContent(getItemElement((ItemIF) it.next()));
    }

    // export channel image
    if (channel.getImage() != null) {
        Element imgElem = new Element("image");
        imgElem.addContent(new Element("title").setText(channel.getImage().getTitle()));
        imgElem.addContent(new Element("url").setText(channel.getImage().getLocation().toString()));
        imgElem.addContent(new Element("link").setText(channel.getImage().getLink().toString()));
        imgElem.addContent(new Element("height").setText("" + channel.getImage().getHeight()));
        imgElem.addContent(new Element("width").setText("" + channel.getImage().getWidth()));
        imgElem.addContent(new Element("description").setText(channel.getImage().getDescription()));
        channelElem.addContent(imgElem);
    }

    // TODO: add exporting textinput field
    //     if (channel.getTextInput() != null) {
    //       channelElem.addContent(channel.getTextInput().getElement());
    //     }

    if (channel.getCopyright() != null) {
        channelElem.addContent(new Element("copyright").setText(channel.getCopyright()));
    }

    // we have all together for the channel definition
    rootElem.addContent(channelElem);
    // ---
    DocType docType = new DocType("rss", PUBLIC_ID, SYSTEM_ID);
    Document doc = new Document(rootElem, docType);
    outputter.output(doc, writer);
}

From source file:neon.editor.SVGExporter.java

License:Open Source License

public static void exportToSVG(ZoneTreeNode node, FileSystem files, DataStore store) {
    if (node != null) {
        Namespace ns = Namespace.getNamespace("http://www.w3.org/2000/svg");
        Element svg = new Element("svg", ns);
        Document doc = new Document(svg);
        doc.setDocType(new DocType("svg", "-//W3C//DTD SVG 1.1//EN",
                "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"));
        svg.setAttribute("width", "100%");
        svg.setAttribute("height", "100%");
        svg.setAttribute("version", "1.1");

        ArrayList<Renderable> regions = new ArrayList<Renderable>(node.getZone().getScene().getElements());
        Collections.sort(regions, new ZComparator());

        for (Renderable i : regions) {
            if (i instanceof IRegion) {
                IRegion ri = (IRegion) i;
                Element region = new Element("rect", ns);
                region.setAttribute("x", Integer.toString(ri.x));
                region.setAttribute("y", Integer.toString(ri.y));
                region.setAttribute("width", Integer.toString(ri.width));
                region.setAttribute("height", Integer.toString(ri.height));
                int red = ColorFactory.getColor(ri.resource.color).getRed();
                int green = ColorFactory.getColor(ri.resource.color).getGreen();
                int blue = ColorFactory.getColor(ri.resource.color).getBlue();
                region.setAttribute("style", "fill:rgb(" + red + "," + green + "," + blue + ")");
                svg.addContent(region);// w w w  .  j  a  v a 2s  . com
            }
        }

        files.saveFile(doc, new XMLTranslator(), store.getActive().getPath()[0], "shots",
                node.getZone().map.id + ".svg");
    }
}

From source file:org.openflexo.drm.helpset.DRMHelpSet.java

License:Open Source License

public static DocType getHSDocType() {
    return new DocType("helpset", "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 2.0//EN",
            "../dtd/helpset_2_0.dtd");
}

From source file:org.openflexo.drm.helpset.HSIndex.java

License:Open Source License

public static DocType getIndexDocType() {
    return new DocType("index", "-//Sun Microsystems Inc.//DTD JavaHelp Index Version 1.0//EN",
            "http://java.sun.com/products/javahelp/index_1_0.dtd");
}

From source file:org.openflexo.drm.helpset.HSMap.java

License:Open Source License

public static DocType getMapDocType() {
    return new DocType("map", "-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN",
            "http://java.sun.com/products/javahelp/map_1_0.dtd");
}

From source file:org.openflexo.drm.helpset.HSToc.java

License:Open Source License

public static DocType getTocDocType() {
    return new DocType("toc", "-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 2.0//EN",
            "../dtd/toc_2_0.dtd");
}