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


Python XML.parseString方法代码示例

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


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

示例1: caps_store

# 需要导入模块: import XML [as 别名]
# 或者: from XML import parseString [as 别名]
 def caps_store(self, path, xml):
     """Generate a list of acceptable capabilities to grant access to 'store'.
        In addition to the usual ones, allow ('ruleset.uri', x) where x is the
        ruleset's URI.
        """
     if (xml.startswith('[')):
         uri = xml.split('\n')[0][2:]
     else:
         uri = XML.parseString(xml).documentElement.getAttributeNS(None, 'uri')
     return self.makeDefaultCaps(path) + [('ruleset.uri', uri)]
开发者ID:Kays,项目名称:cia-vc,代码行数:12,代码来源:Ruleset.py

示例2: format

# 需要导入模块: import XML [as 别名]
# 或者: from XML import parseString [as 别名]
    def format(self, args):
        """The formatter entry point. This just finds the current component
           tree and invokes walkComponents and joinComponents on it.
           """
        # Parse the default component tree, caching it per-class
        if self.__class__._defaultTreeOwner is not self.__class__.defaultComponentTree:
            self.__class__._defaultTreeOwner = self.__class__.defaultComponentTree
            self.__class__._cachedDefaultTree = XML.parseString(self.__class__.defaultComponentTree).documentElement

        # This will use the default component tree if it hasn't been overridden in this instance
        tree = self.componentTree or self.__class__._cachedDefaultTree
        return self.joinComponents(self.walkComponents(tree.childNodes, args))
开发者ID:SkyFire,项目名称:cia-vc,代码行数:14,代码来源:Message.py

示例3: dbStore

# 需要导入模块: import XML [as 别名]
# 或者: from XML import parseString [as 别名]
    def dbStore(self, ruleset=None):
        """Write all rulesets to disk in one big XML file"""
        doc = XML.parseString("<rulesets>\n"
                              "<!--\n"
                              "This is a ruleset storage for CIA. It tells the CIA server\n"
                              "how to deliver messages. Don't edit it by hand while the server\n"
                              "is running, use tools/ruleset_editor.py\n"
                              "-->\n"
                              "\n"
                              "</rulesets>")
        root = doc.documentElement
        for ruleset in self.flatten():
            root.appendChild(XML.Domlette.ConvertDocument(ruleset.xml).documentElement)
            root.appendChild(doc.createTextNode("\n\n"))

        f = open(self.path, "w")
        XML.Domlette.Print(doc, f)
        f.write("\n")
开发者ID:Kays,项目名称:cia-vc,代码行数:20,代码来源:Ruleset.py

示例4: command_DeliverXML

# 需要导入模块: import XML [as 别名]
# 或者: from XML import parseString [as 别名]
 def command_DeliverXML(self):
     """Deliver a message already formatted in XML"""
     # Note that parseString will convert UTF8 to Unicode for us.
     return XML.parseString(self.message.get_payload())
开发者ID:Kays,项目名称:cia-vc,代码行数:6,代码来源:IncomingMail.py


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