public FieldBinding() {
super("field");
}
public Object parse(Element element, Parse parse, Parser parser) {
FieldOperation fieldOperation = new FieldOperation();
if (element.hasAttribute("name")) {
fieldOperation.setFieldName(element.getAttribute("name"));
} else {
parse.addProblem("field must have name : "+XmlUtil.toString(element), element);
}
Element descriptorElement = XmlUtil.element(element);
if (descriptorElement!=null) {
Descriptor descriptor = (Descriptor) parser.parseElement(descriptorElement, parse, WireParser.CATEGORY_DESCRIPTOR);
if (descriptor!=null) {
fieldOperation.setDescriptor(descriptor);
} else {
parse.addProblem("unknown descriptor element "+descriptorElement.getTagName()+" inside field operation: "+XmlUtil.toString(element), element);
}
} else {
parse.addProblem("field must have 1 descriptor element out of "+parser.getBindings().getTagNames(WireParser.CATEGORY_DESCRIPTOR)+" as content: "+XmlUtil.toString(element), element);