Parse a trigger redirect
        :param element: The XML Element object
        :type  element: etree._Element
357532
def _parse_redirect(self, element):
        
        self._log.info('Parsing new redirected Response')
        self._responses.add(Response(self, element, self.file_path))
1110536
public Object parseIdRefElement(Element ele) {
    // A generic reference to any name of any bean.
    String refName = ele.getAttribute(BEAN_REF_ATTRIBUTE);
    if (!StringUtils.hasLength(refName)) {
      // A reference to the id of another bean in the same XML file.
      refName = ele.getAttribute(LOCAL_REF_ATTRIBUTE);
      if (!StringUtils.hasLength(refName)) {
        error("Either 'bean' or 'local' is required for <idref> element", ele);
        return null;
      }
    }
    if (!StringUtils.hasText(refName)) {
      error("<idref> element contains empty target attribute", ele);
      return null;
    }
    RuntimeBeanNameReference ref = new RuntimeBeanNameReference(refName);
    ref.setSource(extractSource(ele));
    return ref;
  }
593930
def parse(cls, element):
        
        if element.tag != cls.ALT_RECORD_ID_TAG:
            raise exceptions.ParseError(
                u"AltRecordID got unexpected tag {}; expected {}".format(
                    element.tag, cls.ALT_RECORD_ID_TAG
                )
            )

        return cls(element.text, id=element.get(u"ID"), type=element.get(u"TYPE"))
38071
def update_xml_element(self):
        

        if not hasattr(self, 'xml_element'):
            self.xml_element = etree.Element(self.name, nsmap=NSMAP)

        self.xml_element.set('system', str(self.system))
        self.xml_element.text = self.text

        return self.xml_element
501337
def set_element_tail(parent_to_parse, element_path=None, element_tail=u''):
    

    return _set_element_property(parent_to_parse, element_path, _ELEM_TAIL, element_tail)
301325
def parse_at_element(
            self,
            element,  # type: ET.Element
            state  # type: _ProcessorState
    ):
        # type: (...) -> Any
        """"""
        xml_value = self._processor.parse_at_element(element, state)
        return _hooks_apply_after_parse(self._hooks, state, xml_value)
1032263
def parse_xml_node(self, node):
        '''

        '''
        self.sequence = int(node.getAttributeNS(RTS_NS, 'sequence'))
        c = node.getElementsByTagNameNS(RTS_NS, 'TargetComponent')
        if c.length != 1:
            raise InvalidParticipantNodeError
        self.target_component = TargetExecutionContext().parse_xml_node(c[0])
        for c in get_direct_child_elements_xml(node, prefix=RTS_EXT_NS,
                                               local_name='Properties'):
            name, value = parse_properties_xml(c)
            self._properties[name] = value
        return self
1354983
def update_xml_element(self):
        

        if not hasattr(self, 'xml_element'):
            self.xml_element = etree.Element(self.name, nsmap=NSMAP)

        self.xml_element.clear()

        if hasattr(self, 'resolved'):
            self.xml_element.set('resolved', self.resolved)
        if hasattr(self, 'style'):
            self.xml_element.set('style', self.style)
        if hasattr(self, 'style_href'):
            self.xml_element.set('style-href', self.style_href)
        if hasattr(self, 'lang'):
            self.xml_element.set(
                '{http://www.w3.org/XML/1998/namespace}lang', self.lang)
        self.xml_element.set('id', self.id)

        for child in self.children:
            if hasattr(child, 'update_xml_element'):
                child.update_xml_element()
                if hasattr(child, 'xml_element'):
                    self.xml_element.append(child.xml_element)

        return self.xml_element
427740
def parse_xml_node(self, node):
        '''

        '''
        self.group_id = node.getAttributeNS(RTS_NS, 'groupId')
        self._members = []
        for c in node.getElementsByTagNameNS(RTS_NS, 'Members'):
            self._members.append(TargetComponent().parse_xml_node(c))
        return self
541521
@SuppressWarnings("unchecked")
    public <T> T processElement(Element element) throws ConfigurationException
    {
        String namespace = $(element).namespaceURI();
        String tagName = $(element).tag();
        ElementHandler<?> handler = handlers.get(new HandlerId(namespace, tagName));
        if (handler != null)
        {
            Object o = handler.processElement(this, element);
            return (T) o;
        }
        throw new ConfigurationException("No Handler registered for element named [" + tagName
                    + "] in namespace: [" + namespace + "]");
    }
