Parse and assign the priority for this response
        :param element: The XML Element object
        :type  element: etree._Element
166640
def _parse_priority(self, element):
        
        self._log.debug('Setting Trigger priority: {priority}'.format(priority=element.text))
        self.priority = int(element.text)
1266261
def _parse_substitutions(self, element):
        
        subs = element.findall('sub')

        for sub in subs:
            self.agentml.set_substitution(attribute(sub, 'word'), sub.text)
384493
def parse(self):
        
        # Create the element tree
        self.tree = self._build_tree(self.html_contents)

        # Get explicits elements to keep and discard
        self.elts_to_keep = self._get_elements_to_keep()
        self.elts_to_discard = self._get_elements_to_discard()

        # Init an empty list of Elements to remove
        self.elts_to_remove = []

        # Check if the root is a match or if there is any matches
        is_root = self._is_keep(self.tree)
        has_descendant = self._has_keep_elt_in_descendants(self.tree)

        if not(is_root or has_descendant):
            return False

        # Parse and clean the ElementTree
        self._parse_element(self.tree, parent_is_keep=is_root)
        self._remove_elements(self.elts_to_remove)

        return True
357532
def _parse_redirect(self, element):
        
        self._log.info('Parsing new redirected Response')
        self._responses.add(Response(self, element, self.file_path))
784413
private void loadElement(Element element, Transform t)
			throws ParsingException {
		for (int i = 0; i < processors.size(); i++) {
			ElementProcessor processor = (ElementProcessor) processors.get(i);

			if (processor.handles(element)) {
				processor.process(this, element, diagram, t);
			}
		}
	}
1205791
protected void parseRootElement() {

    JobExecutorXmlImpl jobExecutor = new JobExecutorXmlImpl();
    List<ProcessEngineXml> processEngines = new ArrayList<ProcessEngineXml>();

    for (Element element : rootElement.elements()) {

      if(JOB_EXECUTOR.equals(element.getTagName())) {
        parseJobExecutor(element, jobExecutor);

      } else if(PROCESS_ENGINE.equals(element.getTagName())) {
        parseProcessEngine(element, processEngines);

      }

    }

    bpmPlatformXml = new BpmPlatformXmlImpl(jobExecutor, processEngines);
  }
120046
def parse_at_element(
            self,
            element,  # type: ET.Element
            state  # type: _ProcessorState
    ):
        # type: (...) -> Any
        """"""
        parsed_dict = {}

        for child in self._child_processors:
            state.push_location(child.element_path)
            parsed_dict[child.alias] = child.parse_from_parent(element, state)
            state.pop_location()

        return parsed_dict
921691
def update_xml_element(self):
        

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

        self.xml_element.clear()
        self.xml_element.set('id', self.id)

        for child in self.children:
            child.update_xml_element()
            self.xml_element.append(child.xml_element)

        return self.xml_element
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;
  }
1075744
private void processElement(Element element) {
    context.setCurrentSegment(element);
    currentProp = null;
    currentAttribute = null;

    // Process attributes
    boolean shouldPopContext = processElementAttributes(element);

    // Process text segments
    StreamSupport
        .stream(((Iterable<Segment>) element::getNodeIterator).spliterator(), false)
        .filter(segment -> !(segment instanceof Tag)
            && !(segment instanceof CharacterReference))
        .filter(segment -> {
          for (Element child : element.getChildElements()) {
            if (child.encloses(segment)) {
              return false;
            }
          }
          return true;
        })
        .forEach(this::processTextNode);

    // Recurse downwards
    element.getChildElements().
        forEach(this::processElement);

    // After downward recursion, pop the context layer if necessary
    if (shouldPopContext) {
      context.popContextLayer();
    }
  }
1138089
def _normalize_xml_search_response(self, xml):
        
        target = XMLSearchResult()
        parser = ElementTree.XMLParser(target=target)
        parser.feed(xml)
        return parser.close()
1278133
def _requirement_element(self, parent_element, req_data):
        """"""
        req_data = self._transform_result(req_data)
        if not req_data:
            return

        title = req_data.get("title")
        if not title:
            logger.warning("Skipping requirement, title is missing")
            return
        req_id = req_data.get("id")

        if not self._check_lookup_prop(req_id):
            logger.warning(
                "Skipping requirement `%s`, data missing for selected lookup method", title
            )
            return

        attrs, custom_fields = self._classify_data(req_data)
        attrs, custom_fields = self._fill_defaults(attrs, custom_fields)

        # For testing purposes, the order of fields in resulting XML
        # needs to be always the same.
        attrs = OrderedDict(sorted(attrs.items()))
        custom_fields = OrderedDict(sorted(custom_fields.items()))

        requirement = etree.SubElement(parent_element, "requirement", attrs)

        title_el = etree.SubElement(requirement, "title")
        title_el.text = title

        description = req_data.get("description")
        if description:
            description_el = etree.SubElement(requirement, "description")
            description_el.text = description

        self._fill_custom_fields(requirement, custom_fields)
479364
def add_element(self, priority, element, count=None):
        
        if count is None:
            count = next(self.counter)
        entry = [priority, count, element]
        self.element_finder[element] = entry
        heapq.heappush(self.pq, entry)
