ElementTree を使用して以下に示す xml を解析していますがInvalid Predicate
、コードでエラーが発生します。
connect
基本的に、特定のpin
属性名を持つ要素を見つけようとしています。
XML
<deviceset>
<devices>
<device name="">
<connects>
<connect gate="G$1" pin="+15V_DC" pad="7"/>
<connect gate="G$1" pin="FB" pad="3"/>
<connect gate="G$1" pin="ICOM" pad="4"/>
<connect gate="G$1" pin="IN+" pad="5"/>
<connect gate="G$1" pin="IN-" pad="6"/>
<connect gate="G$1" pin="OUT_HI" pad="1"/>
<connect gate="G$1" pin="OUT_LO" pad="9"/>
<connect gate="G$1" pin="PWRCOM" pad="2"/>
</connects>
</device>
</devices>
</deviceset>
パイソンコード
# Imports
import xml.etree as ET
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
# Open a file sent to the function
file = open(os.path.join(__location__, file));
tree = ET.parse(file)
root = tree.getroot()
deviceset = root.find ('deviceset')
deviceset.find('devices').find('device').find('connects').**findall("./connect[@pin = \"FB\"]")**
問題は、XPATH スタイル パス (上記で強調表示) にあるようです。
私が間違っていることについてのアイデアはありますか?