/**
  * Returns a Vector with all leafs of the tree which is described with childdef beginning at the
  * given depth.
  *
  * @param root the XMLElement which is the current root for the search
  * @param childdef a String array which describes the tree; the last element contains the leaf
  *     name
  * @param depth depth to start in childdef
  * @return a Vector of XMLElements of all leafs founded under root
  */
 private Vector getSubChildren(XMLElement root, String[] childdef, int depth) {
   Vector retval = null;
   Vector retval2 = null;
   Vector children = root != null ? root.getChildrenNamed(childdef[depth]) : null;
   if (children == null) return (null);
   if (depth < childdef.length - 1) {
     Iterator iter = children.iterator();
     while (iter.hasNext()) {
       retval2 = getSubChildren((XMLElement) iter.next(), childdef, depth + 1);
       if (retval2 != null) {
         if (retval == null) retval = new Vector();
         retval.addAll(retval2);
       }
     }
   } else return (children);
   return (retval);
 }
Ejemplo n.º 2
0
  // helper function
  private void readChoices(XMLElement element, ArrayList result) {
    Vector choices = element.getChildrenNamed("choice");

    if (choices == null) return;

    result.clear();

    Iterator choice_it = choices.iterator();

    while (choice_it.hasNext()) {
      XMLElement choice = (XMLElement) choice_it.next();

      String value = choice.getAttribute("value");

      if (value != null) {
        List osconstraints = OsConstraint.getOsList(choice);

        if (OsConstraint.oneMatchesCurrentSystem(osconstraints)) {
          result.add(this.vs.substitute(value, "plain"));
        }
      }
    }
  }