List of usage examples for org.dom4j Node setParent
void setParent(Element parent);
setParent
sets the parent relationship of this node if the parent relationship is supported or does nothing if the parent relationship is not supported.
From source file:org.jbpm.instantiation.Delegation.java
License:Open Source License
public void write(Element element) { element.addAttribute("class", className); element.addAttribute("config-type", configType); String configuration = this.configuration; if (configuration != null) { try {/*from ww w.j av a2 s . c o m*/ Element actionElement = DocumentHelper.parseText("<action>" + configuration + "</action>") .getRootElement(); Iterator iter = new ArrayList(actionElement.content()).iterator(); while (iter.hasNext()) { Node node = (Node) iter.next(); node.setParent(null); element.add(node); } } catch (DocumentException e) { log.error("couldn't create dom-tree for action configuration '" + configuration + "'", e); } } }
From source file:org.opencms.setup.xml.A_CmsSetupXmlUpdate.java
License:Open Source License
/** * Updates the given doc inserting the given node corresponding to the given xpath.<p> * /* ww w . j a va 2 s. c o m*/ * @param document the original document to update * @param newDoc the document to update * @param xpath the corresponding xpath */ protected void updateDoc(Document document, Document newDoc, String xpath) { Node node = document.selectSingleNode(xpath); if (node != null) { CmsSetupXmlHelper.setValue(newDoc, CmsXmlUtils.removeLastComplexXpathElement(xpath), " "); node = (Node) node.clone(); node.setParent(null); ((Branch) newDoc.selectSingleNode(CmsXmlUtils.removeLastComplexXpathElement(xpath))).add(node); } }
From source file:org.opencms.setup.xml.v7.CmsXmlUpdateLocalizationKeys.java
License:Open Source License
/** * @see org.opencms.setup.xml.A_CmsSetupXmlUpdate#prepareDoc(org.dom4j.Document) *///w ww. j a va 2s . com @Override protected Document prepareDoc(Document doc) { Document newDoc = super.prepareDoc(doc); String xpath = getCommonPath(); Node node = doc.selectSingleNode(xpath); CmsSetupXmlHelper.setValue(newDoc, CmsXmlUtils.removeLastComplexXpathElement(xpath), ""); node = (Node) node.clone(); node.setParent(null); ((Branch) newDoc.selectSingleNode(CmsXmlUtils.removeLastComplexXpathElement(xpath))).add(node); return newDoc; }