/* method:	processEmbedRaw
usage:	processEmbedRaw(string embedRaw);
params:	embedRaw = raw embed xml data retrieved from hulu

This method process the raw embed xml data.

returns: array of data from emed xml data
961327
public function processEmbedRaw($embedRaw)
		{

			$doc = new DOMDocument('1.0','utf-8');
			$doc->loadXML($embedRaw);

			$return['type'] 					= $doc->getElementsByTagName('type')->item(0)->nodeValue;
			$return['title'] 					= $doc->getElementsByTagName('title')->item(0)->nodeValue;
			$return['air_date'] 				= $doc->getElementsByTagName('air_date')->item(0)->nodeValue;
			$return['duration'] 				= $doc->getElementsByTagName('duration')->item(0)->nodeValue;
			$return['author_name'] 				= $doc->getElementsByTagName('author_name')->item(0)->nodeValue;
			$return['provider_name'] 			= $doc->getElementsByTagName('provider_name')->item(0)->nodeValue;
			$return['provider_url'] 			= $doc->getElementsByTagName('provider_url')->item(0)->nodeValue;
			$return['embed_url'] 				= $doc->getElementsByTagName('embed_url')->item(0)->nodeValue;
			$return['html'] 					= $doc->getElementsByTagName('html')->item(0)->nodeValue;
			$return['width'] 					= $doc->getElementsByTagName('width')->item(0)->nodeValue;
			$return['height'] 					= $doc->getElementsByTagName('height')->item(0)->nodeValue;
			$return['thumbnail_url'] 			= $doc->getElementsByTagName('thumbnail_url')->item(0)->nodeValue;
			$return['thumbnail_width'] 			= $doc->getElementsByTagName('thumbnail_width')->item(0)->nodeValue;
			$return['thumbnail_height'] 		= $doc->getElementsByTagName('thumbnail_height')->item(0)->nodeValue;
			$return['large_thumbnail_url'] 		= $doc->getElementsByTagName('large_thumbnail_url')->item(0)->nodeValue;
			$return['large_thumbnail_width'] 	= $doc->getElementsByTagName('large_thumbnail_width')->item(0)->nodeValue;
			$return['large_thumbnail_height'] 	= $doc->getElementsByTagName('large_thumbnail_height')->item(0)->nodeValue;
			$return['cache_age'] 				= $doc->getElementsByTagName('cache_age')->item(0)->nodeValue;
			$return['version'] 					= $doc->getElementsByTagName('version')->item(0)->nodeValue;

			$doc = null;

			return $return;
		}
127056
def process_xml(self, xml):
        '''
        
        '''
        try:
            root = objectify.fromstring(xml)
            # Get message idenifier from header info
            self.message_identifier = root.imsx_POXHeader.\
                imsx_POXResponseHeaderInfo.\
                imsx_messageIdentifier

            status_node = root.imsx_POXHeader.\
                imsx_POXResponseHeaderInfo.\
                imsx_statusInfo

            # Get status parameters from header info status
            self.code_major = status_node.imsx_codeMajor
            self.severity = status_node.imsx_severity
            self.description = status_node.imsx_description
            self.message_ref_identifier = str(
                status_node.imsx_messageRefIdentifier)
            self.operation = status_node.imsx_operationRefIdentifier

            try:
                # Try to get the score
                self.score = str(root.imsx_POXBody.readResultResponse.
                                 result.resultScore.textString)
            except AttributeError:
                # Not a readResult, just ignore!
                pass
        except:
            pass
1075012
def parse(self, stream, media_type=None, parser_context=None):
        
        assert etree, 'XMLParser requires defusedxml to be installed'

        parser_context = parser_context or {}
        encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)
        parser = etree.DefusedXMLParser(encoding=encoding)
        try:
            tree = etree.parse(stream, parser=parser, forbid_dtd=True)
        except (etree.ParseError, ValueError) as exc:
            raise ParseError('XML parse error - %s' % six.text_type(exc))
        data = self._xml_convert(tree.getroot())

        return data
17622
function process(content, encoding, attrs, node) {
    if (typeof content === 'undefined') {
      console.error(
        colors.red('process() : Undefined "content" parameters.')
      );
      return '';
    }
    if (!encoding || encoding === 'original') {
      return content;
    }
    var items = encoding.split(/\s*,\s*/);
    if (items.length > 1) {
      items.forEach(function (item) {
        content = process(content, item, attrs, node);
      });
      return content;
    }
    var processor = getProcessor(encoding);
    if (!processor) {
      console.error(
        colors.red('The "%s" processor does not exist.'), encoding
      );
      return content;
    }
    return processor(content, attrs, instance, node);
  }
