read xml object
        :param url: contents url
        :param markup: markup provider
        :param game: MLBAM Game object
        :return: pitchpx.game.players.Players object
13065
def read_xml(cls, url, markup, game):
        
        return Players._read_objects(MlbamUtil.find_xml("".join([url, cls.FILENAME]), markup) ,game)
154039
def _parse(self, stream, context, path):
        """"""
        num_players = context._._._.replay.num_players
        start = stream.tell()
        # Have to read everything to be able to use find()
        read_bytes = stream.read()
        # Try to find the first marker, a portion of the next player structure
        marker_up14 = read_bytes.find(b"\x16\xc6\x00\x00\x00\x21")
        marker_up15 = read_bytes.find(b"\x16\xf0\x00\x00\x00\x21")
        marker = -1
        if marker_up14 > 0 and marker_up15 < 0:
            marker = marker_up14
        elif marker_up15 > 0 and marker_up14 < 0:
            marker = marker_up15
        # If it exists, we're not on the last player yet
        if marker > 0:
            # Backtrack through the player name
            count = 0
            while struct.unpack("<H", read_bytes[marker-2:marker])[0] != count:
                marker -= 1
                count += 1
            # Backtrack through the rest of the next player structure
            backtrack = 43 + num_players
        # Otherwise, this is the last player
        else:
            # Search for the scenario header
            marker = read_bytes.find(b"\xf6\x28\x9c\x3f")
            # Backtrack through the achievements and initial structure footer
            backtrack = ((1817 * (num_players - 1)) + 4 + 19)
        # Seek to the position we found
        end = start + marker - backtrack
        stream.seek(end)
        return end
1056265
def parse_owl_xml(url):
    
    res = download(url)
    owl = OWLParser(content=res.content)
    return owl
145810
def read_xml(cls, url, features, timestamp, game_number):
        
        soup = MlbamUtil.find_xml("".join([url, cls.FILENAME]), features)
        return cls._generate_game_object(soup, timestamp, game_number)
492718
def getItemXML():
    ''' '''
    xml=""
    for item in range(NUM_GOALS):
        x = str(random.randint(old_div(-ARENA_WIDTH,2),old_div(ARENA_WIDTH,2)))
        z = str(random.randint(old_div(-ARENA_BREADTH,2),old_div(ARENA_BREADTH,2)))
        xml += '''<DrawItem x="''' + x + '''" y="210" z="''' + z + '''" type="''' + GOAL_TYPE + '''"/>'''
    return xml
265060
public static XNElement parseXML(URL url) throws IOException, XMLStreamException {
        try (InputStream in = new BufferedInputStream(url.openStream())) {
            return parseXML(in);
        }
    }
877585
public Document readDocument(String url) {
        try {
            URL theURL = new URL(url);
            URLConnection conn = connectWithRedirect(theURL);
            if (conn == null)
                return null;

            ProvFormat format = null;
            String content_type = conn.getContentType();

            logger.debug("Content-type: " + content_type);
            if (content_type != null) {
                // Need to trim optional parameters
                // Content-Type: text/plain; charset=UTF-8
                int end = content_type.indexOf(";");
                if (end < 0) {
                    end = content_type.length();
                }
                String actual_content_type = content_type.substring(0, end)
                        .trim();
                logger.debug("Found Content-type: " + actual_content_type);
                // TODO: might be worth skipping if text/plain as that seems
                // to be the
                // default returned by unconfigured web servers
                format = mimeTypeRevMap.get(actual_content_type);
            }
            logger.debug("Format after Content-type: " + format);

            if (format == null) {
                format = getTypeForFile(theURL.toString());
            }
            logger.debug("Format after extension: " + format);

            InputStream content_stream = conn.getInputStream();

            return readDocument(content_stream, format,url);
        } catch (IOException e) {
            throw new InteropException(e);
        }
    }
66269
def read(url, **kwargs):
    
    response = open_url(url, **kwargs)
    try:
        return response.read()
    finally:
        response.close()
