Bytes representation of the XML content.
        (`learn more <http://www.diveintopython3.net/strings.html>`_).
329369
def raw_xml(self) -> _RawXML:
        
        if self._xml:
            return self._xml
        else:
            return etree.tostring(self.element, encoding='unicode').strip().encode(self.encoding)
1029842
def html(self, unicode=False):
        
        html = lxml.html.tostring(self.element, encoding=self.encoding)
        if unicode:
            html = html.decode(self.encoding)
        return html
1145557
def _xml_to_dict(xml):
    '''
    
    '''
    dicts = {}
    for item in xml:
        key = item.tag.lower()
        idx = 1
        while key in dicts:
            key += six.text_type(idx)
            idx += 1
        if item.text is None:
            dicts[key] = _xml_to_dict(item)
        else:
            dicts[key] = item.text

    return dicts
808858
def bytes_to_str(self, b):
        ""
        if PYTHON_MAJOR_VER == 3:
            return b.decode(charset_map.get(self.charset, self.charset))
        return b
1076908
def pretty_xml(string_input, add_ns=False):
    
    if add_ns:
        elem = "<foo "
        for key, value in DOC_CONTENT_ATTRIB.items():
            elem += ' %s="%s"' % (key, value)
        string_input = elem + ">" + string_input + "</foo>"
    doc = minidom.parseString(string_input)
    if add_ns:
        s1 = doc.childNodes[0].childNodes[0].toprettyxml("  ")
    else:
        s1 = doc.toprettyxml("  ")
    return s1
444650
def to_string(x):
    
    if isinstance(x, bytes):
        return x.decode('utf-8')
    if isinstance(x, basestring):
        return x
244058
def get_xml(self):
        
        with io.StringIO() as string:
            string.write(ET.tostring(self.root, encoding="unicode"))
            return string.getvalue()
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]
678023
def to_bytes(s):
    
    if sys.version_info < (3,):
        return "".join(map(chr, s))
    else:
        return bytes(s)
614546
def content(self, name, attrs=None, characters=None):
    
    with self.no_inner_space(outer=True):
      with self.element(name, attrs):
        if characters:
          self.characters(characters)
764316
def xml_to_str(tree, encoding=None, xml_declaration=False):
    """"""
    if xml_declaration and not encoding:
        raise ValueError("'xml_declaration' is not supported when 'encoding' is None")
    if encoding:
        return tostring(tree, encoding=encoding, xml_declaration=True)
    return tostring(tree, encoding=text_type, xml_declaration=False)
313343
def to_xml_string(self):
        

        self.update_xml_element()
        xml = self.xml_element

        return etree.tostring(xml, pretty_print=True).decode('utf-8')
369106
def byte_str(s="", encoding="utf-8", input_encoding="utf-8", errors="strict"):
    
    assert isinstance(s, basestring)
    if isinstance(s, unicode):
        return s.encode(encoding, errors)
    if s and encoding != input_encoding:
        return s.decode(input_encoding, errors).encode(encoding, errors)
    return s
1335374
def to_xml_string(str="")
      str << ('<c:' << tag_name.to_s << '>')
      if @f
        str << ('<c:' << @ref_tag_name.to_s << '>')
        str << ('<c:f>' << @f.to_s << '</c:f>')
      end
      @data.to_xml_string str
      if @f
        str << ('</c:' << @ref_tag_name.to_s << '>')
      end
      str << ('</c:' << tag_name.to_s << '>')
    end
196530
public static String encodeXMLContent(final String content) {
		StringBuffer encoded = new StringBuffer(content);
		
		replaceAll(encoded,"&","&amp;");
		replaceAll(encoded,"\"","&quot;");
		replaceAll(encoded,"'","&apos;");
		replaceAll(encoded,"<","&lt;");
		replaceAll(encoded,">","&gt;");
		
		return encoded.toString();
	}
604908
def toString(self):
        
        xprofile = self.toXml()
        projex.text.xmlindent(xprofile)
        return ElementTree.tostring(xprofile)
28805
def data_to_bytes(self, data_element, encoding=None):
        
        if encoding is None:
            encoding = self.encoding
        text = self.data_to_string(data_element)
        return bytes_(text, encoding=encoding)