将feature
python的minidom用于这种xml结构的最短代码/最快的方法是什么:
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
id = "http://example.org/exampleWidget"
version = "2.0 Beta"
height = "200"
width = "200"
viewmodes = "fullscreen">
<feature name="http://example.com/camera" state="true"/>
<feature name="http://example.com/bluetooth" state="true"/>
<feature name="http://example.com/sms" state="true"/>
<feature name="http://example.com/etc" state="false"/>
</widget>
我现在对小部件的属性不感兴趣,只是功能。
输出将是
feature["camera"] = true
feature["etc"] = false