예제 #1
0
 def applyStylesheet(self, doc, params):
     """Apply the stylesheet to the document"""
     if doc == None: doc__o = None
     else: doc__o = doc._o
     ret = libxsltmod.xsltApplyStylesheet(self._o, doc__o, params)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #2
0
 def applyStylesheet(self, doc, params):
     """Apply the stylesheet to the document"""
     if doc == None: doc__o = None
     else: doc__o = doc._o
     ret = libxsltmod.xsltApplyStylesheet(self._o, doc__o, params)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #3
0
 def applyStylesheetUser(self, doc, params, transformCtxt):
     """Apply the stylesheet to the document"""
     if doc == None: doc__o = None
     else: doc__o = doc._o
     if transformCtxt == None: transformCtxt__o = None
     else: transformCtxt__o = transformCtxt._o
     ret = libxsltmod.xsltApplyStylesheetUser(self._o, doc__o, params, transformCtxt__o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #4
0
 def applyStylesheetUser(self, doc, params, transformCtxt):
     """Apply the stylesheet to the document"""
     if doc == None: doc__o = None
     else: doc__o = doc._o
     if transformCtxt == None: transformCtxt__o = None
     else: transformCtxt__o = transformCtxt._o
     ret = libxsltmod.xsltApplyStylesheetUser(self._o, doc__o, params, transformCtxt__o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #5
0
    def doc(self):
        """Get the document being parsed.

        :return: the document.
        :returntype: `libxml2.xmlNode`"""
        ret=self.reader.doc()
        if ret:
            return libxml2.xmlDoc(ret)
        else:
            return None
예제 #6
0
    def doc(self):
        """Get the document being parsed.

        :return: the document.
        :returntype: `libxml2.xmlNode`"""
        ret = self.reader.doc()
        if ret:
            return libxml2.xmlDoc(ret)
        else:
            return None
예제 #7
0
    def QueryTypeId(self, tpid):
        """
        Queries the DMI data structure for a specific DMI type.
        """
        if self.restype == DMIXML_NODE:
            ret = libxml2.xmlNode(_obj=xmlapi(
                query_type='t', result_type=self.restype, typeid=tpid))
        elif self.restype == DMIXML_DOC:
            ret = libxml2.xmlDoc(_obj=xmlapi(
                query_type='t', result_type=self.restype, typeid=tpid))
        else:
            raise TypeError, "Invalid result type value"

        return ret
예제 #8
0
 def profileInformation(self):
     """This function should be called after the transformation
        completed to extract template processing profiling
        informations if availble. The informations are returned as
        an XML document tree like <?xml version="1.0"?> <profile>
        <template rank="1" match="*" name="" mode="" calls="6"
        time="48" average="8"/> <template rank="2"
        match="item2|item3" name="" mode="" calls="10" time="30"
        average="3"/> <template rank="3" match="item1" name=""
        mode="" calls="5" time="17" average="3"/> </profile> The
        caller will need to free up the returned tree with
        xmlFreeDoc()"""
     ret = libxsltmod.xsltGetProfileInformation(self._o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #9
0
    def QuerySection(self, sectname):
        """
        Queries the DMI data structure for a given section name.  A section
        can often contain several DMI type elements
        """
        if self.restype == DMIXML_NODE:
            ret = libxml2.xmlNode(_obj=xmlapi(
                query_type='s', result_type=self.restype, section=sectname))
        elif self.restype == DMIXML_DOC:
            ret = libxml2.xmlDoc(_obj=xmlapi(
                query_type='s', result_type=self.restype, section=sectname))
        else:
            raise TypeError, "Invalid result type value"

        return ret
예제 #10
0
 def profileInformation(self):
     """This function should be called after the transformation
       completed to extract template processing profiling
       informations if availble. The informations are returned as
       an XML document tree like <?xml version="1.0"?> <profile>
       <template rank="1" match="*" name="" mode="" calls="6"
       time="48" average="8"/> <template rank="2"
       match="item2|item3" name="" mode="" calls="10" time="30"
       average="3"/> <template rank="3" match="item1" name=""
       mode="" calls="5" time="17" average="3"/> </profile> The
       caller will need to free up the returned tree with
        xmlFreeDoc()"""
     ret = libxsltmod.xsltGetProfileInformation(self._o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #11
0
    def QueryTypeId(self, tpid):
        """
        Queries the DMI data structure for a specific DMI type.
        """
        if self.restype == DMIXML_NODE:
            ret = libxml2.xmlNode( _obj = xmlapi(query_type='t',
                                                           result_type=self.restype,
                                                           typeid=tpid))
        elif self.restype == DMIXML_DOC:
            ret = libxml2.xmlDoc( _obj = xmlapi(query_type='t',
                                                          result_type=self.restype,
                                                          typeid=tpid))
        else:
            raise TypeError("Invalid result type value")

        return ret
예제 #12
0
    def QuerySection(self, sectname):
        """
        Queries the DMI data structure for a given section name.  A section
        can often contain several DMI type elements
        """
        if self.restype == DMIXML_NODE:
            ret = libxml2.xmlNode( _obj = xmlapi(query_type='s',
                                                           result_type=self.restype,
                                                           section=sectname) )
        elif self.restype == DMIXML_DOC:
            ret = libxml2.xmlDoc( _obj = xmlapi(query_type='s',
                                                          result_type=self.restype,
                                                          section=sectname) )
        else:
            raise TypeError("Invalid result type value")

        return ret
예제 #13
0
 def doc(self):
     """Get the document of a stylesheet"""
     ret = libxsltmod.xsltStylesheetGetDoc(self._o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #14
0
 def createRVT(self):
     """Create a result value tree"""
     ret = libxsltmod.xsltCreateRVT(self._o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #15
0
 def outputDoc(self):
     """Get the output document of a transformation"""
     ret = libxsltmod.xsltTransformGetOutputDoc(self._o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #16
0
 def _stream_end(self, _doc):
     """Process stream end."""
     doc = libxml2.xmlDoc(_doc)
     self.stream_end(doc)
예제 #17
0
 def _stream_start(self, _doc):
     """Process stream start."""
     doc = libxml2.xmlDoc(_doc)
     self.stream_start(doc)
예제 #18
0
파일: libxslt.py 프로젝트: flosnaphq/MAMP
 def createRVT(self):
     """Creates a Result Value Tree (the XSLT 1.0 term for this is
        "Result Tree Fragment")"""
     ret = libxsltmod.xsltCreateRVT(self._o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #19
0
파일: libxslt.py 프로젝트: fxia22/ASM_xf
 def createRVT(self):
     """Create a result value tree"""
     ret = libxsltmod.xsltCreateRVT(self._o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #20
0
 def _stream_end(self,_doc):
     """Process stream end."""
     doc=libxml2.xmlDoc(_doc)
     self.stream_end(doc)
예제 #21
0
 def _stream_start(self,_doc):
     """Process stream start."""
     doc=libxml2.xmlDoc(_doc)
     self.stream_start(doc)
예제 #22
0
 def _stanza(self,_doc,_node):
     """Process complete stanza."""
     doc=libxml2.xmlDoc(_doc)
     node=libxml2.xmlNode(_node)
     self.stanza(doc,node)
예제 #23
0
 def createRVT(self):
     """Creates a Result Value Tree (the XSLT 1.0 term for this is
        "Result Tree Fragment")"""
     ret = libxsltmod.xsltCreateRVT(self._o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #24
0
 def _stanza(self, _doc, _node):
     """Process complete stanza."""
     doc = libxml2.xmlDoc(_doc)
     node = libxml2.xmlNode(_node)
     self.stanza(doc, node)
예제 #25
0
 def doc(self):
     """Get the document of a stylesheet"""
     ret = libxsltmod.xsltStylesheetGetDoc(self._o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
예제 #26
0
 def outputDoc(self):
     """Get the output document of a transformation"""
     ret = libxsltmod.xsltTransformGetOutputDoc(self._o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)