public DocumentEntry (final String key, final long lastModified, final org.jdom.Document doc) { super(); this.key = key; this.lastModified = lastModified; this.doc = (org.jdom.Document)doc.clone(); }
public Document createDocument() { return (Document)document.clone(); }
public org.jdom.Document cloneDoc () { final long start = System.currentTimeMillis(); final org.jdom.Document result = (org.jdom.Document)this.doc.clone(); if (log.isDebugEnabled()) { final long duration = System.currentTimeMillis() - start; log.debug ("cloneDoc() (cs"+XmlDocumentCache.this.cacheSize()+ ") took "+duration+" ms for "+this.key); } // remove me as soon as problem fixed !!! // //if (result == null) // log.warn("cloneDoc() null result !!!"); //else if (result.getRootElement() == null) // log.warn("cloneDoc() null root element !!!"); return result; } }
/** * Merge the right hand document into the left hand document, currently by just adding all the * nodes from right into left. * * @param left in the left hand document * @param right the right hand document * @return merged document */ private Document merge(Document left, Document right) { List<Content> children = new ArrayList<Content>(); children.addAll(right.getRootElement().getContent()); Document tempLeft = (Document) left.clone(); for (Content node : children) { if (node instanceof Element) { Content clone = ((Element) node).detach(); tempLeft.getRootElement().addContent(clone); } } return tempLeft; } }
/** * Merge the right hand document into the left hand document, currently by just adding all the * nodes from right into left. * * @param left in the left hand document * @param right the right hand document * @return merged document */ private Document merge(Document left, Document right) { List<Content> children = new ArrayList<Content>(); children.addAll(right.getRootElement().getContent()); Document tempLeft = (Document) left.clone(); for (Content node : children) { if (node instanceof Element) { Content clone = ((Element) node).detach(); tempLeft.getRootElement().addContent(clone); } } return tempLeft; } }
/** Creates a new dom document that contains the sorted xml. */ public void sortXml() { newDocument = (Document) originalDocument.clone(); final Element rootElement = (Element) originalDocument.getRootElement().clone(); HierarchyWrapper rootWrapper = factory.createFromRootElement(rootElement); rootWrapper.createWrappedStructure(factory); rootWrapper.detachStructure(); rootWrapper.sortStructureAttributes(); rootWrapper.sortStructureElements(); rootWrapper.connectXmlStructure(); newDocument.setRootElement(rootWrapper.getElementContent().getContent()); }
/** Creates a new dom document that contains the sorted xml. */ public void sortXml() { newDocument = (Document) originalDocument.clone(); final Element rootElement = (Element) originalDocument.getRootElement().clone(); HierarchyRootWrapper rootWrapper = factory.createFromRootElement(rootElement); rootWrapper.createWrappedStructure(factory); rootWrapper.detachStructure(); rootWrapper.sortStructureAttributes(); rootWrapper.sortStructureElements(); rootWrapper.connectXmlStructure(); newDocument.setRootElement(rootWrapper.getElementContent().getContent()); }
other.content = document.clone();
((Element) v.getValue().getContent()).removeContent(); final JDomAnalyzer jdomAnalyzer = new JDomAnalyzer(new InputSource(new ByteArrayInputStream(eprToBuffer.getBytes()))); ((Element) v.getValue().getContent()).getChildren().add(jdomAnalyzer.getDocument().clone()); } else { final Element serviceRef = new Element("service-ref", Namespace.getNamespace("s-ref", "http://docs.oasis-open.org/wsbpel/2.0/serviceref")) ; doc.setRootElement(serviceRef); final JDomAnalyzer jdomAnalyzer = new JDomAnalyzer(new InputSource(new ByteArrayInputStream(eprToBuffer.getBytes()))); serviceRef.getChildren().add(jdomAnalyzer.getDocument().clone());