Example #1
0
  public List<DomStub> getChildrenByName(final CharSequence name, @Nullable final String nsKey) {
    final List<DomStub> stubs = getChildrenStubs();
    if (stubs.isEmpty()) {
      return Collections.emptyList();
    }

    final String s = nsKey == null ? "" : nsKey;
    final List<DomStub> result = new SmartList<DomStub>();
    //noinspection ForLoopReplaceableByForEach
    for (int i = 0, size = stubs.size(); i < size; i++) {
      final DomStub stub = stubs.get(i);
      if (XmlUtil.getLocalName(stub.getName()).equals(name)
          && Comparing.equal(s, stub.getNamespaceKey())) {
        result.add(stub);
      }
    }
    return result;
  }
Example #2
0
 public int getChildIndex(DomStub child) {
   List<DomStub> stubs =
       getChildrenByName(XmlUtil.getLocalName(child.getName()), child.getNamespaceKey());
   return stubs.indexOf(child);
 }