Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(4)  |  Derive(0)  |  Import(3)
Converts htmlentities to xmlentities

        def html2xmlentities(string):
    """
    Converts htmlentities to xmlentities
    """

    xpr = re.compile('&(\w{1,8});')

    def substitute_entity(match):
        ent = match.group(1)
        if ent in n2cp.keys():
            return '&#%i;' % n2cp[ent]

        else:
            return match.group(0)

    return xpr.subn(substitute_entity, string)[0]
        


src/f/t/ftw.book-2.2.20/ftw/book/table/generator.py   ftw.book(Download)
from ftw.book.table.utils import cleanup_standalone_html_tags
from ftw.pdfgenerator.utils import encode_htmlentities
from ftw.pdfgenerator.utils import html2xmlentities
from ftw.pdfgenerator.utils import xml2htmlentities
from xml.dom import minidom
        html = encode_htmlentities(html.decode('utf-8')).encode('utf-8')
        html = str(BeautifulSoup(html))
        html = html2xmlentities(html)
 
        html = html.replace('&#60;', '<')
                content = content.encode('utf8')
 
            content = html2xmlentities(content)
            contentDoc = TableGenerator._clean_and_parse_html(content)
            contentNode = contentDoc.getElementsByTagName('data')[0]

src/f/t/ftw.pdfgenerator-1.3.0/ftw/pdfgenerator/html2latex/subconverters/table.py   ftw.pdfgenerator(Download)
from ftw.pdfgenerator.html2latex import wrapper
from ftw.pdfgenerator.html2latex.utils import generate_manual_caption
from ftw.pdfgenerator.utils import html2xmlentities
from operator import methodcaller
from xml.dom import minidom
        # minidom hates htmlentities, but loves xmlentities -.-
 
        html = html2xmlentities(html)
 
        # parse DOM

src/f/t/ftw.pdfgenerator-1.3.0/ftw/pdfgenerator/html2latex/subconverters/listing.py   ftw.pdfgenerator(Download)
from BeautifulSoup import BeautifulSoup
from ftw.pdfgenerator.html2latex import subconverter
from ftw.pdfgenerator.utils import html2xmlentities
from xml.dom import minidom
 
        # minidom hates htmlentities, but loves xmlentities -.-
        html = '<dummy>%s</dummy>' % html
        html = html2xmlentities(html)
 
        # parse DOM