@@ -0,0 +1,1510 @@
+# -*- coding: utf-8 -*-%0D%0A%22%22%22%0D%0A    mpxml to pxml convertor%0D%0A    %0D%0A    @author: H D%C3%A9jean%0D%0A    %0D%0A    READ project%0D%0A    31/05/2017%0D%0A%22%22%22 %0D%0A%0D%0Aimport sys, os.path%0D%0Asys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(sys.argv%5B0%5D))))%0D%0Asys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(sys.argv%5B0%5D)))))%0D%0A%0D%0Aimport libxml2%0D%0Aimport xml_formats.PageXml as PageXml%0D%0A    %0D%0Aif __name__ == %22__main__%22:%0D%0A    %0D%0A    import sys, glob, optparse%0D%0A    usage = %22%22%22%0D%0A%25s dirname+%0D%0AUtility to create a set of pageXml XML files from a mpxml file.%0D%0A%22%22%22 %25 sys.argv%5B0%5D%0D%0A%0D%0A    parser = optparse.OptionParser(usage=usage)%0D%0A    %0D%0A    parser.add_option(%22--format%22, dest='bIndent',  action=%22store_true%22 , help=%22reformat/reindent the input%22)    %0D%0A    parser.add_option(%22--dir%22, dest='destdir',  action=%22store%22, default='pxml' , help=%22directory ouptut%22)  %0D%0A    (options, args) = parser.parse_args()%0D%0A%0D%0A    try:%0D%0A        dir  = args%5B0%5D%0D%0A        docid= args%5B1%5D%0D%0A    except:%0D%0A        parser.print_help()%0D%0A        parser.exit(1, %22%22)%0D%0A    %0D%0A    sDocFilename = %22%25s%25scol%25s%25s.mpxml%22 %25 (dir,os.sep,os.sep,docid)        %0D%0A        %0D%0A    doc = libxml2.parseFile(sDocFilename)%0D%0A%0D%0A    for pnum, pageDoc in PageXml.MultiPageXml._iter_splitMultiPageXml(doc, bInPlace=True):%0D%0A        outfilename = %22%25s%25s%25s%25s%25s_%2503d.pxml%22 %25 (dir,os.sep,options.destdir,os.sep,docid,pnum)%0D%0A        print outfilename        %0D%0A        pageDoc.saveFormatFileEnc(outfilename, %22utf-8%22, bool(options.bIndent))%0D%0A    doc.freeDoc()%0D%0A    print %22DONE%22    

add mpxmltopxml