Exemplo n.º 1
0
 def fromSax(cls, input, sax_parser):
     "Build a MathDOM from input using sax_parser."
     dom_builder = Reader(parser=sax_parser)
     return cls( dom_builder.fromString(input) )
Exemplo n.º 2
0
if __name__ == '__main__':
    from xml.dom.ext import StripXml, PrettyPrint
    from xml.dom.ext.reader.Sax2 import Reader
    import sys
    reader = Reader()
    file = open(sys.argv[1],'r')
    fragment = reader.fromStream(file)
    d = StripXml(fragment)
    file.close()
    tree = tree_from_dom(d)
    file = open(sys.argv[2],'r')
    fragment = reader.fromStream(file)
    d = StripXml(fragment)
    file.close()
    tree2 = tree_from_dom(d)
    from objects import repr
    print 'Source tree', repr(tree)
    print 'Destination tree', repr(tree2)
    #from ezs import EzsCorrector
    #strategy = EzsCorrector()
    from fmes import FmesCorrector
    strategy = FmesCorrector(0.59, 0.5)
    #from ezs import process
    actions = strategy.process_trees(tree, tree2)
    from format import xupdate_dom
    PrettyPrint(
        xupdate_dom(
        reader.fromString('<root/>'),
        actions))
Exemplo n.º 3
0
 def fromSax(cls, input, sax_parser):
     "Build a MathDOM from input using sax_parser."
     dom_builder = Reader(parser=sax_parser)
     return cls(dom_builder.fromString(input))
Exemplo n.º 4
0
    parser.parse(root)
    return handler.get_tree()


if __name__ == '__main__':
    from xml.dom.ext import StripXml, PrettyPrint
    from xml.dom.ext.reader.Sax2 import Reader
    import sys
    reader = Reader()
    file = open(sys.argv[1], 'r')
    fragment = reader.fromStream(file)
    d = StripXml(fragment)
    file.close()
    tree = tree_from_dom(d)
    file = open(sys.argv[2], 'r')
    fragment = reader.fromStream(file)
    d = StripXml(fragment)
    file.close()
    tree2 = tree_from_dom(d)
    from xmldiff.objects import repr
    print 'Source tree', repr(tree)
    print 'Destination tree', repr(tree2)
    #from ezs import EzsCorrector
    #strategy = EzsCorrector()
    from xmldiff.fmes import FmesCorrector
    strategy = FmesCorrector(0.59, 0.5)
    #from ezs import process
    actions = strategy.process_trees(tree, tree2)
    from xmldiff.format import xupdate_dom
    PrettyPrint(xupdate_dom(reader.fromString('<root/>'), actions))