The RCSB website now compresses XML files.
972463
def retrieve_xml(pdb_id, silent = True):
    ''''''
    xml_gz = retrieve_file_from_RCSB(get_rcsb_files_connection(), "/download/%s.xml.gz" % pdb_id, silent = silent)
    cf = StringIO.StringIO()
    cf.write(xml_gz)
    cf.seek(0)
    df = gzip.GzipFile(fileobj = cf, mode='rb')
    contents = df.read()
    df.close()
    return contents
228912
private function createRSS()
    {
        $file = fopen($this->rssFile, "w+");

        $stmt = $this->db->prepare('SELECT * FROM ' . $this->table . ' ORDER BY CREATED DESC LIMIT ?');
        $stmt->execute([$this->newsCount]);
        $res = $stmt->fetchAll();

        $xmlVersion = '<?xml version="1.0" encoding="UTF-8" ?>';

        $startString = <<<EOD
{$xmlVersion}
<rss version="2.0">
<channel>
    <title>{$this->feedDescription['title']}</title>
    <link>{$this->feedDescription['link']}</link>
    <description>{$this->feedDescription['description']}</description>
EOD;
        fwrite($file, $startString);

        foreach ($res as $post) {
            $date = date("D, d M y H:i:s O", strtotime($post->CREATED));
            $string = <<<EOD

    <item>
        <title>{$post->TITLE}</title>
        <link>{$post->LINK}</link>
        <description>{$post->DESCRIPTION}</description>
        <pubDate>{$date}</pubDate>
    </item>
EOD;
            fwrite($file, $string);
        }

        fwrite($file, '
</channel>
</rss>');
    }
188447
def retrieve_file_from_RCSB(http_connection, resource, silent = True):
    ''''''
    if not silent:
        colortext.printf("Retrieving %s from RCSB" % os.path.split(resource)[1], color = "aqua")
    return http_connection.get(resource)
414157
def report_xml():
    
    arguments = docopt.docopt(report_xml.__doc__, version='cr-rate 1.0')
    with use_db(arguments['<session-file>'], WorkDB.Mode.open) as db:
        xml_elem = _create_xml_report(db)
        xml_elem.write(
            sys.stdout.buffer, encoding='utf-8', xml_declaration=True)
262635
function zipSVG(libs, svgContent, src) {
    svgContent = svgContent
    // Remove space between two tags.
        .replace(/>[ \t\n\r]+</g, '><')
    // Replace double quotes with single quotes.
        .replace(/"/g, "'")
    // Replace many spaces by one single space.
        .replace(/[ \t\n\r]+/g, ' ');

    var svgTree = libs.parseHTML(svgContent);
    // We want to remove unused `id`attributes.
    // Such an attribute is used as long as there is a `xlink:href` attribute referencing it.
    var idsToKeep = {};
    // Remove Inkscape tags and <image>.
    libs.Tree.walk(svgTree, function(node) {
        if (node.type !== libs.Tree.TAG) return;
        var name = node.name.toLowerCase();
        if (name == 'flowroot') {
            libs.warning(
                "Please don't use <flowRoot> nor <flowRegion> in your SVG (\"" + src + "\")!\n"
                    + "If it was created with Inkscape, convert it in SVG 1.1 by opening the `Text` menu\n"
                    + "and selecting \"Convert to Text\".",
                src,
                svgContent,
                node.pos
            );
        }
        var nodeToDelete = startsWith(
            name,
            "metadata", "inkscape:", "sodipodi:", "image", "dc:", "cc:", "rdf:",
            "flowroot", "flowregion"
        );
        if (nodeToDelete) {
            node.type = libs.Tree.VOID;
            delete node.children;
        } else if (node.attribs) {
            var attribsToDelete = [];
            var attribName, attribValue;
            for (attribName in node.attribs) {
                if (
                    startsWith(
                        attribName,
                        'inkscape:', 'sodipodi:', 'xmlns:inkscape', 'xmlns:sodipodi',
                        'xmlns:dc', 'xmlns:cc', 'xmlns:rdf'
                    )
                ) {
                    // This is an attribute to delete.
                    attribsToDelete.push(attribName);
                } else {
                    // Look for references (`xlink:href`).
                    attribValue = node.attribs[attribName].trim();
                    if (attribName.toLowerCase() == 'xlink:href') {
                        if (attribValue.charAt(0) == '#') {
                            // Remember that this ID must not be deleted.
                            idsToKeep[attribValue.substr(1)] = 1;
                        }
                    } else {
                        // Look for local URLs: `url(#idToKeep)`.
                        var match;
                        while ((match = RX_LOCAL_URL.exec(attribValue))) {
                            idsToKeep[match[1]] = 1;
                        }
                    }
                }
            }
            attribsToDelete.forEach(function (attribName) {
                delete node.attribs[attribName];
            });
        }
    });

    // Removing emtpy <g> and <defs>.
    libs.Tree.walk(svgTree, function(node) {
        if (node.type != libs.Tree.TAG) return;
        var name = node.name.toLowerCase();
        if (node.attribs && node.attribs.id) {
            // Try to remove unused ID.
            if (!idsToKeep[node.attribs.id]) {
                delete node.attribs.id;
            }
        }
        if (['g', 'defs'].indexOf(name) > -1) {
            // If this tag has no child, we must delete it.
            var childrenCount = 0;
            (node.children || []).forEach(function (child) {
                if (child.type == libs.Tree.TEXT || child.type == libs.Tree.TAG) {
                    childrenCount++;
                }
            });
            if (childrenCount == 0) {
                // This tag is empty, remove it.
                delete node.children;
                node.type = libs.Tree.VOID;
            }
        }
    });

    var svg = libs.Tree.toString(svgTree);
    return svg;
    // The following code was used when we embeded the SVG in Data URI form.
    /*
     console.log(svg);
     console.log();
     console.log("Base64: " + (new Buffer(svg)).toString('base64').length);
     console.log("UTF-8:  " + encodeURIComponent(svg).length);
     console.log();
     var encodedSVG_base64 = (new Buffer(svg)).toString('base64');
     var encodedSVG_utf8 = encodeURIComponent(svg);
     if (encodedSVG_base64 < encodedSVG_utf8) {
     return '"data:image/svg+xml;base64,' + encodedSVG_base64 + '"';
     } else {
     return '"data:image/svg+xml;utf8,' + encodedSVG_utf8 + '"';
     }
     */
}
885001
public void appendToFsb(org.apache.xml.utils.FastStringBuffer fsb)
  {
    XString xstring = (XString)xstr();
    xstring.appendToFsb(fsb);
  }
842582
public void compress ()
    {
        for (Iterator<int[]> itr = values().iterator(); itr.hasNext(); ) {
            if (itr.next()[0] == 0) {
                itr.remove();
            }
        }
    }
422557
def _tls_decompress(self, s):
        
        alg = self.tls_session.rcs.compression
        return alg.decompress(s)
463673
def _compress_content(self, content):
        """"""
        zbuf = StringIO()
        zfile = GzipFile(mode='wb', compresslevel=6, fileobj=zbuf)
        zfile.write(content.read())
        zfile.close()
        content.file = zbuf
        return content
715012
function(xml) {
    var contexp, fn, formatted, indent, l, lastType, len, lines, ln, pad, reg, transitions, wsexp;
    reg = /(>)(<)(\/*)/g;
    wsexp = /[ ]*(.*)[ ]+\n/g;
    contexp = /(<.+>)(.+\n)/g;
    xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
    pad = 0;
    formatted = '';
    lines = xml.split('\n');
    indent = 0;
    lastType = 'other';
    transitions = {
      'single->single': 0,
      'single->closing': -1,
      'single->opening': 0,
      'single->other': 0,
      'closing->single': 0,
      'closing->closing': -1,
      'closing->opening': 0,
      'closing->other': 0,
      'opening->single': 1,
      'opening->closing': 0,
      'opening->opening': 1,
      'opening->other': 1,
      'other->single': 0,
      'other->closing': -1,
      'other->opening': 0,
      'other->other': 0
    };
    fn = function(ln) {
      var fromTo, j, key, padding, type, types, value;
      types = {
        single: Boolean(ln.match(/<.+\/>/)),
        closing: Boolean(ln.match(/<\/.+>/)),
        opening: Boolean(ln.match(/<[^!?].*>/))
      };
      type = ((function() {
        var results;
        results = [];
        for (key in types) {
          value = types[key];
          if (value) {
            results.push(key);
          }
        }
        return results;
      })())[0];
      type = type === void 0 ? 'other' : type;
      fromTo = lastType + '->' + type;
      lastType = type;
      padding = '';
      indent += transitions[fromTo];
      padding = ((function() {
        var m, ref1, results;
        results = [];
        for (j = m = 0, ref1 = indent; 0 <= ref1 ? m < ref1 : m > ref1; j = 0 <= ref1 ? ++m : --m) {
          results.push('  ');
        }
        return results;
      })()).join('');
      if (fromTo === 'opening->closing') {
        formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
      } else {
        formatted += padding + ln + '\n';
      }
    };
    for (l = 0, len = lines.length; l < len; l++) {
      ln = lines[l];
      fn(ln);
    }
    return formatted;
  }
391548
def compress_message(data_to_compress):
    
    compressed_content = cms.ParsableOctetString(
        zlib.compress(data_to_compress))
    return cms.ContentInfo({
        'content_type': cms.ContentType('compressed_data'),
        'content': cms.CompressedData({
            'version': cms.CMSVersion('v0'),
            'compression_algorithm':
                cms.CompressionAlgorithm({
                    'algorithm': cms.CompressionAlgorithmId('zlib')
                }),
            'encap_content_info': cms.EncapsulatedContentInfo({
                'content_type': cms.ContentType('data'),
                'content': compressed_content
            })
        })
    }).dump()
668020
def _insert_compressed(
        collection_name, docs, check_keys, continue_on_error, opts, ctx):
    """"""
    op_insert, max_bson_size = _insert(
        collection_name, docs, check_keys, continue_on_error, opts)
    rid, msg = _compress(2002, op_insert, ctx)
    return rid, msg, max_bson_size
590025
def XML(uri, tc, ps, **keywords):
    '''
    '''
    source = urllib.urlopen(uri, **keywords)
    enc = source.info().getencoding()
    if enc in ['7bit', '8bit', 'binary']:
        data = source
    else:
        data = StringIO.StringIO()
        mimetools.decode(source, data, enc)
        data.seek(0)
    dom = ps.readerclass().fromStream(data)
    return _child_elements(dom)[0]
670797
def saveFormatFileTo(self, buf, encoding, format):
        
        if buf is None: buf__o = None
        else: buf__o = buf._o
        ret = libxml2mod.xmlSaveFormatFileTo(buf__o, self._o, encoding, format)
        return ret
1105406
function _storeXMLModifications() {
			if (bHasLocalStorage) {
				localStorage.setItem("sap-ui-support.aSupportXMLModifications/" + document.location.href, JSON.stringify(aSupportXMLModifications));
			}
		}
953708
def dump(self, filename=None, compressed=True, pretty=True):
        ''''''
        content = self.server.jsonrpc.dumpWindowHierarchy(compressed, None)
        if filename:
            with open(filename, "wb") as f:
                f.write(content.encode("utf-8"))
        if pretty and "\n " not in content:
            xml_text = xml.dom.minidom.parseString(content.encode("utf-8"))
            content = U(xml_text.toprettyxml(indent='  '))
        return content
151596
public function asXML()
    {
        $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item></item>',
            LIBXML_NOERROR | LIBXML_ERR_NONE | LIBXML_ERR_FATAL);
        $xml->addChild('title', $this->title);
        $xml->addChild('link', $this->url);
        if ($this->pubDate !== null) {
            $xml->addChild('pubDate', date(DATE_RSS, $this->pubDate));
        }

        if ($this->creator) {
            $xml->addChildCData("xmlns:dc:creator", $this->creator);
        }
        if ($this->guid) {
            $guid = $xml->addChild('guid', $this->guid);

            if ($this->isPermalink === false) {
                $guid->addAttribute('isPermaLink', 'false');
            }
        }

        foreach ($this->categories as $category) {
            $element = $xml->addChild('category', $category[0]);

            if (isset($category[1])) {
                $element->addAttribute('domain', $category[1]);
            }
        }

        $xml->addChild('description', $this->description);
        if(strlen(trim($this->content)) > 0) {
            $xml->addChildCData('xmlns:content:encoded', $this->content);
        }

        if (is_array($this->enclosure) && (count($this->enclosure) == 3)) {
            $element = $xml->addChild('enclosure');
            $element->addAttribute('url', $this->enclosure['url']);
            $element->addAttribute('type', $this->enclosure['type']);

            if ($this->enclosure['length']) {
                $element->addAttribute('length', $this->enclosure['length']);
            }
        }

        return $xml;
    }