'Processes XML nodes labeled \'backend\' into a Backends object.'

def ProcessBackendNode(self, node):

    tag = xml_parser_utils.GetTag(node)
    if (tag != 'backend'):
        self.errors.append(('Unrecognized    node:    <%s>' % tag))
        return
    backend = Backend()
    name = xml_parser_utils.GetAttribute(node, 'name')
    if (not name):
        self.errors.append('All    backends    must    have    names')
        backend.name = '-'
    else:
        backend.name = name
    instance_class = xml_parser_utils.GetChildNodeText(node, 'class')
    if instance_class:
        backend.instance_class = instance_class
    instances = xml_parser_utils.GetChildNodeText(node, 'instances')
    if instances:
        try:
            backend.instances = int(instances)
        except ValueError:
            self.errors.append(('<instances>    must    be    an    integer    (bad    value    %s)    in    backend    %s' % (instances, backend.name)))
    max_concurrent_requests = xml_parser_utils.GetChildNodeText(node, 'max-concurrent-requests')
    if max_concurrent_requests:
        try:
            backend.max_concurrent_requests = int(max_concurrent_requests)
        except ValueError:
            self.errors.append(('<max-concurrent-requests>    must    be    an    integer    (bad    value    %s)    in    backend    %s' % (max_concurrent_requests, backend.name)))
    options_node = xml_parser_utils.GetChild(node, 'options')
    if (options_node is not None):
        for sub_node in options_node.getchildren():
            tag = xml_parser_utils.GetTag(sub_node)
            if (tag not in ('fail-fast', 'dynamic', 'public')):
                self.errors.append(('<options>    only    supports    values    fail-fast,    dynamic,    and    public    (bad    value    %s)    in    backend    %s' % (tag, backend.name)))
                continue
            tag = tag.replace('-', '')
            if xml_parser_utils.BooleanValue(sub_node.text):
                backend.options.add(tag)
            elif (tag in backend.options):
                backend.options.remove(tag)
    self.backends.append(backend)
