<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="1" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[1]</anchor-end>
<cite>MS独自拡張selectNodesメソッドについて</cite>
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://members.jcom.home.ne.jp/jintrick/Personal/d20029f.html#d15_11" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">http://members.jcom.home.ne.jp/jintrick/Personal/d20029f.html#d15_11</anchor-external></p><p>(<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">名無しさん</anchor> [sage])</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="2" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[2]</anchor-end>
<cite>Hawk's W3 Laboratory : XML : DOMとXPathの連携</cite> 
<del><anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://www.hawk.34sp.com/stdpls/xml/dom_xpath.html#case-msxml" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">http://www.hawk.34sp.com/stdpls/xml/dom_xpath.html#case-msxml</anchor-external></del>
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://web.archive.org/web/20060902115428/www.hawk.34sp.com/stdpls/xml/dom_xpath.html" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">http://web.archive.org/web/20060902115428/www.hawk.34sp.com/stdpls/xml/dom_xpath.html</anchor-external></p><blockquote><p>MSXMLにおいて、上で解説するXPathによるノード選択を利用するには、MSXML API History
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/sdk_history_8zqx.asp?frame=true" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/htm/sdk_history_8zqx.asp?frame=true</anchor-external>
などから推測するに、バージョン2.6以降が必要となるようです。対応するIEのバージョンとしてはIE6以降となります(参考
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://www.microsoft.com/japan/developer/workshop/xml/general/replacemode.asp" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">http://www.microsoft.com/japan/developer/workshop/xml/general/replacemode.asp</anchor-external>)。</p><p>ではそれ以前のバージョンでは、上記の内容は一切無効なのかというと、実はそうでもありません。例えば selectNodes/selectSingleNodeメソッドはMSXMLのバージョン2.0から既に実装されています。ただ「XPathによる選択」が可能なのはバージョン2.6以降なのです。SelectionLanguageの解説でも少し触れましたが、それより前のバージョンの selectNodes/selectSingleNodeメソッドで使用できる選択言語は”XSL Pattern”という、XSLのWorking Draft段階において存在した選択言語です。この言語は、ルートからの位置を/で区切って指し示すなど、現在のXPathと一部共通する文法を持っています。つまり、ごく簡単なXPathならばそのまま使用することが出来るということです。</p><p>このあたりの変遷について、多少推測混じりになりますが時系列を追ってみますと、</p><ol><li>MSXML2.0には、(恐らく当時最新だった)”XSL Pattern”を使用して要素を選択する selectNodes/selectSingleNodeというメソッドが存在した。</li><li>MSXML2.6で、selectNodes/selectSingleNodeは(多分そのころ正式勧告になった)XPath1.0に対応した。しかし後方互換性を保つためデフォルトの動作は”XSL Pattern”のまま据え置かれ、選択言語を切り替えるためのsetProperty メソッドと SelectionLanguage プロパティが用意された。</li><li>MSXML4.0からは”XPath”が唯一の選択言語となり、 SelectionLanguageを設定する必要はなくなった。</li></ol><p>根拠としたのはMSXMLのSDKや、以下のページなどです。
MSXML 3.0 Supports XPath 1.0, XSLT 1.0, XDR, and SAX2
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://msdn.microsoft.com/msdnmag/issues/0900/xml/default.aspx" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">http://msdn.microsoft.com/msdnmag/issues/0900/xml/default.aspx</anchor-external>
内容は全然関係ないですが、Microsoftのページですからある程度信頼できるでしょう。</p><p>また先述したようにMSXML3.0以前ならば SelectionLanguageを指定しないことで2.5以前の動作が再現できます。完全なチェックはしていませんが、IE6+MSXML3.0で概ね仕様書通りの動作をすることを確かめました。(ただしfirst-of-type()などは最初から実装されていないのか、動作しませんでした) </p></blockquote><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="3" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[3]</anchor-end>
<cite>d:id:quaa</cite> (<code>2007-07-22 14:20:44 +09:00</code> 版) <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://d.hatena.ne.jp/quaa/20070722#p1" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">http://d.hatena.ne.jp/quaa/20070722#p1</anchor-external>
(<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">名無しさん</anchor> <weak xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">2007-07-22 05:45:52 +00:00</weak>)</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="4" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[4]</anchor-end>
<cite>Hatena::agenda - Javascript1.7のカスタムイテレータとXPath</cite> (<time>2007-09-07 20:35:46 +09:00</time> 版) <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://d.hatena.ne.jp/jintrick/20070904" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">http://d.hatena.ne.jp/jintrick/20070904</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="5" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[5]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">Chrome</anchor> は実装していないようです。 <time>2013-09-23T10:07:53.300Z</time></p></body></html>