当前位置: 首页>>代码示例>>Python>>正文


Python XmlTools.evaluateXPath方法代码示例

本文整理汇总了Python中comoonics.XmlTools.evaluateXPath方法的典型用法代码示例。如果您正苦于以下问题:Python XmlTools.evaluateXPath方法的具体用法?Python XmlTools.evaluateXPath怎么用?Python XmlTools.evaluateXPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在comoonics.XmlTools的用法示例。


在下文中一共展示了XmlTools.evaluateXPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_evaluateXPath

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import evaluateXPath [as 别名]
 def test_evaluateXPath(self):
     for doc in self.docs:
         if len(doc) > 1:
             (doc, xpathtest)=doc
             (xpath, expectedresult, dummy) = xpathtest
             result=XmlTools.evaluateXPath(xpath, doc)
             self.assertEquals(result, expectedresult, "Result of xpath %s in document does not equals the expected result: %s != %s" %(xpath, result, expectedresult))
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:9,代码来源:testXmlTools.py

示例2: hasFlag

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import evaluateXPath [as 别名]
    def hasFlag(self, name):
        try:
            from comoonics import XmlTools

            return len(XmlTools.evaluateXPath("flag/@name=" + name, self.element))
        except Exception:
            return False
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:9,代码来源:ComPartition.py

示例3: removeFlag

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import evaluateXPath [as 别名]
 def removeFlag(self, name):
     try:
         from comoonics import XmlTools
         node=XmlTools.evaluateXPath('flag/@name='+name, self.element)[0]
         self.element.removeChild(node)
     except Exception:
         raise ComException("no flag with name %s found" %name)
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:9,代码来源:ComPartition.py

示例4: getClusterName

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import evaluateXPath [as 别名]
 def getClusterName(self):
     """
     FIXME (marc): Should go in some cluster api (ccs_xml_query!!)
         Cluster->getClusterName()
           |
           -> RedhatCluster->getClusterName()
     """
     from comoonics import XmlTools
     return XmlTools.evaluateXPath(self.XPATH_CLUSTERNAME, self.cluster_conf)[0].nodeValue
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:11,代码来源:ComSystemInformation.py

示例5: getClusterName

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import evaluateXPath [as 别名]
 def getClusterName(self):
     """
     FIXME (marc): Should go in some cluster api (ccs_xml_query!!)
         Cluster->getClusterName()
           |
           -> RedhatCluster->getClusterName()
     """
     from comoonics import XmlTools
     if self.type==SystemTypes.CLUSTER:
         return XmlTools.evaluateXPath(self.XPATH_CLUSTERNAME, self.cluster_conf)[0]
     else:
         return "unknown"
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:14,代码来源:ComSystemInformation.py

示例6: getXPathFromXMLFile

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import evaluateXPath [as 别名]
def getXPathFromXMLFile(xpath, filename):
    try:
        from comoonics import XmlTools
        document=XmlTools.parseXMLFile(filename)
        return XmlTools.evaluateXPath(xpath, document.documentElement)
    except ImportError:
        import xml.dom.minidom
        from xml.xpath import Evaluate
        import os
        filep = os.fdopen(os.open(filename, os.O_RDONLY))
        doc=xml.dom.minidom.parse(filep)
        return Evaluate(xpath, doc.documentElement)
开发者ID:MarcGrimme,项目名称:comoonics-initrd-ng,代码行数:14,代码来源:fence_scsi_test.py


注:本文中的comoonics.XmlTools.evaluateXPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。