Skip to content

Instantly share code, notes, and snippets.

@vmi
Created March 16, 2012 06:45
Show Gist options
  • Save vmi/2048811 to your computer and use it in GitHub Desktop.
Save vmi/2048811 to your computer and use it in GitHub Desktop.
JavaScript XPath メモ
// XPath メモ
// 使用例
var xpathResult = document.evaluate("XPath式", document.body, null, 9, null);
// var xpathResult = document.evaluate(
// xpathExpression,
// contextNode,
// namespaceResolver,
// resultType,
// result
// );
//
// namespaceResolver: とりあえずnull
//
// resultType: 結果型
// 1 = 数値
// 2 = 文字列
// 3 = ブール値
// 5 = 全ノード集合(出現順)
// 7 = 全ノード集合のスナップショット(出現順)
// 9 = 最初にマッチしたノードのみを格納するノード集合
//
// result: 過去の結果を再利用する場合に指定。最初はnull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment