XPath - ロケーションパス (Location Path)

Advertisement

使用目的

XML 文章内で、特定のノードの位置を指定するために使用する。

書式

軸::ノード[]

キーワード対象
ancestor祖先
ancestor-or-selfカレントノードと祖先
attribute属性
child
descendant子孫
descendant-or-selfカレントノードと子孫
followingカレントノードより後に出現するノード
following-sibilng兄弟(カレントノードより後ろ)
namespace名前空間
parent
preceding-sibling兄弟(カレントノードより前)
precedingカレントノードより前に出現するノード
selfカレントノード
※軸そのものを省略する事ができる。

省略書式一覧。
省略書式省略なしの記述意味
記述省略child
@attribute属性
.self::node()カレントノード
..parent::node()
//descendant-or-self::node()/すべてのノード

例1:カレントノードの子 book の子 title
(1) child::book/child::title
(2) book/title
例2:カレントノードの子 book の属性 id
(1) child::book/attribute::id
(2) book/@id

Advertisement

ショートカット

634トップページ
このカテゴリのトップページに戻る
634ラボ

サイト検索

Google

Web サイト内

Y!ログール