コード例 #1
0
  /**
   * Create a new <code>DavPropertyNameSet</code> from the given DAV:prop element.
   *
   * @param propElement
   * @throws IllegalArgumentException if the specified element is <code>null</code> or is not a
   *     DAV:prop element.
   */
  public DavPropertyNameSet(Element propElement) {
    if (!DomUtil.matches(propElement, XML_PROP, NAMESPACE)) {
      throw new IllegalArgumentException("'DAV:prop' element expected.");
    }

    // fill the set
    ElementIterator it = DomUtil.getChildren(propElement);
    while (it.hasNext()) {
      add(DavPropertyName.createFromXml(it.nextElement()));
    }
  }
コード例 #2
0
ファイル: CmpGetTest.java プロジェクト: ellen/cosmo
  private Set createUsersFromXml(Document doc) throws Exception {
    HashSet users = new HashSet();
    if (doc == null) {
      return null;
    }

    ElementIterator i =
        DomUtil.getChildren(doc.getDocumentElement(), UserResource.EL_USER, OutputsXml.NS_CMP);
    while (i.hasNext()) {
      CmpUser u = createUserFromXml(i.nextElement());
      users.add(u);
    }

    return users;
  }