XmlDataHandler dataHandler = new XmlDataHandler(doc, nameSpaceCtx);
List<Node> nodeFields = dataHandler.getEntries(ActivityXPath.entry_field);
List<Field> fields = new ArrayList<Field>();
for (Node node : nodeFields) {
XPathExpression xpath = (node instanceof Document) ? (XPathExpression)ActivityXPath.field.getPath() : null;
XPathExpression fieldType = ActivityXPath.field_type.getPath();
XResult result = fieldType.eval(node, nameSpaceCtx);
String type = result.getStringValue();
if ("date".equals(type)) {
fields.add(new DateField(activityService, node, nameSpaceCtx, xpath));
} else if ("file".equals(type)) {
fields.add(new FileField(activityService, node, nameSpaceCtx, xpath));