XPath
軸::ノードタイプ[predicate]
軸は範囲を示す。子孫、親、preceding-sibling, following-sibling, self, それらの組み合わせ
ノードタイプは、htmlなら aタグとか、pタグとか, textノードも
そのあとで、順番だったり、属性による絞り込み(predicate)もある。
属性ノードを取る場合、
$x("attribute::node()", $0) or $x("@*",$0) 後者は省略記法
XPath Tutorial w3schoolの説明はわかりやすい。
XSLT(extensible stylesheet language transformation)
XLink( XLink - Wikipedia )
Xpointer(XPointer - Wikipedia)
https://gyazo.com/febb83feb91a4be11885c906015a62c0
axisname::nodetest[predicate]
上記が基本で、あとはaxisのパターン(親子関係), nodetest(ノードの名前, タグ名), predict( 属性とかの一致。数字解釈もあるが)
あとは、 // の意味が取りにくい。 decendant-or-self::node() の意味らしいが、、、すべてのノードですよ。その後に、path expressionがいるが、うまく整理できない。
Do double slash in XPath predicate work the same as in the path itself - Stack Overflow
Nodes
node(), text(), comment(), あとは実装があったりなかったり?? namespace, processing-instruction, document nodes.
syntax
selecting... nodenames, / // . .. @
axes(軸)
child, attribute, descendant, ancestor, ancestor-or-self, descendant-or-self....
十章第一回 XPathとは — JavaScript初級者から中級者になろう — uhyohyo.net
python でのXML documentの説明
xml.etree.ElementTree — The ElementTree XML API — Python 3.7.2rc1 documentation
code: xpath.py
import xml.etree.ElementTree as ET
tree = ET.parse('bar.xml')
root = tree.getroot()
a = root.findall('.//*@name="AccountingPolicyForHedgingTextBlock"')0`
a.keys()
a.get('id')
など
xml
xbrl