python 解析XML python模块xml.dom解析xml实例代码

yihao51938 36 0 PDF 2020-12-31 07:12:03

一 、python模块 xml.dom 解析XML的APIminidom.parse(filename)加载读取XML文件 doc.documentElement获取XML文档对象 node.getAttribute(AttributeName)获取XML节点属性值 node.getElementsByTagName(TagName)获取XML节点对象集合 node.childNodes #返回子节点列表。 node.childNodes[index].nodeValue获取XML节点值 node.firstChild#访问第一个节点。等价于pagexml.childNodes[0] doc

用户评论
请输入评论内容
评分:
暂无评论