1256287
def _parse_var(self, element):
        
        syntax = 'attribute' if element.get('name') else 'element'

        var_type = attribute(element, 'type', 'user')
        if syntax == 'attribute':
            var_name  = attribute(element, 'name')
            var_value   = self.agentml.parse_tags(element, self.trigger) if len(element) else element.text
        else:
            name_etree = element.find('name')
            var_name   = self.agentml.parse_tags(name_etree, self.trigger) if len(name_etree) else name_etree.text

            value_etree = element.find('value')
            var_value = self.agentml.parse_tags(value_etree, self.trigger) if len(value_etree) else value_etree.text

        self.vars.append((var_type, var_name, var_value))
1333409
def ln_from_etree(self, ln_element, context=''):
        
        ln = {}
        # grab all understood attributes into ln dict
        for att in ('hash', 'href', 'length', 'modified',
                    'path', 'rel', 'pri', 'mime_type'):
            xml_att = self._xml_att_name(att)
            val = ln_element.attrib.get(xml_att, None)
            if (val is not None):
                ln[att] = val
        # now do some checks and conversions...
        # href (MANDATORY)
        if ('href' not in ln):
            raise SitemapParseError(
                "Missing href in <rs:ln> in %s" %
                (context))
        # rel (MANDATORY)
        if ('rel' not in ln):
            raise SitemapParseError("Missing rel in <rs:ln> in %s" % (context))
        # length in bytes
        if ('length' in ln):
            try:
                ln['length'] = int(ln['length'])
            except ValueError as e:
                raise SitemapParseError(
                    "Invalid length attribute value in <rs:ln> for %s" %
                    (context))
        # pri - priority, must be a number between 1 and 999999
        if ('pri' in ln):
            try:
                ln['pri'] = int(ln['pri'])
            except ValueError as e:
                raise SitemapParseError(
                    "Invalid pri attribute in <rs:ln> for %s" %
                    (context))
            if (ln['pri'] < 1 or ln['pri'] > 999999):
                raise SitemapParseError(
                    "Bad pri attribute value in <rs:ln> for %s" %
                    (context))
        return(ln)
1300074
def _element_find_from_root(
        root,  # type: ET.Element
        element_path  # type: Text
):
    # type: (...) -> Optional[ET.Element]
    
    element = None

    element_names = element_path.split('/')
    if element_names[0] == root.tag:
        if len(element_names) > 1:
            element = root.find('/'.join(element_names[1:]))
        else:
            element = root

    return element
334135
def get_event_triggers(self):
        
        events = {}
        nvrflag = False
        event_xml = []

        url = '%s/ISAPI/Event/triggers' % self.root_url

        try:
            response = self.hik_request.get(url, timeout=CONNECT_TIMEOUT)
            if response.status_code == requests.codes.not_found:
                # Try alternate URL for triggers
                _LOGGING.debug('Using alternate triggers URL.')
                url = '%s/Event/triggers' % self.root_url
                response = self.hik_request.get(url)

        except (requests.exceptions.RequestException,
                requests.exceptions.ConnectionError) as err:
            _LOGGING.error('Unable to fetch events, error: %s', err)
            return None

        if response.status_code != 200:
            # If we didn't recieve 200, abort
            return None

        # pylint: disable=too-many-nested-blocks
        try:
            content = ET.fromstring(response.text)

            if content[0].find(self.element_query('EventTrigger')):
                event_xml = content[0].findall(
                    self.element_query('EventTrigger'))
            elif content.find(self.element_query('EventTrigger')):
                # This is either an NVR or a rebadged camera
                event_xml = content.findall(
                    self.element_query('EventTrigger'))

            for eventtrigger in event_xml:
                ettype = eventtrigger.find(self.element_query('eventType'))
                # Catch empty xml defintions
                if ettype is None:
                    break
                etnotify = eventtrigger.find(
                    self.element_query('EventTriggerNotificationList'))

                etchannel = None
                etchannel_num = 0

                for node_name in CHANNEL_NAMES:
                    etchannel = eventtrigger.find(
                        self.element_query(node_name))
                    if etchannel is not None:
                        try:
                            # Need to make sure this is actually a number
                            etchannel_num = int(etchannel.text)
                            if etchannel_num > 1:
                                # Must be an nvr
                                nvrflag = True
                            break
                        except ValueError:
                            # Field must not be an integer
                            pass

                if etnotify:
                    for notifytrigger in etnotify:
                        ntype = notifytrigger.find(
                            self.element_query('notificationMethod'))
                        if ntype.text == 'center' or ntype.text == 'HTTP':
                            """
                            If we got this far we found an event that we want
                            to track.
                            """
                            events.setdefault(ettype.text, []) \
                                .append(etchannel_num)

        except (AttributeError, ET.ParseError) as err:
            _LOGGING.error(
                'There was a problem finding an element: %s', err)
            return None

        if nvrflag:
            self.device_type = NVR_DEVICE
        else:
            self.device_type = CAM_DEVICE
        _LOGGING.debug('Processed %s as %s Device.',
                       self.cam_id, self.device_type)

        _LOGGING.debug('Found events: %s', events)
        self.hik_request.close()
        return events
