xml
<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<graph id="G" edgedefault="undirected">
<node id="n0"/>
<node id="n1"/>
<edge id="e1" source="n0" target="n1"/>
</graph>
</graphml>
python代码
^{pr2}$如果我从graphml标记中删除属性,那么它就可以工作了,返回元素
因为XML文档中没有简单的
graph
元素,所以得到了一个空列表。您的文档有一个默认的XML名称空间(属于http://graphml.graphdrawing.org/xmlns
),因此文档中没有显式名称空间前缀的任何元素都位于该名称空间中。在这意味着在请求元素时,需要提供名称空间信息和标记名。例如:
LXML文档有一个关于working with namespaces的部分。在
相关问题 更多 >
编程相关推荐