org.jdom2.Element.getDescendants()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中org.jdom2.Element.getDescendants()方法的一些代码示例,展示了Element.getDescendants()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getDescendants()方法的具体详情如下:
包路径:org.jdom2.Element
类名称:Element
方法名:getDescendants

Element.getDescendants介绍

[英]Returns an iterator that walks over all descendants in document order.
[中]返回按文档顺序遍历所有子体的迭代器。

代码示例

代码示例来源:origin: org.jdom/jdom

final Iterator<Content> it = recursively ? getDescendants()
    : content.iterator();
Text tfirst = null;

代码示例来源:origin: org.codehaus.plexus/plexus-component-metadata

/**
 * @return {@link Iterator} of descendants.
 * @see org.jdom2.Element#getDescendants()
 */
public Iterator getDescendants()
{
  return element.getDescendants();
}

代码示例来源:origin: org.codehaus.plexus/plexus-component-metadata

/**
 * @param filter {@link Filter}
 * @return {@link Iterator} of descendants.
 * @see org.jdom2.Element#getDescendants(org.jdom2.filter.Filter)
 */
public Iterator getDescendants( Filter filter )
{
  return element.getDescendants( filter );
}

代码示例来源:origin: org.mycore/mycore-xeditor

public static void removeChangeTracking(Element element) {
  for (Iterator<ProcessingInstruction> iter = element.getDescendants(Filters.processinginstruction())
    .iterator(); iter.hasNext();) {
    if (iter.next().getTarget().startsWith(PREFIX)) {
      iter.remove();
    }
  }
}

代码示例来源:origin: org.mycore/mycore-xeditor

private Optional<Element> findDescendant(Element container, String id) {
  IteratorIterable<Element> descendants = container.getDescendants(new ElementFilter());
  return StreamSupport.stream(descendants.spliterator(), false)
    .filter(e -> hasOrIncludesID(e, id)).findFirst();
}

代码示例来源:origin: org.mycore/mycore-mods

/** If mods:genre was not mapped by conversion/import function, ignore this publication and do not import */
private static boolean shouldIgnore(Element publication) {
  return !publication.getDescendants(new ElementFilter("genre", MCRConstants.MODS_NAMESPACE)).hasNext();
}

代码示例来源:origin: org.mycore/oaipmh-dataprovider

/**
 * Moves all namespace declarations in the children of target to the target.
 *
 * @param target the namespace are bundled here
 */
private void moveNamespacesUp(Element target) {
  Map<String, Namespace> existingNamespaces = getNamespaceMap(target);
  Map<String, Namespace> newNamespaces = new HashMap<>();
  target.getDescendants(new ElementFilter()).forEach(child -> {
    Map<String, Namespace> childNamespaces = getNamespaceMap(child);
    childNamespaces.forEach((prefix, ns) -> {
      if (existingNamespaces.containsKey(prefix) || newNamespaces.containsKey(prefix)) {
        return;
      }
      newNamespaces.put(prefix, ns);
    });
  });
  newNamespaces.forEach((prefix, ns) -> target.addNamespaceDeclaration(ns));
}

代码示例来源:origin: com.cerner.ccl.whitenoise/whitenoise-rules-core

return false;
final Iterator<Element> e1Descendants = e1.getDescendants(new ElementFilter());
final Iterator<Element> e2Descendants = e2.getDescendants(new ElementFilter());

代码示例来源:origin: org.jetbrains.intellij.plugins/intellij-plugin-structure

private static List<String> extractReferencedClasses(@NotNull Element rootElement) {
 List<String> referencedClasses = new ArrayList<String>();
 Iterator<Content> descendants = rootElement.getDescendants();
 while (descendants.hasNext()) {
  Content next = descendants.next();
  if (next instanceof Element) {
   Element element = (Element) next;
   if (isInterestingName(element.getName())) {
    referencedClasses.addAll(extractClasses(element.getTextNormalize()));
   }
   for (Attribute attribute : element.getAttributes()) {
    if (isInterestingName(attribute.getName())) {
     referencedClasses.addAll(extractClasses(attribute.getValue().trim()));
    }
   }
  } else if (next instanceof Text) {
   Parent parent = next.getParent();
   if (parent instanceof Element) {
    if (isInterestingName(((Element) parent).getName())) {
     referencedClasses.addAll(extractClasses(((Text) next).getTextTrim()));
    }
   }
  }
 }
 return referencedClasses;
}

代码示例来源:origin: org.mycore/mycore-xeditor

public MCRJDOMContent transform(MCRContent source) throws IOException {
    try {
      Element root = source.asXML().getRootElement().clone();
      for (Text text : root.getDescendants(Filters.text())) {
        text.setText(MCRXMLFunctions.normalizeUnicode(text.getText()));
      }
      return new MCRJDOMContent(root);
    } catch (JDOMException | SAXException ex) {
      throw new IOException(ex);
    }
  }
}

代码示例来源:origin: com.infotel.seleniumRobot/core

for (Element pack: test.getDescendants(new ElementFilter("package"))) {
  if (pack.getAttributeValue("name").contains("com.seleniumtests.core.runner")) {
    cucumberTest = true;

代码示例来源:origin: senbox-org/s2tbx

IteratorIterable<Content> contents = web_app.getDescendants();
while (contents.hasNext()) {
  Content web_app_content = contents.next();

相关文章

微信公众号

最新文章

更多