1324877
def request(url, xml):
    
    
    r = _urllib.Request(url, xml)
    r.add_header('Content-Type', 'application/xml')
    r.add_header('User-Agent', 'Clockwork Python wrapper/1.0')
    
    result = {}
    try:
        f = _urllib.urlopen(r)
    except URLError as error:
        raise clockwork_exceptions.HttpException("Error connecting to clockwork server: %s" % error)
    
    result['data'] = f.read()
    result['status'] = f.getcode()
    
    if hasattr(f, 'headers'):
        result['etag'] = f.headers.get('ETag')
        result['lastmodified'] = f.headers.get('Last-Modified')
        if f.headers.get('content−encoding', '') == 'gzip':
            result['data'] = gzip.GzipFile(fileobj=StringIO(result['data'])).read()
        if hasattr(f, 'url'):
            result['url'] = f.url
            result['status'] = 200
    f.close()
    
    if result['status'] != 200:
        raise clockwork_exceptions.HttpException("Error connecting to clockwork server - status code %s" % result['status'])
    
    return result
765302
private List<DummyItem> loadXmlFromNetwork(String urlString) throws IOException {
        String jString;
        // Instantiate the parser
        List<Entry> entries = null;
        List<DummyItem> rtnArray = new ArrayList<DummyItem>();
        BufferedReader streamReader = null;
        try {
            streamReader = new BufferedReader(downloadUrl(urlString));
            StringBuilder responseStrBuilder = new StringBuilder();

            String inputStr;
            while ((inputStr = streamReader.readLine()) != null)
                responseStrBuilder.append(inputStr);
            jString = responseStrBuilder.toString();
            if (jString == null) {
                Log.e(SamplesApplication.TAG, "Nominatim Webpage: request failed for "
                        + urlString);
                return new ArrayList<DummyItem>(0);
            }
            JSONArray jPlaceIds = new JSONArray(jString);
            int n = jPlaceIds.length();
            entries = new ArrayList<Entry>(n);
            for (int i = 0; i < n; i++) {
                JSONObject jPlace = jPlaceIds.getJSONObject(i);
                Entry poi = new Entry(
                        jPlace.optLong("place_id"),
                        jPlace.getString("osm_type"),
                        jPlace.getString("osm_id"),
                        // jPlace.getString("place_rank"),
                        jPlace.getString("boundingbox"),
                        jPlace.getString("lat"),
                        jPlace.getString("lon"),
                        jPlace.getString("display_name"),
                        jPlace.getString("class"),
                        jPlace.getString("type"),
                        jPlace.getString("importance"));
                entries.add(poi);
            }
        } catch (JSONException e) {
            e.printStackTrace();
            return null;
        } finally {
            if (streamReader != null) {
                streamReader.close();
            }
        }

        // StackOverflowXmlParser returns a List (called "entries") of Entry objects.
        // Each Entry object represents a single place in the XML searchresult.
        // This section processes the entries list to create a 'DummyItem' from each entry.
        for (Entry entry : entries) {
            rtnArray.add(
                    new DummyItem(entry.mOsm_id,
                            entry.mDisplay_name.split(",")[0],
                            new LatLong(Double.parseDouble(entry.mLat), Double.parseDouble(entry.mLon)),
                            entry.mDisplay_name));
        }
        return rtnArray;
    }
407653
def get_match(session, match_id):
    """"""
    url = '{}{}/{}'.format(session.auth.base_url, MATCH_URL, match_id)
    parsed = make_scrape_request(session, url)
    game = parsed.find('h3').text
    if game != GAME_AOC:
        raise ValueError('not an aoc match')
    date_played = parsed.find(text=MATCH_DATE_PLAYED).find_next('td').text
    players = []
    colors = {}
    player_count = int(parsed.find('td', text='Players:').find_next('td').text)
    for div in parsed.find_all('div', style=True):
        if not div['style'].startswith('background-color:'):
            continue
        if len(players) == player_count:
            break
        username_elem = div.find_next('a', href=re.compile(PROFILE_PATH))
        username = username_elem.text
        color = div['style'].split(':')[1].split(';')[0].strip()
        colors[username] = color

        rec = None
        for dl_elem in parsed.find_all('a', href=re.compile('^/files/view')):
            rec_name = dl_elem.find('b', text=re.compile(username+'$'))
            if rec_name:
                rec = rec_name.parent

        user = parsed.find('a', text=username)
        if not user:
            # bugged match page
            continue
        user_id = int(user['href'].split('/')[-1])
        children = list(user.find_next('span').children)
        rate_after = None
        rate_before = None
        if str(children[0]).strip() == MATCH_NEW_RATE:
            rate_after = int(children[1].text)
            rate_before = rate_after - int(children[3].text)
        elif str(children[4]).strip() == MATCH_NEW_RATE:
            rate_after = int(children[5].text)
            rate_before = rate_after - int(children[3].text)
        players.append({
            'url': rec['href'] if rec else None,
            'id': user_id,
            'username': username,
            'color_id': COLOR_MAPPING.get(colors[username]),
            'rate_before': rate_before,
            'rate_after': rate_after
        })
    return {
        'timestamp': dateparser.parse(date_played),
        'players': players
    }
