Logo Search packages:      
Sourcecode: zope-attachmentfield version File versions  Download package

def AttachmentField::ooconverter::oo_to_html::parseText (   self,
  text 
)

parse the raw xml content returning headers and body
doing xpath queries
we assume that content is utf-8 encoded

Definition at line 336 of file ooconverter.py.

00336                              :
        """ 
        parse the raw xml content returning headers and body
        doing xpath queries
        we assume that content is utf-8 encoded
        """

        # define vars 
        styles = ''

        # libxml2 encoding translation
        xmlOutEnc=self.getOutEncoding(default='utf8')

        # create xpath context
        doc=libxml2.parseDoc(text)
        ctxt=doc.xpathNewContext()

        # get body
        res=ctxt.xpathEval("//body")
        if len(res): text=res[0].serialize(encoding=xmlOutEnc, format=1)[6:-7]
        
        # get styles 
        res=ctxt.xpathEval("//style")
        if len(res): styles=res[0].serialize(encoding=xmlOutEnc, format=1)
        
        # cleanup
        doc.freeDoc()
        ctxt.xpathFreeContext()

        # return parsed parts
        return text, styles


    def getOutEncoding(self, default=None):


Generated by  Doxygen 1.6.0   Back to index