예제 #1
0
 public static List<Element> getChildNodes(Element e, String byName) {
   List<Element> result = new ArrayList<Element>();
   NodeList l = e.getChildNodes();
   for (int i = 0; i < l.getLength(); i++) {
     if (e.equals(l.item(i).getParentNode()) && byName.equals(l.item(i).getNodeName()))
       result.add((Element) l.item(i));
   }
   return result;
 }
예제 #2
0
파일: XedNavNode.java 프로젝트: greyp9/arwo
 @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
 private XedCursor findChildElement(
     final Element child, final XedCursor cursorParent, final XedCursor cursorType) {
   final Xed xed = cursorParent.getXed();
   final Element elementParent = cursorParent.getElement();
   final TypeInstance typeInstance = cursorType.getTypeInstance();
   XedCursor cursor = new XedCursor(xed, cursorType, null, null, typeInstance);
   final Collection<Element> children =
       ElementU.getChildren(elementParent, typeInstance.getName());
   int ordinal = -1;
   for (final Element childIt : children) {
     ++ordinal;
     if (childIt.equals(child)) {
       cursor = new XedCursor(xed, cursorType, childIt, ordinal, typeInstance);
       break;
     }
   }
   return cursor;
 }