892383
private void processEmbeddedField(Field field) {
    // First create EmbeddedField so we can maintain the path/depth of the
    // embedded field
    EmbeddedField embeddedField = new EmbeddedField(field);
    // Introspect the embedded field.
    EmbeddedMetadata embeddedMetadata = EmbeddedIntrospector.introspect(embeddedField,
        entityMetadata);
    entityMetadata.putEmbeddedMetadata(embeddedMetadata);
  }
1339145
def get_data(self):
        
        # NOTE: we assume that the "embed" option is used
        base64_data = self._json_data.get("fdData")
        if base64_data is None:
            return None
        else:
            # need to convert to bytes() with python 3
            return base64.decodestring(six.b(base64_data))
109528
def process_raw_data(cls, raw_data):
        """"""
        raw_main = raw_data.get("mainMode", None)
        if raw_main is not None:
            main_mode = MainMode.from_raw_data(raw_main)
            raw_data["mainMode"] = main_mode

        raw_quick = raw_data.get("quickMode", None)
        if raw_quick is not None:
            quick_mode = QuickMode.from_raw_data(raw_quick)
            raw_data["quickMode"] = quick_mode

        local_vpn_ts = []
        for raw_local_vpn in raw_data.get("localVpnTrafficSelector", []):
            local_vpn_ts.append(LocalVpnTrafficSelector.from_raw_data(
                raw_local_vpn))
        raw_data["localVpnTrafficSelector"] = local_vpn_ts

        remote_vpn_ts = []
        for raw_remote_vpn in raw_data.get("remoteVpnTrafficSelector", []):
            remote_vpn_ts.append(RemoteVpnTrafficSelector.from_raw_data(
                raw_remote_vpn))
        raw_data["remoteVpnTrafficSelector"] = remote_vpn_ts

        return super(IPSecConfiguration, cls).process_raw_data(raw_data)
323535
def get(self, url, params=None):
        ''
        url = self.escapeUrl(url)

        content = six.BytesIO(self.raw(url, params=params))
        # We need to make sure that the xml fits in available memory before we parse
        # with lxml.objectify.fromstring(), or else it will bomb out.
        # If it is too big, we need to buffer it to disk before we run it through objectify. see #87
        #
        # get length of buffer
        content.seek(0,2)
        contentlen = content.tell()
        content.seek(0)

        MAX_BUFFER_SIZE=1024*1024*200 # 200MB. TODO: find a way to compute this
        if contentlen > MAX_BUFFER_SIZE:
            # xml is too big to parse with lxml.objectify.fromstring()
            contentfile = tempfile.NamedTemporaryFile()
            contentfile.write(content.read())
            o = lxml.objectify.parse(contentfile)
        else:
            o = lxml.objectify.fromstring(content.getvalue())
        if o.tag == 'error':
            JFSError.raiseError(o, url)
        return o
