def InputSourceFromStream(stream): from com.sun.star.xml.sax import InputSource inputsource = InputSource() inputsource.sSystemId = '' inputsource.aInputStream = stream inputsource.sEncoding = 'utf-8' return inputsource
def getPathesFromPackage( rootUrl, sfa ): ret = () try: fileUrl = rootUrl + "/META-INF/manifest.xml" inputStream = sfa.openFileRead( fileUrl ) parser = uno.getComponentContext().ServiceManager.createInstance( "com.sun.star.xml.sax.Parser" ) handler = ManifestHandler( rootUrl ) parser.setDocumentHandler( handler ) parser.parseStream( InputSource( inputStream , "", fileUrl, fileUrl ) ) for i in tuple(handler.urlList): if not isPyFileInPath( sfa, i ): handler.urlList.remove(i) ret = tuple( handler.urlList ) except UnoException, e: text = lastException2String() log.debug( "getPathesFromPackage " + fileUrl + " Exception: " +text ) pass