public Content detach() { return element.detach(); }
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; }
@Override public Object sendIospMessage(Object message) { if (message instanceof Element) { iospParam = (Element) message; iospParam.detach(); return true; } return super.sendIospMessage(message); }
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; }
public void undo(MCRChangeData data) { data.getContext().detach(); } }
private void handleRemove(Element container, Element removeRule) { String id = removeRule.getAttributeValue(ATTR_REF); LOGGER.debug("removing " + id); findDescendant(container, id).ifPresent(e -> e.detach()); }
@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(); } } } }
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(); } }
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; }
public Document trim(Document doc) throws OfxInternalProcessingException { for(XPath xpath : lXpath) { Element result = mergeRecursive(doc.getRootElement(),xpath); result.detach(); doc.setRootElement(result); } return doc; }
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; }
/** * 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); }
@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; }
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; }
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(); } } }
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; }
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; }
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; } }
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; }
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; } }