本文整理了Java中org.jdom.Element.clone()
方法的一些代码示例,展示了Element.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.clone()
方法的具体详情如下:
包路径:org.jdom.Element
类名称:Element
方法名:clone
[英]This returns a deep clone of this element. The new element is detached from its parent, and getParent() on the clone will return null.
[中]这将返回此元素的深层克隆。新元素将与其父元素分离,克隆上的getParent()将返回null。
代码示例来源:origin: org.codehaus.xfire/xfire-core
public Object clone()
{
return element.clone();
}
代码示例来源:origin: org.wildfly.extras.patch/fuse-patch-config
public static Element createElementFromText(String xml) {
SAXBuilder jdom = new SAXBuilder();
Document doc;
try {
doc = jdom.build(new StringReader(xml));
} catch (JDOMException | IOException ex) {
throw new RuntimeException(ex);
}
return (Element) doc.getRootElement().clone();
}
代码示例来源:origin: org.wildfly.camel/wildfly-camel-config
public static Element createElementFromText(String xml) {
SAXBuilder jdom = new SAXBuilder();
Document doc;
try {
doc = jdom.build(new StringReader(xml));
} catch (JDOMException | IOException ex) {
throw new RuntimeException(ex);
}
return (Element) doc.getRootElement().clone();
}
代码示例来源:origin: wildfly-extras/wildfly-camel
public static Element createElementFromText(String xml) {
SAXBuilder jdom = new SAXBuilder();
Document doc;
try {
doc = jdom.build(new StringReader(xml));
} catch (JDOMException | IOException ex) {
throw new RuntimeException(ex);
}
return (Element) doc.getRootElement().clone();
}
代码示例来源:origin: uk.org.mygrid.taverna.scufl/scufl-workflow
/**
* Return the full spec element
*/
public Element getDefinitionSpec() {
Element def = (Element)this.definitionElement.clone();
def.detach();
Element spec = new Element("workflow",XScufl.XScuflNS);
spec.addContent(def);
return spec;
}
代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-impl
private void populateBeanElementForElement(Element el, Element bean) {
bean.setAttribute(BEAN_ENCODING, JDOMXML_ENCODING);
bean.addContent((Element)el.clone());
}
代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl
private void populateBeanElementForElement(Element el, Element bean) {
bean.setAttribute(BEAN_ENCODING, JDOMXML_ENCODING);
bean.addContent((Element)el.clone());
}
代码示例来源:origin: locationtech/geowave
public static String writeElementToString(final Element e) {
try {
final StringWriter sw = new StringWriter();
final Document document = new Document((Element) e.clone());
final XMLOutputter outputter = new XMLOutputter();
outputter.output(document, sw);
return sw.getBuffer().toString();
} catch (final IOException ioe) {
LOGGER.info("write error", ioe);
}
return null;
}
代码示例来源:origin: locationtech/geowave
public static void writeElementToStream(final Element e, final OutputStream os) {
try {
final BufferedOutputStream bos = new BufferedOutputStream(os);
final Document document = new Document((Element) e.clone());
final XMLOutputter outputter = new XMLOutputter();
outputter.output(document, bos);
bos.flush();
} catch (final IOException ioe) {
LOGGER.info("write error", ioe);
}
}
代码示例来源:origin: locationtech/geowave
public static void writeElementToWriter(final Element e, final Writer writer) {
try {
final Document document = new Document((Element) e.clone());
final XMLOutputter outputter = new XMLOutputter();
outputter.output(document, writer);
} catch (final IOException ioe) {
LOGGER.info("write error", ioe);
}
}
代码示例来源:origin: locationtech/geowave
public static void writeElementToStreamPretty(final Element e, final OutputStream os) {
try {
final BufferedOutputStream bos = new BufferedOutputStream(os);
final Document document = new Document((Element) e.clone());
final XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
outputter.output(document, bos);
bos.flush();
} catch (final IOException ioe) {
LOGGER.info("write error", ioe);
}
}
代码示例来源:origin: org.biomoby/taverna-biomoby
/**
*
* @param element
* @return
* @throws MobyException
*/
public static Element createMobyDataElementWrapper(Element element)
throws MobyException {
Element serviceNotes = getServiceNotes((Element) element.clone());
return createMobyDataElementWrapper(element, "a" + queryCount++,
serviceNotes);
}
代码示例来源:origin: net.sf.taverna.t2.ui-activities/biomart-activity-ui
@Override
public void noteConfiguration() {
configuration = (Element) getQuery().clone();
configurationString = outputter.outputString(configuration);
}
代码示例来源:origin: org.openwfe/openwfe-engine
public static Element cdr (final Content c)
{
final Element elt = toElement(c);
if (elt.getContent().size() < 1)
throw new IllegalArgumentException("cannot cdr an empty element");
Element result = (Element)elt.clone();
//log.debug("cdr() before \n"+XmlUtils.toString(result));
result = removeFirstChild(result);
//log.debug("cdr() after \n"+XmlUtils.toString(result));
return result;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
/**
* Returns the trimmed text value of an element with MathML descendants removed.
*
* @param e the element to get the text value from
* @return the text value of the element after removal of MathML descendants and whitespace trimming
*/
private String noMathMLValue(Element e) {
return zapNamespace((Element) e.clone(), Namespace.getNamespace("http://www.w3.org/1998/Math/MathML")).getValue().trim();
}
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-tool-lib
public void pushCurrentElement(ElementBean newBean) {
oldParentElement = (Element) rootArtifact.getBaseElement().clone();
setCurrentElement(newBean);
elementBeanStack.push(newBean);
setCurrentSchemaNode(newBean.getCurrentSchema());
}
代码示例来源:origin: org.openwfe/openwfe-engine
/**
* The classical clone method.
*/
public Object clone ()
{
final XmlRawExpression clone = (XmlRawExpression)super.clone();
clone.setXmlBranch((org.jdom.Element)this.getXmlBranch().clone());
return clone;
}
代码示例来源:origin: com.google.code.sortpom/maven-sortpom-sorter
/** 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());
}
代码示例来源:origin: Ekryd/sortpom
/** 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());
}
代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-impl
protected Element activityToXML(Activity<?> activity) throws JDOMException,
IOException {
if (activity instanceof DisabledActivity) {
ActivityAndBeanWrapper wrapper = ((DisabledActivity) activity).getConfiguration();
return ActivityXMLSerializer.getInstance().activityToXML(wrapper.getActivity(), activity, wrapper.getBean());
} else if (activity instanceof UnrecognizedActivity) {
return (Element) ((UnrecognizedActivity) activity).getConfiguration().clone();
}
return ActivityXMLSerializer.getInstance().activityToXML(activity);
}
内容来源于网络,如有侵权,请联系作者删除!