use of org.apache.jackrabbit.webdav.xml.ElementIterator in project jackrabbit by apache.
the class LockDiscovery method createFromXml.
// ---------------------------------------------------< factory from xml >---
/**
* Builds a new <code>LockDiscovery</code> object from the given xml element.
*
* @param lockDiscoveryElement
* @return
* @throws IllegalArgumentException if the given xml element is not a
* DAV:lockdiscovery element.
*/
public static LockDiscovery createFromXml(Element lockDiscoveryElement) {
if (!DomUtil.matches(lockDiscoveryElement, PROPERTY_LOCKDISCOVERY, NAMESPACE)) {
throw new IllegalArgumentException("DAV:lockdiscovery element expected.");
}
List<ActiveLock> activeLocks = new ArrayList<ActiveLock>();
ElementIterator it = DomUtil.getChildren(lockDiscoveryElement, XML_ACTIVELOCK, NAMESPACE);
while (it.hasNext()) {
Element al = it.nextElement();
activeLocks.add(new ALockImpl(al));
}
return new LockDiscovery(activeLocks.toArray(new ActiveLock[activeLocks.size()]));
}
Aggregations