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


Python XmlTools.parseXMLString方法代码示例

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


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

示例1: setUp

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLString [as 别名]
    def setUp(self):
        from comoonics.storage.hp.ComHP_EVA_Storage import HP_EVA_Storage
        from comoonics import XmlTools
        from comoonics.storage.ComDisk import StorageDisk
        #mylogger.debug("xml: %s" %(match.group(1)))
        xml_dump="""
        <disk name="Virtual Disks/atix/sourcedisk">
            <properties>
                <property name="size" value="10"/>
                <property name="disk_group" value="146er"/>
            </properties>
        </disk>
"""
        doc=XmlTools.parseXMLString(xml_dump)
        self.disk=StorageDisk(doc.documentElement, doc)
        self.storage=HP_EVA_Storage(system="127.0.0.1/EVA5000", username="Administrator", password="Administrator", autoconnect=True, cmd="../ComHP_EVA_SSSU_Sim.py")
        xml_dump="""
        <disk name="Virtual Disks/atix/sourcedisk_snap">
            <mapping lun="1">
                <host name="server1"/>
            </mapping>
        </disk>
"""
        doc=XmlTools.parseXMLString(xml_dump)
        self.snapdisk=StorageDisk(doc.documentElement, doc)
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:27,代码来源:testHP_EVA_Storage.py

示例2: setUp

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLString [as 别名]
 def setUp(self):
     self.docs=list()
     for i in range(len(xmls)): 
         if i < len(xpaths):
             self.docs.append([ XmlTools.parseXMLString(xmls[i]), xpaths[i]])
         else:
             self.docs.append([ XmlTools.parseXMLString(xmls[i]) ])
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:9,代码来源:testXmlTools.py

示例3: _testDiskDump

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLString [as 别名]
 def _testDiskDump(self, dump):
     try:
         from comoonics.storage.ComDisk import StorageDisk
         from comoonics import XmlTools
         doc=XmlTools.parseXMLString(dump)
         StorageDisk(doc.documentElement, doc)
     except:
         self.fail("Could not create Disk for dump %s" %dump)
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:10,代码来源:testComDisk.py

示例4: test_toPrettyXml

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLString [as 别名]
    def test_toPrettyXml(self):
        docstring="""<?xml version="1.0" ?>
\t<x>
\t  <y>
\t    abc
\t  </y>
\t</x>
"""
        doc=XmlTools.parseXMLString(docstring)
        self.assertEquals(docstring.replace("\n", "").replace("\t", "").replace(" ", ""), XmlTools.toPrettyXML(doc).replace("\n", "").replace("\t", "").replace(" ", ""))            
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:12,代码来源:testXmlTools.py

示例5: test_removePrettyTextNodes

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLString [as 别名]
    def test_removePrettyTextNodes(self):
        docstring="""<?xml version="1.0" ?>
<x>
  <y>
  abcdef
  </y>
</x>
"""     
        doc=XmlTools.parseXMLString(docstring)
        XmlTools.removePrettyTextNodes(doc)
        result=XmlTools.toPrettyXML(doc, "  ", "\n")
        self.assertEquals(docstring.replace("\n", "").replace(" ", ""), result.replace("\n", "").replace(" ", ""))        
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:14,代码来源:testXmlTools.py

示例6: test_overwrite_attributes_with_xpaths2

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLString [as 别名]
    def test_overwrite_attributes_with_xpaths2(self):
        doc="""<a>
   <b name="hallo"/>
   <b name="hallo2"/>
   <c name="hallo3"/>
   <c name2="hallo4"/>
   <c name="hallo5"/>
</a>
"""
        edoc="""<a>
   <b name="marc"/>
   <b name="marc"/>
   <c name="marc"/>
   <c name2="hallo4"/>
   <c name="marc"/>
</a>
"""
        rdoc=XmlTools.overwrite_attributes_with_xpaths(XmlTools.parseXMLString(doc), {"//b/@name": "marc", "/a/c/@name": "marc"})
        self.failUnlessEqual(XmlTools.toPrettyXML(rdoc).replace("\n", "").replace(" ", "").replace("\t", "").replace('<?xmlversion="1.0"?>', ""), edoc.replace("\n", "").replace(" ", "").replace("\t", ""))   
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:21,代码来源:testXmlTools.py

示例7: testName

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLString [as 别名]
 def testName(self):
     _xml="""
 <copyset type="filesystem" name="save-sysreport-redhat">
     <source type="path">
         <path name="/tmp/sysreport-$(date -u +%G%m%d%k%M%S | /usr/bin/tr -d ' ')"/>
     </source>
     <destination type="backup">
         <metadata>
             <archive name='/tmp/meta-clone-lilr627-02.tar' format='tar' type='file'>
                 <file name='./path.xml'/>
             </archive>
         </metadata>
         <data>
             <archive name='/tmp/path-02.tgz' format='tar' type='file' compression='gzip'/>
         </data>
     </destination>
 </copyset>"""
     from comoonics.enterprisecopy.ComCopyset import Copyset
     from comoonics import XmlTools
     doc=XmlTools.parseXMLString(_xml)
     _copyset=Copyset(doc.documentElement, doc)
     self.__testPathCopyset(_copyset)
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:24,代码来源:testPathCopyObject.py

示例8: __init__

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLString [as 别名]
 def __init__(self, testMethod="runTest"):
    from comoonics import XmlTools
    super(test_Properties, self).__init__(testMethod)
    document=XmlTools.parseXMLString(xml_str)
    self.properties=Properties(document.documentElement, document)
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:7,代码来源:test_ComProperties.py


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