Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 16
0
 def _stream_end(self, _doc):
     """Process stream end."""
     doc = libxml2.xmlDoc(_doc)
     self.stream_end(doc)
Exemplo n.º 17
0
 def _stream_start(self, _doc):
     """Process stream start."""
     doc = libxml2.xmlDoc(_doc)
     self.stream_start(doc)
Exemplo n.º 18
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)
Exemplo n.º 19
0
 def createRVT(self):
     """Create a result value tree"""
     ret = libxsltmod.xsltCreateRVT(self._o)
     if ret == None: return None
     return libxml2.xmlDoc(_obj=ret)
Exemplo n.º 20
0
 def _stream_end(self,_doc):
     """Process stream end."""
     doc=libxml2.xmlDoc(_doc)
     self.stream_end(doc)
Exemplo n.º 21
0
 def _stream_start(self,_doc):
     """Process stream start."""
     doc=libxml2.xmlDoc(_doc)
     self.stream_start(doc)
Exemplo n.º 22
0
 def _stanza(self,_doc,_node):
     """Process complete stanza."""
     doc=libxml2.xmlDoc(_doc)
     node=libxml2.xmlNode(_node)
     self.stanza(doc,node)
Exemplo n.º 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)
Exemplo n.º 24
0
 def _stanza(self, _doc, _node):
     """Process complete stanza."""
     doc = libxml2.xmlDoc(_doc)
     node = libxml2.xmlNode(_node)
     self.stanza(doc, node)
Exemplo n.º 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)
Exemplo n.º 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)