Esempio n. 1
0
 /**
  * Returns a list of child elements. If there is no child element, returns a empty list instead of
  * null.
  *
  * @param name name of child element
  * @return a list of child elements
  */
 public List<XmlElement> findChildren(String name) {
   final List<XmlElement> tagItemList = new ArrayList<XmlElement>();
   for (final XmlElement child : mChildElements) {
     if (child.getTagName().equals(name)) {
       tagItemList.add(child);
     }
   }
   return tagItemList;
 }
Esempio n. 2
0
  /**
   * Returns a child XML element. If a child element is not found, returns an empty element instead
   * of null.
   *
   * @param name name of child element
   * @return an element
   */
  public XmlElement findChild(String name) {

    for (final XmlElement child : mChildElements) {
      if (child.getTagName().equals(name)) {
        return child;
      }
    }
    return NULL_ELEMENT;
  }