public void setRootElement(DomElement rootElement) { synchronized(document) { Element documentElement = document.getDocumentElement(); Element newDocumentElement = ((DomElementImpl) rootElement).getElement(); if (documentElement != null) { document.replaceChild(newDocumentElement, documentElement); } else { document.appendChild(newDocumentElement); } } }
@Override public Node replaceChild(Node newChild, Node oldChild) throws DOMException { return original_.replaceChild(newChild, oldChild); }
@Override public Node replaceChild(Node newChild, Node oldChild) throws DOMException { return document.replaceChild(getDomNode(newChild), getDomNode(oldChild)); }
/** * @inheritDoc */ public Node replaceChild(Node newChild, Node oldChild) throws DOMException { return dom.replaceChild(newChild, oldChild); }
public Node replaceChild(Node newChild, Node oldChild) throws DOMException { return document.replaceChild(newChild, oldChild); }
@Override public Node replaceChild(Node newChild, Node oldChild) throws DOMException { return original_.replaceChild(newChild, oldChild); }
public Node replaceChild(Node newChild, Node oldChild) throws DOMException { return this.doc.replaceChild(newChild, oldChild); }
/** * Sets the given element as the Document Element of the given Document. If the document already has a Document * Element it is replaced by the given element. * * @param document the document * @param element the Element that will serve as the Document Element */ protected void setDocumentElement(@Nonnull final Document document, @Nonnull final Element element) { final Element documentRoot = document.getDocumentElement(); if (documentRoot != null) { document.replaceChild(element, documentRoot); } else { document.appendChild(element); } }
/** * Sets the given element as the Document Element of the given Document. If the document already has a Document * Element it is replaced by the given element. * * @param document the document * @param element the Element that will serve as the Document Element */ protected void setDocumentElement(@Nonnull final Document document, @Nonnull final Element element) { final Element documentRoot = document.getDocumentElement(); if (documentRoot != null) { document.replaceChild(element, documentRoot); } else { document.appendChild(element); } }
public static void wipeRootNamespaces(Document xml) { Node root = xml.getDocumentElement(); NodeList rootchildren = root.getChildNodes(); Element newroot = xml.createElement(root.getNodeName()); for (int i=0;i<rootchildren.getLength();i++) { newroot.appendChild(rootchildren.item(i).cloneNode(true)); } xml.replaceChild(newroot, root); }
/** {@inheritDoc} */ public Element marshall(XMLObject xmlObject, Document document) throws MarshallingException { Element signatureElement = createSignatureElement((SignatureImpl) xmlObject, document); Element documentRoot = document.getDocumentElement(); if (documentRoot != null) { document.replaceChild(signatureElement, documentRoot); } else { document.appendChild(signatureElement); } return signatureElement; }
public void setRootElement(DomElement rootElement) { synchronized(document) { Element documentElement = document.getDocumentElement(); Element newDocumentElement = ((DomElementImpl) rootElement).getElement(); if (documentElement != null) { document.replaceChild(newDocumentElement, documentElement); } else { document.appendChild(newDocumentElement); } } }
/** {@inheritDoc} */ public Element marshall(XMLObject xmlObject, Document document) throws MarshallingException { Element signatureElement = createSignatureElement((SignatureImpl) xmlObject, document); Element documentRoot = document.getDocumentElement(); if (documentRoot != null) { document.replaceChild(signatureElement, documentRoot); } else { document.appendChild(signatureElement); } return signatureElement; }
private void setNamespace(Document document, String namespace) { Element orgElement = document.getDocumentElement(); Element newElement = document.createElementNS(namespace, orgElement.getNodeName()); NodeList childNodes = orgElement.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { appendChildNS(document, newElement, childNodes.item(i), namespace); } document.replaceChild(newElement, orgElement); }
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; DocumentType docType; Node replaced; doc = (Document) load("hc_staff", false); docType = doc.getDoctype(); replaced = doc.replaceChild(docType, docType); } /**
/** Serialize this configuration into a serialized XML document. * * @return Serialized XML version of this configuration. * @throws DOMException If an error occurs constructing the XML structure. */ public String toXML() throws DOMException { Document doc = createDocument("configuration"); doc.replaceChild(toXML(doc), doc.getDocumentElement()); return XML.serialize(doc); }
/** Serialize this configuration into a serialized XML document. * * @return Serialized XML version of this configuration. * @throws DOMException If an error occurs constructing the XML structure. */ public String toXML() throws DOMException { Document doc = createDocument("configuration"); doc.replaceChild(toXML(doc), doc.getDocumentElement()); return XML.serialize(doc); }
/** Yield this exce-server configuration as serialized XML. * * @return This object as a string serialized XML document. * @throws DOMException If we can't create the XML document. */ public String toXML() throws DOMException { Document doc = Configuration.createDocument("execServer"); doc.replaceChild(toXML(doc), doc.getDocumentElement()); return XML.serialize(doc); }
/** Yield this exce-server configuration as serialized XML. * * @return This object as a string serialized XML document. * @throws DOMException If we can't create the XML document. */ public String toXML() throws DOMException { Document doc = Configuration.createDocument("execServer"); doc.replaceChild(toXML(doc), doc.getDocumentElement()); return XML.serialize(doc); }
public static Document renderLazyContextResource(Context context, StateConfig config, String nodeName) throws Exception { if(config.isLazyContextResource(nodeName)) { ResultDocument resDoc = new ResultDocument(); Object res = config.getContextResources().get(nodeName); renderContextResource(res, resDoc, nodeName); Document doc = resDoc.getSPDocument().getDocument(); Element elem = DOMUtils.getFirstChildByTagName(doc.getDocumentElement(), nodeName); if(elem != null) { doc.replaceChild(elem, doc.getDocumentElement()); } return doc; } return null; }