if (containerElement == null) {
throw new RequiredArgumentException("containerElement");
}
Iterator<OMElement> it = containerElement.getChildElements();
if (!it.hasNext()) {
throw new InvalidInputFormatException("Payload container element must contain exactly one child element");
}
Document result = null;
OMElement firstPayloadElement = it.next();
if (it.hasNext()) {
throw new InvalidInputFormatException("Task payload must consist of exactly one element.");
} else {
result = new XmlTooling().convertOMToDOM(firstPayloadElement);
}
return result;
}