865545
def to_array(self):
        
        array = super(InlineQueryResultCachedVideo, self).to_array()
        array['type'] = u(self.type)  # py2: type unicode, py3: type str

        array['id'] = u(self.id)  # py2: type unicode, py3: type str

        array['video_file_id'] = u(self.video_file_id)  # py2: type unicode, py3: type str

        array['title'] = u(self.title)  # py2: type unicode, py3: type str

        if self.description is not None:
            array['description'] = u(self.description)  # py2: type unicode, py3: type str

        if self.caption is not None:
            array['caption'] = u(self.caption)  # py2: type unicode, py3: type str

        if self.parse_mode is not None:
            array['parse_mode'] = u(self.parse_mode)  # py2: type unicode, py3: type str

        if self.reply_markup is not None:
            array['reply_markup'] = self.reply_markup.to_array()  # type InlineKeyboardMarkup

        if self.input_message_content is not None:
            array['input_message_content'] = self.input_message_content.to_array()  # type InputMessageContent

        return array
748974
public function processResponse()
    {
        // Merge the response packets
        $xmlString = implode('', $this->packets_response);

        // Check to make sure this is will decode into a valid XML Document
        if (($xmlDoc = @simplexml_load_string($xmlString)) === false) {
            throw new Exception(__METHOD__ . " Unable to load XML string.");
        }

        // Set the result to a new result instance
        $result = new Result();

        // All servers are dedicated as far as I can tell
        $result->add('dedicated', 1);

        // Iterate over the info
        foreach (['serverinfo', 'owner', 'map', 'npcs', 'monsters', 'players'] as $property) {
            foreach ($xmlDoc->{$property}->attributes() as $key => $value) {
                if (!in_array($property, ['serverinfo'])) {
                    $key = $property . '_' . $key;
                }

                // Add the result
                $result->add($key, (string)$value);
            }
        }

        $result->add("motd", (string)$xmlDoc->motd);

        unset($xmlDoc, $xmlDoc);

        return $result->fetch();
    }
1174145
async def parseResults(self, api_data):
    
    results = []

    # parse page
    parser = lxml.etree.HTMLParser()
    html = lxml.etree.XML(api_data.decode("utf-8"), parser)

    for page_struct_version, result_selector in enumerate(__class__.RESULTS_SELECTORS):
      result_nodes = result_selector(html)
      if result_nodes:
        break

    for rank, result_node in enumerate(result_nodes, 1):
      # get thumbnail & full image url
      img_node = __class__.IMG_SELECTORS[page_struct_version](result_node)[0]
      thumbnail_url = img_node.get("src")
      thumbnail_url = thumbnail_url.replace("Stripe-Prime-Only", "")
      url_parts = thumbnail_url.rsplit(".", 2)
      img_url = ".".join((url_parts[0], url_parts[2]))

      # assume size is fixed
      size = (500, 500)

      # try to get higher res image...
      if self.target_size > size[0]:  # ...but only if needed
        self.logger.debug("Looking for optimal subimages configuration...")
        product_url = __class__.LINK_SELECTOR(result_node)[0].get("href")
        product_url = urllib.parse.urlsplit(product_url)
        product_id = product_url.path.split("/")[3]

        # TODO don't pick up highest res image if user asked less?
        for amazon_img_format in AMAZON_DIGITAL_IMAGE_FORMATS:
          # TODO review this, it seem to always fail now
          self.logger.debug("Trying %u subimages..." % (amazon_img_format.slice_count ** 2))
          urls = tuple(self.generateImgUrls(product_id,
                                            __class__.DYNAPI_KEY,
                                            amazon_img_format.id,
                                            amazon_img_format.slice_count))
          url_ok = await self.probeUrl(urls[-1])
          if not url_ok:
            # images at this size are not available
            continue

          # images at this size are available
          img_url = urls
          size = (amazon_img_format.total_res,) * 2
          break

      # assume format is always jpg
      format = CoverImageFormat.JPEG

      # add result
      results.append(AmazonDigitalCoverSourceResult(img_url,
                                                    size,
                                                    format,
                                                    thumbnail_url=thumbnail_url,
                                                    source=self,
                                                    rank=rank,
                                                    check_metadata=CoverImageMetadata.SIZE))

    return results