509771
function resolveElements(segments, elements) {
		for (var i=0; i<segments.length; i++) {
			var segment = segments[i];
			var event = segment.event;
			var element = elements.eq(i);

			// call the trigger with the original element
			var triggerRes = trigger('eventRender', event, event, element);

			if (triggerRes === false) {
				// if `false`, remove the event from the DOM and don't assign it to `segment.event`
				element.remove();
			}
			else {
				if (triggerRes && triggerRes !== true) {
					// the trigger returned a new element, but not `true` (which means keep the existing element)

					// re-assign the important CSS dimension properties that were already assigned in `buildHTMLForSegment`
					triggerRes = $(triggerRes)
						.css({
							position: 'absolute',
							left: segment.left
						});

					element.replaceWith(triggerRes);
					element = triggerRes;
				}

				segment.element = element;
			}
		}
	}
126667
public void parseQualifierElement(Element ele, AbstractBeanDefinition bd) {
    String typeName = ele.getAttribute(TYPE_ATTRIBUTE);
    if (!StringUtils.hasLength(typeName)) {
      error("Tag 'qualifier' must have a 'type' attribute", ele);
      return;
    }
    this.parseState.push(new QualifierEntry(typeName));
    try {
      AutowireCandidateQualifier qualifier = new AutowireCandidateQualifier(typeName);
      qualifier.setSource(extractSource(ele));
      String value = ele.getAttribute(VALUE_ATTRIBUTE);
      if (StringUtils.hasLength(value)) {
        qualifier.setAttribute(AutowireCandidateQualifier.VALUE_KEY, value);
      }
      NodeList nl = ele.getChildNodes();
      for (int i = 0; i < nl.getLength(); i++) {
        Node node = nl.item(i);
        if (node instanceof Element && nodeNameEquals(node, QUALIFIER_ATTRIBUTE_ELEMENT)) {
          Element attributeEle = (Element) node;
          String attributeName = attributeEle.getAttribute(KEY_ATTRIBUTE);
          String attributeValue = attributeEle.getAttribute(VALUE_ATTRIBUTE);
          if (StringUtils.hasLength(attributeName) && StringUtils.hasLength(attributeValue)) {
            BeanMetadataAttribute attribute = new BeanMetadataAttribute(attributeName, attributeValue);
            attribute.setSource(extractSource(attributeEle));
            qualifier.addMetadataAttribute(attribute);
          } else {
            error("Qualifier 'attribute' tag must have a 'name' and 'value'", attributeEle);
            return;
          }
        }
      }
      bd.addQualifier(qualifier);
    } finally {
      this.parseState.pop();
    }
  }
48928
def _parse_group(self, element):
        
        self._log.debug('Adding Trigger group: {group}'.format(group=element.text))
        if isinstance(self.groups, set):
            self.groups.add(element.text)
        elif self.groups is None:
            self.groups = {element.text}
        else:
            raise TypeError('Unrecognized group type, {type}: {groups}'
                            .format(type=type(self.groups), groups=str(self.groups)))