m_doc.insertBefore(newNode, m_nextSibling); else m_doc.appendChild(newNode);
m_doc.insertBefore(newNode, m_nextSibling); else m_doc.appendChild(newNode);
document.insertBefore(document.createComment(new Date().toString()), root);
/** * @inheritDoc */ public Node insertBefore(Node newChild, Node refChild) throws DOMException { return dom.insertBefore(newChild, refChild); }
@Override public Node insertBefore(Node newChild, Node refChild) throws DOMException { return original_.insertBefore(newChild, refChild); }
@Override public Node insertBefore(Node newChild, Node refChild) throws DOMException { return document.insertBefore(getDomNode(newChild), getDomNode(refChild)); }
@Override public Node insertBefore(Node newChild, Node refChild) throws DOMException { return original_.insertBefore(newChild, refChild); }
public Node insertBefore(Node newChild, Node refChild) throws DOMException { return this.doc.insertBefore(newChild, refChild); }
public Node insertBefore(Node newChild, Node refChild) throws DOMException { return document.insertBefore(newChild, refChild); }
public Node insertBefore(Node newChild, Node refChild) throws DOMException { return document.insertBefore(newChild, refChild); }
public Node insertBefore(Node newChild, Node refChild) throws DOMException { return document.insertBefore(newChild, refChild); }
public static void insertLeadingPI(Document doc, String target, String data) { Element element = doc.getDocumentElement(); ProcessingInstruction pi = doc.createProcessingInstruction(target, data); doc.insertBefore(pi, element); }
/** * Create project tag. */ public void createRoot() { // <project name="hello" default="build" basedir="."> root = doc.createElement("project"); //$NON-NLS-1$ root.setAttribute(IAntCoreConstants.NAME, projectName); root.setAttribute(IAntCoreConstants.DEFAULT, "build"); //$NON-NLS-1$ root.setAttribute("basedir", "."); //$NON-NLS-1$ //$NON-NLS-2$ doc.appendChild(root); // <!-- warning --> Comment comment = doc.createComment(WARNING + ExportUtil.NEWLINE + NOTE); doc.insertBefore(comment, root); }
@Override public void processingInstruction(String target, String data) throws SAXException { // adds the given processing instruction to the document root Document document = getDocument(_node); ProcessingInstruction instruction = document.createProcessingInstruction(target, data); document.insertBefore(instruction, document.getFirstChild()); }
Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); document.setXmlStandalone(true); Element root = document.createElement("root"); document.appendChild(root); root.appendChild(document.createElement("childElement")); document.insertBefore(document.createComment("some comment"), root); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.transform(new DOMSource(document), new StreamResult(System.out));
private static void ensureXMLDirective(Document document) { if (hasXMLDirective(document)) { return; } Node firstChild = document.getFirstChild(); ProcessingInstruction xmlDeclaration = getXMLDeclaration(document); document.insertBefore(xmlDeclaration, firstChild); Text textNode = document.createTextNode(System.getProperty("line.separator")); document.insertBefore(textNode, firstChild); }
private void initXMLReport() { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = dbf.newDocumentBuilder(); this.document = db.newDocument(); this.rootElement = this.document.createElement("root"); this.document.appendChild(this.rootElement); Comment comment = this.document.createComment("DDoc verification result"); this.document.insertBefore(comment, this.rootElement); } catch (ParserConfigurationException e) { throw new DigiDoc4JException(e); } }
/** * Insert an instruction before the element represented by this builder node. * * @param target * the target value for the instruction. * @param data * the data value for the instruction */ protected void insertInstructionImpl(String target, String data) { getDocument().insertBefore( getDocument().createProcessingInstruction(target, data), xmlNode); }
/** * Insert an instruction before the element represented by this builder node. * * @param target * the target value for the instruction. * @param data * the data value for the instruction */ protected void insertInstructionImpl(String target, String data) { getDocument().insertBefore( getDocument().createProcessingInstruction(target, data), xmlNode); }
/** * Insert an instruction before the element represented by this builder node. * * @param target * the target value for the instruction. * @param data * the data value for the instruction */ protected void insertInstructionImpl(String target, String data) { getDocument().insertBefore( getDocument().createProcessingInstruction(target, data), xmlNode); }