160503
def process_document(self, doc):
        

        raw = doc.select_segments("$.raw_content")[0]

        doc.store(doc.extract(self.content_extractor, raw, strategy=Strategy.ALL_TEXT), "etk2_text")
        doc.store(doc.extract(self.content_extractor, raw, strategy=Strategy.MAIN_CONTENT_STRICT),
                              "etk2_content_strict")
        doc.store(doc.extract(self.content_extractor, raw, strategy=Strategy.MAIN_CONTENT_RELAXED),
                              "etk2_content_relaxed")
        doc.store(doc.extract(self.metadata_extractor,
                              raw,
                              extract_title=True,
                              extract_meta=True,
                              extract_microdata=True,
                              extract_rdfa=True,
                              ), "etk2_metadata")
        return list()
1354997
def cache_embed_data
      data = JSON.parse(API::Server.embed(@bot.token, @id))
      @embed_enabled = data['enabled']
      @embed_channel_id = data['channel_id']
    end
361138
def parseURIRaw(str, raw):
    
    ret = libxml2mod.xmlParseURIRaw(str, raw)
    if ret is None:raise uriError('xmlParseURIRaw() failed')
    return URI(_obj=ret)
1364407
def decode(data):
    
    dom = None
    try:
        dom = dhtmlparser.parseString(data)
    except Exception, e:
        raise MetaParsingException("Can't parse your XML data: %s" % e.message)

    root = dom.find("root")

    # check whether there is <root>s
    if not root:
        raise MetaParsingException("All elements have to be inside <root>.")

    # and make sure, that there is not too many <root>s
    if len(root) > 1:
        raise MetaParsingException("Too many <root> elements in your XML!")

    items = root[0].find("item")

    # check for items
    if not items:
        raise MetaParsingException("There are no <items> in your XML <root>!")

    decoded = []
    for item in items:
        if "key" not in item.params:
            raise MetaParsingException(
                "There is no 'key' parameter in %s." % str(item)
            )

        decoded.append([
            item.params["key"],
            item.getContent().strip()
        ])

    decoded = validator.check_structure(decoded)

    return decoded
297188
def process_nested_tags(self, node, tag = ''):
        
        ##print("---------Processing: %s, %s"%(node.tag,tag))

        if tag == '':
            t = node.ltag
        else:
            t = tag.lower()
        
        for child in node.children:
            self.xml_node_stack = [child] + self.xml_node_stack

            ctagl = child.ltag

            if ctagl in self.tag_parse_table and ctagl in self.valid_children[t]:
                #print("Processing known type: %s"%ctagl)
                self.tag_parse_table[ctagl](child)
            else:
                #print("Processing unknown type: %s"%ctagl)
                self.parse_component_by_typename(child, child.tag)

            self.xml_node_stack = self.xml_node_stack[1:]
1196705
def process_xml(self, xml):
        '''
        
        '''
        root = objectify.fromstring(xml)
        self.message_identifier = str(
            root.imsx_POXHeader.imsx_POXRequestHeaderInfo.
            imsx_messageIdentifier)
        try:
            result = root.imsx_POXBody.replaceResultRequest
            self.operation = REPLACE_REQUEST
            # Get result sourced id from resultRecord
            self.lis_result_sourcedid = result.resultRecord.\
                sourcedGUID.sourcedId
            self.score = str(result.resultRecord.result.
                             resultScore.textString)
        except:
            pass

        try:
            result = root.imsx_POXBody.deleteResultRequest
            self.operation = DELETE_REQUEST
            # Get result sourced id from resultRecord
            self.lis_result_sourcedid = result.resultRecord.\
                sourcedGUID.sourcedId
        except:
            pass

        try:
            result = root.imsx_POXBody.readResultRequest
            self.operation = READ_REQUEST
            # Get result sourced id from resultRecord
            self.lis_result_sourcedid = result.resultRecord.\
                sourcedGUID.sourcedId
        except:
            pass