本文整理了Java中org.jdom2.Element.detach()
方法的一些代码示例,展示了Element.detach()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.detach()
方法的具体详情如下:
包路径:org.jdom2.Element
类名称:Element
方法名:detach
暂无
代码示例来源:origin: org.codehaus.plexus/plexus-component-metadata
public Content detach()
{
return element.detach();
}
代码示例来源:origin: org.openfuxml/ofx-util
private List<Element> processSections(List<?> lChilds)
{
List<Element> lSection = new ArrayList<Element>();
for(Object o : lChilds)
{
Element e = (Element)o;
lSection.add(e);
}
for(Element e : lSection){e.detach();}
return lSection;
}
代码示例来源:origin: Unidata/thredds
@Override
public Object sendIospMessage(Object message) {
if (message instanceof Element) {
iospParam = (Element) message;
iospParam.detach();
return true;
}
return super.sendIospMessage(message);
}
代码示例来源:origin: org.openfuxml/ofx-util
private List<Element> processSection(List<?> lChilds)
{
List<Element> lSection = new ArrayList<Element>();
for(Object o : lChilds)
{
Element e = (Element)o;
boolean add = true;
if(e.getName().equalsIgnoreCase(Title.class.getSimpleName())){add=false;}
if(add){lSection.add(e);}
}
for(Element e : lSection){e.detach();}
return lSection;
}
代码示例来源:origin: org.mycore/mycore-xeditor
public void undo(MCRChangeData data) {
data.getContext().detach();
}
}
代码示例来源:origin: org.mycore/mycore-xeditor
private void handleRemove(Element container, Element removeRule) {
String id = removeRule.getAttributeValue(ATTR_REF);
LOGGER.debug("removing " + id);
findDescendant(container, id).ifPresent(e -> e.detach());
}
代码示例来源:origin: org.mycore/mycore-mods
@Override
public void mergeFrom(MCRMerger other) {
super.mergeFrom(other);
// if there is family name after merge, prefer that and remove untyped name part
if (!getNodes("mods:namePart[@type='family']").isEmpty()) {
List<Element> namePartsWithoutType = getNodes("mods:namePart[not(@type)]");
if (!namePartsWithoutType.isEmpty()) {
namePartsWithoutType.get(0).detach();
}
}
}
}
代码示例来源:origin: org.mycore/mycore-mods
public void removeElements(String xPath) {
Iterator<Element> selected;
try {
selected = buildXPath(xPath).evaluate(getMODS()).iterator();
} catch (JDOMException ex) {
String msg = "Could not remove elements at " + xPath;
throw new MCRException(msg, ex);
}
while (selected.hasNext()) {
Element element = selected.next();
element.detach();
}
}
代码示例来源:origin: org.mycore/mycore-oai
protected Element getURI(String uri) {
Element e = MCRURIResolver.instance().resolve(uri).detach();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("get {}", uri);
XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());
LOGGER.debug(out.outputString(e));
}
return e;
}
代码示例来源:origin: org.openfuxml/ofx-util
public Document trim(Document doc) throws OfxInternalProcessingException
{
for(XPath xpath : lXpath)
{
Element result = mergeRecursive(doc.getRootElement(),xpath);
result.detach();
doc.setRootElement(result);
}
return doc;
}
代码示例来源:origin: org.mycore/mycore-xeditor
public static MCRChangeData remove(Element element) {
Element parent = element.getParentElement();
MCRChangeData data = new MCRChangeData("removed-element", element, parent.indexOf(element), parent);
element.detach();
return data;
}
代码示例来源:origin: Unidata/thredds
/**
* Writes an NcML element to a Writer.
*
* @param elem an NcML element.
* @param writer the Writer to write the NcML document to. Will be closed at end of the method.
* @throws IOException if there's any problem writing.
*/
public void writeToWriter(Element elem, Writer writer) throws IOException {
xmlOutputter.setFormat(xmlFormat);
elem.detach(); // In case this element had previously been added to a Document.
xmlOutputter.output(new Document(elem), writer);
}
代码示例来源:origin: org.openfuxml/ofx-util
@Deprecated
public org.jdom2.Document mergeToDoc(File rootFile) throws OfxInternalProcessingException
{
loadRoot(rootFile);
Element rootElement = doc.getRootElement();
Element result = mergeRecursive(rootElement);
result.detach();
doc.setRootElement(result);
return doc;
}
代码示例来源:origin: org.openfuxml/ofx-wiki
public String merge(String xHtmlText)
{
Document doc = null;
try {doc = JDomUtil.txtToDoc(xHtmlText);}
catch (JDOMException e) {logger.error("",e);}
Element rootElement = doc.getRootElement();
rootElement.detach();
doc.setRootElement(merge(rootElement));
xHtmlText=JDomUtil.docToTxt(doc);
return xHtmlText;
}
代码示例来源:origin: org.openfuxml/ofx-util
private void filterLang(org.jdom2.Document j2Doc)
{
XPathFactory xpfac = XPathFactory.instance();
XPathExpression<Attribute> xp = xpfac.compile("//*/@lang", Filters.attribute());
for (Attribute att : xp.evaluate(j2Doc))
{
if(!att.getValue().equals(lang))
{
att.getParent().detach();
}
}
}
代码示例来源:origin: org.openfuxml/ofx-util
public Document merge(Document ofxDoc) throws OfxInternalProcessingException
{
org.jdom2.Document doc = JaxbUtil.toDocument(ofxDoc);
for(XPath xpath : lXpath)
{
Element result = mergeRecursive(doc.getRootElement(),xpath);
result.detach();
doc.setRootElement(result);
}
ofxDoc = (Document)JDomUtil.toJaxb(doc, Document.class);
return ofxDoc;
}
代码示例来源:origin: org.openfuxml/ofx-wiki
private Element getCategory(Content wikiContent)
{
org.openfuxml.content.ofx.Sections ofxSections = new org.openfuxml.content.ofx.Sections();
ofxSections.setExternal(true);
ofxSections.setSource(wikiXmlDirName+"/"+counter+".xml");counter++;
Element eResult = JaxbUtil.toDocument(ofxSections).getRootElement();
eResult.detach();
return eResult;
}
代码示例来源:origin: org.openfuxml/ofx-wiki
private Element getSection(Content wikiContent)
{
org.openfuxml.content.ofx.Section ofxSection = new org.openfuxml.content.ofx.Section();
ofxSection.setExternal(true);
ofxSection.setSource(wikiXmlDirName+"/"+counter+".xml");counter++;
Element eResult = JaxbUtil.toDocument(ofxSection).getRootElement();
eResult.detach();
return eResult;
}
}
代码示例来源:origin: org.openfuxml/ofx-wiki
public Element transform(Template template)
{
Section section = new Section();
section.setContainer(true);
Table table = getTable(template.getTemplateKv());
section.getContent().add(table);
Element result = JaxbUtil.toDocument(section, nsPrefixMapper).getRootElement();
result.detach();
return result;
}
代码示例来源:origin: Unidata/thredds
private DatasetBuilder readDatasetScan(DatasetBuilder parent, Element dsElem) {
DatasetScanConfigBuilder configBuilder = new DatasetScanConfigBuilder(errlog);
DatasetScanConfig config = configBuilder.readDatasetScanConfig(dsElem);
if (configBuilder.fatalError) {
// this.fatalError = true;
return null;
} else {
DatasetScanBuilder dataset = new DatasetScanBuilder(parent, config);
readDatasetInfo(dataset, dsElem);
for (Element elem : dsElem.getChildren("netcdf", Catalog.ncmlNS)) {
dataset.put(Dataset.Ncml, elem.detach());
}
return dataset;
}
}
内容来源于网络,如有侵权,请联系作者删除!