本文整理了Java中nu.xom.Element.detach()
方法的一些代码示例,展示了Element.detach()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.detach()
方法的具体详情如下:
包路径:nu.xom.Element
类名称:Element
方法名:detach
暂无
代码示例来源:origin: nu.validator.htmlparser/htmlparser
@Override
protected void detachFromParent(Element element) throws SAXException {
try {
element.detach();
} catch (XMLException e) {
fatal(e);
}
}
代码示例来源:origin: org.xml-cml/cmlxom
/**
* Calls detach() on all XHTML children of this element.
*/
public void removeXHTMLChildren() {
List<Element> list = this.getXHTMLElementList();
for (Element elem : list) {
elem.detach();
}
}
代码示例来源:origin: nu.validator/htmlparser
@Override
protected void detachFromParent(Element element) throws SAXException {
try {
element.detach();
} catch (XMLException e) {
fatal(e);
}
}
代码示例来源:origin: validator/htmlparser
@Override
protected void detachFromParent(Element element) throws SAXException {
try {
element.detach();
} catch (XMLException e) {
fatal(e);
}
}
代码示例来源:origin: nu.validator/htmlparser
@Override
protected void appendElement(Element child,
Element newParent) throws SAXException {
try {
child.detach();
newParent.appendChild(child);
} catch (XMLException e) {
fatal(e);
}
}
代码示例来源:origin: nu.validator.htmlparser/htmlparser
@Override
protected void appendElement(Element child,
Element newParent) throws SAXException {
try {
child.detach();
newParent.appendChild(child);
} catch (XMLException e) {
fatal(e);
}
}
代码示例来源:origin: validator/htmlparser
@Override
protected void appendElement(Element child,
Element newParent) throws SAXException {
try {
child.detach();
newParent.appendChild(child);
} catch (XMLException e) {
fatal(e);
}
}
代码示例来源:origin: org.xml-cml/cmlxom
public static void detach(nu.xom.Element element) {
ParentNode parent = (element == null) ? null : element.getParent();
if (parent != null) {
if (parent instanceof Document) {
parent.replaceChild(element, new Element(DUMMY));
} else {
element.detach();
}
}
}
代码示例来源:origin: org.xml-cml/cmlxom
/** parses a non-subclassed element into CML.
* Typically used when other software such as
* XOM or XSLT create elements through the normal
* builder.
* Removes any Document parent
* Serializes the element and re-parses with CMLBuilder()
* @param element
* @return CMLElement (null if root element is not CML)
*/
public static CMLElement createCMLElement(Element element) {
Element newElement = null;
try {
newElement = new CMLBuilder().parseString(CMLUtil.toXMLString(element));
} catch (Exception e) {
throw new RuntimeException("BUG", e);
}
if (!(newElement instanceof CMLElement)) {
newElement = null;
} else {
newElement.detach();
}
return (CMLElement) newElement;
}
/**
代码示例来源:origin: com.io7m.jstructural/io7m-jstructural-xom
static void reparentBodyNode(
final Element current_body,
final @Nullable Element target_body)
{
if (target_body != null) {
final Node rbody_root = SXHTMLReparent.getAbsoluteAncestor(target_body);
assert rbody_root != null;
final ParentNode current_body_parent = current_body.getParent();
assert current_body_parent != null;
current_body.detach();
current_body_parent.appendChild(rbody_root);
target_body.appendChild(current_body);
}
}
}
代码示例来源:origin: org.xml-cml/cmlxom
.get(j)).getFirstCMLChild(CMLMolecule.TAG);
try {
reactProd.get(j).detach();
this.appendChild(molecule);
matched = true;
代码示例来源:origin: org.xml-cml/cmlxom
/**
* delete any substance with only a name. I think this is obsolescent...
*
*/
public void removeOrphanSubstances() {
CMLSubstanceList substanceList = (CMLSubstanceList) this
.getFirstCMLChild("substanceList");
if (substanceList != null) {
Elements substances = substanceList
.getChildCMLElements("substance");
for (int i = 0; i < substances.size(); i++) {
Elements childNodes = substances.get(i).getChildElements();
if (childNodes.size() == 1
&& childNodes.get(0) instanceof CMLName) {
substances.get(i).detach();
}
}
}
}
代码示例来源:origin: org.xml-cml/cmlxom
private void mergePRLists(Component prListC, Component prC) {
Elements prLists = this.getChildCMLElements(prListC.name);
if (prLists.size() > 1) {
for (int i = 1; i < prLists.size(); i++) {
CMLElement prList = (CMLElement) prLists.get(i);
Elements prs = prList.getChildCMLElements(prC.name);
for (int j = 0; j < prs.size(); j++) {
Element pr = prs.get(j);
pr.detach();
prLists.get(0).appendChild(pr);
}
prList.detach();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!