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


Python XmlTools.parseXMLFP方法代码示例

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


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

示例1: getDOMElement

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLFP [as 别名]
 def getDOMElement(self, name):
     '''returns a DOM Element from the given member name'''
     from comoonics import XmlTools
     file=self.ahandler.getFileObj(name)
     doc=XmlTools.parseXMLFP(file)
     self.ahandler.closeAll()
     return doc.documentElement
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:9,代码来源:ComArchive.py

示例2: getEnterprisecopy

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLFP [as 别名]
    def getEnterprisecopy(self):
        from comoonics import XmlTools
        import xml.dom
        import odict
        import os.path
        ret_doc=None
        ret_element=None
        _sets=odict.Odict()
        for _templatefile in self.templatefiles:
            _file=open(os.path.join(self.sysreport_templatesbase, _templatefile),"r")
            doc=XmlTools.parseXMLFP(_file)
            # Initially create ret_doc. Cannot do it before cause we need the doc
            if not ret_doc:
                ret_doc=XmlTools.getDOMImplementation().createDocument(None, doc.documentElement.tagName, None)
                ret_element=ret_doc.documentElement
            for _child in doc.documentElement.childNodes:
                if _child.nodeType==xml.dom.Node.ELEMENT_NODE:
                    if _child.hasAttribute("name"):
                        _sets[_child.getAttribute("name")]=XmlTools.clone_node(_child, ret_doc)
                elif _child.nodeType == xml.dom.Node.ATTRIBUTE_NODE:
                    ret_element.appendChild(XmlTools.clone_node(_child, ret_doc))
        # remove the save-sysreport and add it to the end
        _save_set= _sets[self.save_set]
        del _sets[self.save_set]
        _sets[self.save_set]=_save_set

        for _set in _sets.values():
            Sysreport.logger.debug("getEnterprisecopy() adding child: %s" %_set.getAttribute("name"))
            ret_element.appendChild(_set)
        del _sets[self.save_set]
        del _sets[self.head_set]
        self.sets=_sets
        return EnterpriseCopy(ret_element, ret_doc)
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:35,代码来源:ComSysreport.py

示例3: parseClusterConfFP

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLFP [as 别名]
def parseClusterConfFP(_clusterconffp, _clusterconf, _validate=False):
    from comoonics import ComLog
    from comoonics import XmlTools
    try:
        doc = XmlTools.parseXMLFP(_clusterconffp)
    except Exception, arg:
        ComLog.getLogger().critical("Problem while reading clusterconfiguration (%s): %s" %(_clusterconf, str(arg)))
        raise
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:10,代码来源:__init__.py

示例4: getNextDOMElement

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLFP [as 别名]
    def getNextDOMElement(self):
        ''' returns a DOM representation of the next defined file
            <file name="filename.xml"/>
        '''
        from comoonics import XmlTools
        file=self.getNextFileObj()
        # there is no nextElement
        if file == None:
            return None

        doc=XmlTools.parseXMLFP(file)
        self.ahandler.closeAll()
        return doc.documentElement
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-cluster-suite,代码行数:15,代码来源:ComArchive.py

示例5: setUp

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLFP [as 别名]
 def setUp(self):
     from comoonics import XmlTools
     import StringIO
     from comoonics.storage.ComDevice import Device
     from comoonics.storage.ComMountpoint import MountPoint
     from comoonics.storage.ComFileSystem import getFileSystem
     
     xmlfp=StringIO.StringIO(self.xml)
     doc=XmlTools.parseXMLFP(xmlfp)
     __device=doc.documentElement
     
     self.device=Device(__device, doc)
     __fs=__device.getElementsByTagName("filesystem")[0]
     self.filesystem=getFileSystem(__fs, doc)
     __mp=__device.getElementsByTagName("mountpoint")[0]
     self.mountpoint=MountPoint(__mp, doc)
开发者ID:MarcGrimme,项目名称:comoonics-cluster-suite,代码行数:18,代码来源:testComFileSystem.py

示例6: fromXML

# 需要导入模块: from comoonics import XmlTools [as 别名]
# 或者: from comoonics.XmlTools import parseXMLFP [as 别名]
def fromXML(options, xmlfile):
    from comoonics import XmlTools
    import xml.dom
    if options.xml=="-":
        logger.debug("Parsing document from stdin")
        doc = XmlTools.parseXMLFP(sys.stdin, options.xmlvalidate)
    elif os.path.isfile(options.xml):
        logger.debug("Parsing document %s " % options.xml)
        doc = XmlTools.parseXMLFile(options.xml, options.xmlvalidate)

    if options.clusterconf:
        from xml import xpath
        if options.nodename != None or options.nodename != "":
            (rc, options.nodename)=ComSystem.execLocalStatusOutput("cman_tool status | grep 'Node name:'")
            logger.debug("options.nodename: %s" %options.nodename)
            options.nodename=options.nodename.split(" ")[2]
            _xmlnodepath='/cluster/clusternodes/clusternode[@name="%s"]/com_info/fenceackserver' %(options.nodename)
            logger.debug("Nodename: %s, path: %s" %(options.nodename, _xmlnodepath))
            node=xpath.Evaluate(_xmlnodepath, doc)[0]
    elif options.xmlnodepath and options.xmlnodepath != "":
        from xml import xpath
        logger.debug("Path2Config: %s" %options.xmlnodepath)
        node=xpath.Evaluate(options.xmlnodepath, doc)[0]
    else:
        node=doc.documentElement

    if node.hasAttribute("port"): options.port=node.getAttribute("port")
    if node.hasAttribute("user"): options.user=node.getAttribute("user")
    if node.hasAttribute("passwd"): options.password=node.getAttribute("passwd")
    if node.hasAttribute("bind"): options.bind=node.getAttribute("bind")
    sslnodes=node.getElementsByTagName("ssl")
    if sslnodes:
        options.ssl=True
        if node.hasAttribute("keyfile"): options.ssl_keyfile=node.getAttribute("keyfile")
        if node.hasAttribute("certfile"): options.ssl_certfile=node.getAttribute("certfile")
        if node.hasAttribute("verifyfile"): options.ssl_verifyfile=node.getAttribute("verifyfile")

    return
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-initrd-ng,代码行数:40,代码来源:fence_ack_server.py


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