1172504
def parse(cls, element):
        
        if element.tag != cls.AGENT_TAG:
            raise exceptions.ParseError(
                u"Agent got unexpected tag {}; expected {}".format(
                    element.tag, cls.AGENT_TAG
                )
            )

        role = element.get(u"ROLE")
        if not role:
            raise exceptions.ParseError(u"Agent must have a ROLE attribute.")
        if role == u"OTHER":
            role = element.get(u"OTHERROLE") or role
        agent_type = element.get(u"TYPE")
        if agent_type == u"OTHER":
            agent_type = element.get(u"OTHERTYPE") or agent_type
        agent_id = element.get(u"ID")
        try:
            name = element.find(cls.NAME_TAG).text
        except AttributeError:
            name = None
        notes = [note.text for note in element.findall(cls.NOTE_TAG)]

        return cls(role, id=agent_id, type=agent_type, name=name, notes=notes)
1250892
def _parse_redirect(self, element):
        
        self._log.info('Parsing response as a redirect')
        self.redirect = True
        return self._parse_template(element)
520215
protected
  void parse(Element element) {

    String rootElementName = element.getTagName();

    if (!rootElementName.equals(CONFIGURATION_TAG)) {
      if(rootElementName.equals(OLD_CONFIGURATION_TAG)) {
	LogLog.warn("The <"+OLD_CONFIGURATION_TAG+
		     "> element has been deprecated.");
	LogLog.warn("Use the <"+CONFIGURATION_TAG+"> element instead.");
      } else {
	LogLog.error("DOM element is - not a <"+CONFIGURATION_TAG+"> element.");
	return;
      }
    }

    String debugAttrib = subst(element.getAttribute(INTERNAL_DEBUG_ATTR));
      
    LogLog.debug("debug attribute= \"" + debugAttrib +"\".");
    // if the log4j.dtd is not specified in the XML file, then the
    // "debug" attribute is returned as the empty string.
    if(!debugAttrib.equals("") && !debugAttrib.equals("null")) {      
      LogLog.setInternalDebugging(OptionConverter.toBoolean(debugAttrib, true));
    } else {
      LogLog.debug("Ignoring " + INTERNAL_DEBUG_ATTR + " attribute.");
    }

      //
      //   reset repository before configuration if reset="true"
      //       on configuration element.
      //
    String resetAttrib = subst(element.getAttribute(RESET_ATTR));
    LogLog.debug("reset attribute= \"" + resetAttrib +"\".");
    if(!("".equals(resetAttrib)) &&
         OptionConverter.toBoolean(resetAttrib, false)) {
         repository.resetConfiguration();
    }


    String confDebug = subst(element.getAttribute(CONFIG_DEBUG_ATTR));
    if(!confDebug.equals("") && !confDebug.equals("null")) {      
      LogLog.warn("The \""+CONFIG_DEBUG_ATTR+"\" attribute is deprecated.");
      LogLog.warn("Use the \""+INTERNAL_DEBUG_ATTR+"\" attribute instead.");
      LogLog.setInternalDebugging(OptionConverter.toBoolean(confDebug, true));
    }

    String thresholdStr = subst(element.getAttribute(THRESHOLD_ATTR));
    LogLog.debug("Threshold =\"" + thresholdStr +"\".");
    if(!"".equals(thresholdStr) && !"null".equals(thresholdStr)) {
      repository.setThreshold(thresholdStr);
    }

    //Hashtable appenderBag = new Hashtable(11);

    /* Building Appender objects, placing them in a local namespace
       for future reference */

    // First configure each category factory under the root element.
    // Category factories need to be configured before any of
    // categories they support.
    //
    String   tagName = null;
    Element  currentElement = null;
    Node     currentNode = null;
    NodeList children = element.getChildNodes();
    final int length = children.getLength();

    for (int loop = 0; loop < length; loop++) {
      currentNode = children.item(loop);
      if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
	currentElement = (Element) currentNode;
	tagName = currentElement.getTagName();

	if (tagName.equals(CATEGORY_FACTORY_TAG) || tagName.equals(LOGGER_FACTORY_TAG)) {
	  parseCategoryFactory(currentElement);
	}
      }
    }
    
    for (int loop = 0; loop < length; loop++) {
      currentNode = children.item(loop);
      if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
	currentElement = (Element) currentNode;
	tagName = currentElement.getTagName();

	if (tagName.equals(CATEGORY) || tagName.equals(LOGGER)) {
	  parseCategory(currentElement);
	} else if (tagName.equals(ROOT_TAG)) {
	  parseRoot(currentElement);
	} else if(tagName.equals(RENDERER_TAG)) {
	  parseRenderer(currentElement);
	} else if (!(tagName.equals(APPENDER_TAG)
            || tagName.equals(CATEGORY_FACTORY_TAG)
            || tagName.equals(LOGGER_FACTORY_TAG))) {
        quietParseUnrecognizedElement(repository, currentElement, props);
    }
      }
    }
  }
1066427
def parse_elements(elements):
        
        if not len(elements) in (11, 12):
            raise ValueError('Invalid RMC position data')
        time = datetime.time(*[int(elements[0][i:i + 2])
                               for i in range(0, 6, 2)])
        active = True if elements[1] == 'A' else False
        # Latitude and longitude are checked for validity during Fix
        # instantiation
        latitude = parse_latitude(elements[2], elements[3])
        longitude = parse_longitude(elements[4], elements[5])
        speed = float(elements[6])
        track = float(elements[7])
        date = datetime.date(2000 + int(elements[8][4:6]),
                             int(elements[8][2:4]), int(elements[8][:2]))
        variation = float(elements[9]) if not elements[9] == '' else None
        if elements[10] == 'W':
            variation = -variation
        elif variation and not elements[10] == 'E':
            raise ValueError('Incorrect variation value %r'
                             % elements[10])
        mode = elements[11] if len(elements) == 12 else None
        return Position(time, active, latitude, longitude, speed, track, date,
                        variation, mode)