本文整理了Java中org.jdom2.Element.getParent()
方法的一些代码示例,展示了Element.getParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getParent()
方法的具体详情如下:
包路径:org.jdom2.Element
类名称:Element
方法名:getParent
暂无
代码示例来源:origin: org.jdom/jdom
/**
* Determines if this element is the ancestor of another element.
*
* @param element <code>Element</code> to check against
* @return <code>true</code> if this element is the ancestor of the
* supplied element
*/
public boolean isAncestor(final Element element) {
Parent p = element.getParent();
while (p instanceof Element) {
if (p == this) {
return true;
}
p = p.getParent();
}
return false;
}
代码示例来源:origin: org.jdom/jdom
final Parent p = currentElement.getParent();
if (p instanceof Document) {
atRoot = true;
代码示例来源:origin: com.rometools/rome-modules
private Element getRoot(final Element start) {
// reach up to grab the sharing element out of the root
Element root = start;
while (root.getParent() != null && root.getParent() instanceof Element) {
root = (Element) root.getParent();
}
return root;
}
代码示例来源:origin: rometools/rome
private Element getRoot(final Element start) {
// reach up to grab the sharing element out of the root
Element root = start;
while (root.getParent() != null && root.getParent() instanceof Element) {
root = (Element) root.getParent();
}
return root;
}
代码示例来源:origin: org.codehaus.plexus/plexus-component-metadata
/**
* @return The parent.
* @see org.jdom2.Content#getParent()
*/
public Parent getParent()
{
return element.getParent();
}
代码示例来源:origin: apache/marmotta
private Element getRoot(Element start) {
// reach up to grab the sharing element out of the root
Element root = start;
while ((root.getParent() != null) && root.getParent() instanceof Element) {
root = (Element) root.getParent();
}
return root;
}
代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss
private Element getRoot(Element start) {
// reach up to grab the sharing element out of the root
Element root = start;
while ((root.getParent() != null) && root.getParent() instanceof Element) {
root = (Element) root.getParent();
}
return root;
}
代码示例来源:origin: geotools/geotools
final Parent parent = element.getParent();
parent.removeContent(element);
代码示例来源:origin: rometools/rome
@Override
public void generate(final Module module, final Element element) {
if (!(module instanceof SSEModule)) {
return;
}
final SSEModule sseModule = (SSEModule) module;
if (sseModule instanceof Sharing) {
final Sharing sharing = (Sharing) sseModule;
// add sse namespace
Element root = element;
while (root.getParent() != null && root.getParent() instanceof Element) {
root = (Element) root.getParent();
}
root.addNamespaceDeclaration(SSEModule.SSE_NS);
generateSharing(sharing, root);
} else if (sseModule instanceof Sync) {
generateSync((Sync) sseModule, element);
}
}
代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss
public void generate(Module module, Element element) {
if (!(module instanceof SSEModule)) {
return;
}
SSEModule sseModule = (SSEModule)module;
if (sseModule instanceof Sharing) {
Sharing sharing = (Sharing)sseModule;
// add sse namespace
Element root = element;
while ((root.getParent() != null) && root.getParent() instanceof Element) {
root = (Element) root.getParent();
}
root.addNamespaceDeclaration(SSEModule.SSE_NS);
generateSharing(sharing, root);
} else if (sseModule instanceof Sync) {
generateSync((Sync)sseModule, element);
}
}
代码示例来源:origin: com.rometools/rome-modules
@Override
public void generate(final Module module, final Element element) {
if (!(module instanceof SSEModule)) {
return;
}
final SSEModule sseModule = (SSEModule) module;
if (sseModule instanceof Sharing) {
final Sharing sharing = (Sharing) sseModule;
// add sse namespace
Element root = element;
while (root.getParent() != null && root.getParent() instanceof Element) {
root = (Element) root.getParent();
}
root.addNamespaceDeclaration(SSEModule.SSE_NS);
generateSharing(sharing, root);
} else if (sseModule instanceof Sync) {
generateSync((Sync) sseModule, element);
}
}
代码示例来源:origin: apache/marmotta
protected void generateForeignMarkup(Element e, List foreignMarkup) {
if (foreignMarkup != null) {
Iterator elems = (Iterator) foreignMarkup.iterator();
while (elems.hasNext()) {
Element elem = (Element) elems.next();
Parent parent = elem.getParent();
if (parent != null) {
parent.removeContent(elem);
}
e.addContent(elem);
}
}
}
代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss
protected void generateForeignMarkup(Element e, List foreignMarkup) {
if (foreignMarkup != null) {
Iterator elems = (Iterator) foreignMarkup.iterator();
while (elems.hasNext()) {
Element elem = (Element) elems.next();
Parent parent = elem.getParent();
if (parent != null) {
parent.removeContent(elem);
}
e.addContent(elem);
}
}
}
代码示例来源:origin: apache/marmotta
public void generate(Module module, Element element) {
if (!(module instanceof SSEModule)) {
return;
}
SSEModule sseModule = (SSEModule)module;
if (sseModule instanceof Sharing) {
Sharing sharing = (Sharing)sseModule;
// add sse namespace
Element root = element;
while ((root.getParent() != null) && root.getParent() instanceof Element) {
root = (Element) root.getParent();
}
root.addNamespaceDeclaration(SSEModule.SSE_NS);
generateSharing(sharing, root);
} else if (sseModule instanceof Sync) {
generateSync((Sync)sseModule, element);
}
}
代码示例来源:origin: rometools/rome
protected void generateForeignMarkup(final Element element, final List<Element> foreignElements) {
if (foreignElements != null) {
for (final Element foreignElement : foreignElements) {
final Parent parent = foreignElement.getParent();
if (parent != null) {
parent.removeContent(foreignElement);
}
element.addContent(foreignElement);
}
}
}
代码示例来源:origin: com.rometools/rome
protected void generateForeignMarkup(final Element element, final List<Element> foreignElements) {
if (foreignElements != null) {
for (final Element foreignElement : foreignElements) {
final Parent parent = foreignElement.getParent();
if (parent != null) {
parent.removeContent(foreignElement);
}
element.addContent(foreignElement);
}
}
}
代码示例来源:origin: rometools/rome
while (root.getParent() != null && root.getParent() instanceof Element) {
root = (Element) element.getParent();
代码示例来源:origin: rometools/rome
/** Use feed links and/or xml:base attribute to determine baseURI of feed */
private static URL findBaseURI(final Element root) {
URL baseURI = null;
final List<Element> linksList = root.getChildren("link", OS_NS);
if (linksList != null) {
for (final Element element : linksList) {
final Element link = element;
if (!root.equals(link.getParent())) {
break;
}
String href = link.getAttribute("href").getValue();
if (link.getAttribute("rel", OS_NS) == null || link.getAttribute("rel", OS_NS).getValue().equals("alternate")) {
href = resolveURI(null, link, href);
try {
baseURI = new URL(href);
break;
} catch (final MalformedURLException e) {
System.err.println("Base URI is malformed: " + href);
}
}
}
}
return baseURI;
}
}
代码示例来源:origin: com.rometools/rome-modules
/** Use feed links and/or xml:base attribute to determine baseURI of feed */
private static URL findBaseURI(final Element root) {
URL baseURI = null;
final List<Element> linksList = root.getChildren("link", OS_NS);
if (linksList != null) {
for (final Element element : linksList) {
final Element link = element;
if (!root.equals(link.getParent())) {
break;
}
String href = link.getAttribute("href").getValue();
if (link.getAttribute("rel", OS_NS) == null || link.getAttribute("rel", OS_NS).getValue().equals("alternate")) {
href = resolveURI(null, link, href);
try {
baseURI = new URL(href);
break;
} catch (final MalformedURLException e) {
System.err.println("Base URI is malformed: " + href);
}
}
}
}
return baseURI;
}
}
代码示例来源:origin: apache/marmotta
/** Use feed links and/or xml:base attribute to determine baseURI of feed */
private static URL findBaseURI(Element root) {
URL baseURI = null;
List linksList = root.getChildren("link", OS_NS);
if (linksList != null) {
for (Object aLinksList : linksList) {
Element link = (Element) aLinksList;
if (!root.equals(link.getParent())) break;
String href = link.getAttribute("href").getValue();
if (link.getAttribute("rel", OS_NS) == null
|| link.getAttribute("rel", OS_NS).getValue().equals("alternate")) {
href = resolveURI(null, link, href);
try {
baseURI = new URL(href);
break;
} catch (MalformedURLException e) {
System.err.println("Base URI is malformed: " + href);
}
}
}
}
return baseURI;
}
}
内容来源于网络,如有侵权,请联系作者删除!