List of usage examples for org.jdom2 Document setDocType
public Document setDocType(DocType docType)
DocType
declaration for this Document
. From source file:com.izforge.izpack.util.xmlmerge.merge.DefaultXmlMerge.java
License:Open Source License
/** * Performs the actual merge./* w ww . ja v a2 s.c om*/ * * @param docs The documents to merge. The first doc is assumed to be the original one to apply patches against. * @return The merged result document * @throws AbstractXmlMergeException If an error occurred during the merge */ private Document doMerge(Document[] docs) throws AbstractXmlMergeException { Document originalDoc = docs[0]; Element origRootElement = originalDoc.getRootElement(); for (int i = 1; i < docs.length; i++) { Element comparedRootElement = docs[i].getRootElement(); Document output = new Document(); if (originalDoc.getDocType() != null) { output.setDocType((DocType) originalDoc.getDocType().clone()); } output.setRootElement(new Element("root")); Element outputRootElement = output.getRootElement(); m_rootMergeAction.perform(origRootElement, comparedRootElement, outputRootElement); Element root = (Element) outputRootElement.getChildren().get(0); root.detach(); sortRootChildrenRecursive(root); originalDoc.setRootElement(root); } return originalDoc; }
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); return doc;/* w w w . j av a 2 s . c o m*/ }
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); return doc;// w ww .j a va 2 s . c o m }
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);/*from w w w. j av a2s.c o m*/ } } files.saveFile(doc, new XMLTranslator(), store.getActive().getPath()[0], "shots", node.getZone().map.id + ".svg"); } }
From source file:se.miun.itm.input.util.xml.SAXUtil.java
License:Open Source License
private static se.miun.itm.input.model.Document getWrapper(Document document) { DocType dt = document.getDocType();// w w w. j av a 2 s . c o m document.setDocType(null); Element root = document.getRootElement(); // a new root is just added to change the context. document.setRootElement(new Element(Q.SEED)); return new se.miun.itm.input.model.Document(root, dt, document.getBaseURI()); }