/** * This will create a new <code>Document</code>, * with the supplied <code>{@link Element}</code> * as the root element, the supplied * <code>{@link DocType}</code> declaration, and the specified * base URI. * * @param rootElement <code>Element</code> for document root. * @param docType <code>DocType</code> declaration. * @param baseURI the URI from which this doucment was loaded. * @throws IllegalAddException if the given docType object * is already attached to a document or the given * rootElement already has a parent */ public Document(Element rootElement, DocType docType, String baseURI) { if (rootElement != null) { setRootElement(rootElement); } if (docType != null) { setDocType(docType); } if (baseURI != null) { setBaseURI(baseURI); } }
document.setDocType(DTDParser.parse( stream.getText(), factory)); break;
document.setDocType(dtype); } else if (event.isStartElement()) { final Element emt = processElement(factory, event.asStartElement());
@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; }
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; }
@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; }
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; }
if (doctype != null) { doctype.detach(); doc.setDocType(doctype);
if (doctype != null) { doctype.detach(); doc.setDocType(doctype);
/** * Performs the actual merge. * * @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; }
public Document getDocument () throws SQLException, HibernateException { Document doc = new Document (); doc.setDocType (new DocType ("minigl", "http://jpos.org/dtd/minigl.dtd")); Element root = new Element ("minigl"); root.addContent ( new Comment ( "jPOS MiniGL export $" ) ); root.addContent (new Element ("create-schema")); addUsers (root); addCurrencies (root); addCharts (root); addJournals (root); addTransactions (root); doc.setRootElement (root); return doc; }