本文整理汇总了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)
示例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]) ])
示例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)
示例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(" ", ""))
示例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(" ", ""))
示例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", ""))
示例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)
示例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)