コード例 #1
0
 public ArrayList<String> getChildNames() {
   ArrayList<String> a = new ArrayList<String>();
   for (SimpleXmlElement e : getChildren()) {
     a.add(e.getName());
   }
   return a;
 }
コード例 #2
0
 public void removeChildren(String tagName) {
   for (Iterator<SimpleXmlElement> it = m_children.iterator(); it.hasNext(); ) {
     SimpleXmlElement e = it.next();
     if (e.getName().equalsIgnoreCase(tagName)) {
       it.remove();
     }
   }
 }
コード例 #3
0
 public SimpleXmlElement getChild(String name) {
   for (SimpleXmlElement c : m_children) {
     if (c.getName().equalsIgnoreCase(name)) {
       return c;
     }
   }
   return null;
 }
コード例 #4
0
 /** Returns an ArrayList with all children whose name matches the given regular expression. */
 public ArrayList<SimpleXmlElement> getChildrenRegEx(String childNameAsRegEx) {
   ArrayList<SimpleXmlElement> selectedChildren = new ArrayList<SimpleXmlElement>();
   for (SimpleXmlElement child : m_children) {
     if (child.getName().matches(childNameAsRegEx)) {
       selectedChildren.add(child);
     }
   }
   return selectedChildren;
 }
コード例 #5
0
 public ArrayList<SimpleXmlElement> getChildren(String childrenName) {
   ArrayList<SimpleXmlElement> a = new ArrayList<SimpleXmlElement>();
   for (SimpleXmlElement c : m_children) {
     if (c.getName().equalsIgnoreCase(childrenName)) {
       a.add(c);
     }
   }
   return a;
 }
コード例 #6
0
  /**
   * Returns the first child that matches the given regular expression or null if there's no match.
   */
  public SimpleXmlElement getChildRegEx(String childNameAsRegEx) {
    Iterator<SimpleXmlElement> iterator = m_children.iterator();

    while (iterator.hasNext()) {
      SimpleXmlElement child = iterator.next();

      if (child.getName().matches(childNameAsRegEx)) {
        return child;
      }
    }

    return null;
  }