Пример #1
0
def get_dtd_compiler(fo, mixinmodule=None, doctype=None):
    from xml.parsers.xmlproc.dtdparser import DTDParser
    generator = sourcegen.get_sourcefile(fo)
    dh = DTDConsumerForSourceGeneration(generator, mixinmodule, doctype)
    parser = DTDParser()
    parser.set_dtd_consumer(dh)
    return parser
Пример #2
0
def get_dtd_compiler(fo, mixinmodule=None, doctype=None):
    from xml.parsers.xmlproc.dtdparser import DTDParser
    generator = sourcegen.get_sourcefile(fo)
    dh = DTDConsumerForSourceGeneration(generator, mixinmodule, doctype)
    parser = DTDParser()
    parser.set_dtd_consumer(dh)
    return parser
Пример #3
0
def get_dtd_compiler(fo, mixinmodule=None, toupper=0):
	global sourcegen
	import sourcegen
	from xml.parsers.xmlproc.dtdparser import DTDParser
	generator = sourcegen.get_sourcefile(fo)
	dh = DTDConsumerForSourceGeneration(generator, mixinmodule, toupper)
	parser = DTDParser()
	parser.set_dtd_consumer(dh)
	return parser
Пример #4
0
def get_dtd_compiler(fo, mixinmodule=None, toupper=0):
	global sourcegen
	import sourcegen
	from xml.parsers.xmlproc.dtdparser import DTDParser
	generator = sourcegen.get_sourcefile(fo)
	dh = DTDConsumerForSourceGeneration(generator, mixinmodule, toupper)
	parser = DTDParser()
	parser.set_dtd_consumer(dh)
	return parser
Пример #5
0
def get_dtd_compiler(fo, mixinmodule=None, doctype=None):
    import xml
    if hasattr(xml, "use_pyxml"):  # per Gentoo bug #367729
        xml.use_pyxml()
    from xml.parsers.xmlproc.dtdparser import DTDParser
    generator = sourcegen.get_sourcefile(fo)
    dh = DTDConsumerForSourceGeneration(generator, mixinmodule, doctype)
    parser = DTDParser()
    parser.set_dtd_consumer(dh)
    return parser
Пример #6
0
def get_dtd_compiler(fo, mixinmodule=None, doctype=None):
    import xml
    if hasattr(xml, "use_pyxml"): # per Gentoo bug #367729
        xml.use_pyxml()
    from xml.parsers.xmlproc.dtdparser import DTDParser
    generator = sourcegen.get_sourcefile(fo)
    dh = DTDConsumerForSourceGeneration(generator, mixinmodule, doctype)
    parser = DTDParser()
    parser.set_dtd_consumer(dh)
    return parser
Пример #7
0
def load_dtd(dtd_filename='xhtml1-strict.dtd', dtd_root_elem='html'):
    dtd_parser = DTDParser()
    dtd_parser.set_error_handler(ErrorRaiser(dtd_parser))
    dtd = xmldtd.CompleteDTD(dtd_parser)
    dtd_parser.set_dtd_consumer(dtd)
    dtd_parser.parse_resource(dtd_filename)
    dtd.root_elem = dtd_root_elem
    return dtd
Пример #8
0
def load_dtd(dtd_filename='xhtml1-strict.dtd', dtd_root_elem='html'):
    dtd_parser = DTDParser()
    dtd_parser.set_error_handler(ErrorRaiser(dtd_parser))
    dtd = xmldtd.CompleteDTD(dtd_parser)
    dtd_parser.set_dtd_consumer(dtd)
    dtd_parser.parse_resource(dtd_filename)
    dtd.root_elem = dtd_root_elem
    return dtd
Пример #9
0
 def __init__ (self):
     DTDParser.__init__ (self)
     self.set_dtd_consumer (self)
Пример #10
0
    def dtd_start(self):
        pass
    def handle_comment(self, contents):
        pass
    def handle_pi(self, target, data):
        pass
    def new_attribute(self, elem, attr, a_type, a_decl, a_def):
        pass
    def new_element_type(self, elem_name, elem_cont):
        pass
    def new_external_entity(self, ent_name, pub_id, sys_id, ndata):
        pass
    def new_general_entity(self, name, val):
        pass
    def new_notation(self, name, pubid, sysid):
        pass


if __name__ == '__main__':
    import sys

    dh = DTDHandler()

    parser = DTDParser()
    parser.set_dtd_consumer(dh)
    print parser.feed(open('docutils.dtd').read())
    print parser
    print parser.flush()
    print parser