예제 #1
0
파일: __init__.py 프로젝트: hanul93/pyhwp
def InputSourceFromStream(stream):
    from com.sun.star.xml.sax import InputSource
    inputsource = InputSource()
    inputsource.sSystemId = ''
    inputsource.aInputStream = stream
    inputsource.sEncoding = 'utf-8'
    return inputsource
예제 #2
0
파일: __init__.py 프로젝트: syyunn/pyhwp
def InputSourceFromStream(stream):
    from com.sun.star.xml.sax import InputSource
    inputsource = InputSource()
    inputsource.sSystemId = ''
    inputsource.aInputStream = stream
    inputsource.sEncoding = 'utf-8'
    return inputsource
예제 #3
0
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