673708
def _grabContentFromUrl(self, url):
        
        # Defining an empty object for the response
        info = {}
                
        # This part has to be modified...        
        try:            
            # Configuring the socket
            queryURL = "http://" + self.info["host"] + ":" + self.info["port"] + "/" + url
            response = urllib2.urlopen(queryURL)

            # Rebuilding data to be processed
            data = str(response.headers) + "\n"

            data += response.read()

            # Processing data as expected
            info = self._createDataStructure(data)     
            
        # Try to make the errors clear for other users
        except Exception, e:
            errMsg = "ERROR Exception. Something seems to be wrong with the Zeronet Bundler."   
            raise Exception( errMsg + " " + str(e))        
            
        return info
757685
def find_xml(cls, url, features):
        
        req = cls._get_content(url)
        if req.status_code in range(200, 300):
            return BeautifulSoup(req.text, features)
        else:
            raise MlbAmHttpNotFound('HTTP Error url: {url} status: {status}'.format(url=url, status=req.status_code))
12851
def XmlRawQuery(self, xml, dumpXml=None):
		

		if (dumpXml == None):
			dumpXml = self._dumpXml

		uri = self.Uri() + '/nuova'
		if (dumpXml in _AffirmativeList):
			print '%s ====> %s' % (self._ucs, xml)
		# req = urllib2.Request(url=uri,data=xml)
		# f = urllib2.urlopen(req)
		w = xml.dom.minidom.Document()

		if (self._noSsl):
			req = urllib2.Request(url=uri, data=w.toxml())
			opener = urllib2.build_opener(SmartRedirectHandler())
			f = opener.open(req)
			# print "##", f , "##"

			if type(f) is list:
				if (len(f) == 2 and f[0] == 302):
					# self._noSsl = False
					# uri = self.Uri() + '/nuova'
					uri = f[1]
					req = urllib2.Request(url=uri, data=w.toxml())
					f = urllib2.urlopen(req)
				# print "status code is:",f[0]
				# print "location is:", f[1]
		else:
			req = urllib2.Request(url=uri, data=w.toxml())
			f = urllib2.urlopen(req)

		rsp = f.read()
		if (dumpXml in _AffirmativeList):
			print '%s <==== %s' % (self._ucs, rsp)
		return rsp
250930
def _grabContentFromUrl(self, url):
        
        # Defining an empty object for the response
        response = {}

        # This part has to be modified...        
        try:
            import urllib2

            # Grabbing the data      
            data = urllib2.urlopen(url).read()

            # Processing the data as expectesd
            response = self._createDataStructure(data)        
            
        # Try to make the errors clear for other users
        except Exception, e:
            errMsg = "ERROR. Something happened."   
            raise Exception( errMsg + " " + str(e))
            
        return response
251266
def loadFromStream(self, file, url=None):
        
        reader = self.__readerClass()
        reader.loadDocument(file)
        schema = XMLSchema()
        if url is not None:
             schema.setBaseUrl(url)
        schema.load(reader)
        self.__setIncludes(schema)
        self.__setImports(schema)
        return schema
113015
def get_content(self, url):
        
        cache_path = self._url_to_path(url)
        try:
            with open(cache_path, 'rb') as f:
                return f.read()
        except IOError:
            return None