Xpath

xpath.png
構文 意味
* すべての子要素を取得
. Selects the current node. This is mostly useful at the beginning of the path, to indicate that it’s a relative path.
/ 下位要素
// Selects all subelements, on all levels beneath the current element. たとえば.//egg だったら、すべての木の中で、eggというタグを持つものをすべて拾い上げるということ。
.. 親要素の取得
[@attrib] Selects all elements that have the given attribute.
[@attrib='value'] Selects all elements for which the given attribute has the given value. The value cannot contain quotes.
[tag] Selects all elements that have a child named tag. Only immediate children are supported.
[position] Selects all elements that are located at the given position. The position can be either an integer (1 is the first position), the expression last() (for the last position), or a position relative to the last position (e.g. last()-1).

python-xml-gettag

サポートサイト Wikidot.com python-xml-gettag