#include "stdafx.h"

//using namespace System;
#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Xml;


int main(array<System::String ^> ^args)
{
    XmlDocument^ doc = gcnew XmlDocument;  

   doc->Load( "booksort.xml" );
   XmlElement^ root = doc->DocumentElement;
   XmlNodeList^ bookList = root->SelectNodes( "bookstore/book[@id='001']");

   //单斜杠表示选取属于 bookstore 的子元素的所有 book 元素

   //XmlNode^ book =  root->SelectNodes( "bookstore//book[@id='001']");

    //双斜杠表示选择属于 bookstore 元素的后代的所有 book 元素,而不管它们位于   bookstore 之下的什么位置
   return 0;
}

<root>
  <bookstore xmlns:bk="urn:samples">
    <book genre="novel" publicationdate="1997" bk:ISBN="1-861001-57-8">
      <title>Pride And Prejudice</title>
      <author>
        <first-name>Jane</first-name>
        <last-name>Austen</last-name>
      </author>
      <price>24.95</price>
    </book>
    <book genre="novel" publicationdate="1992" id = "001">
      <title>The Handmaid's Tale</title>
      <author>
        <first-name>Margaret</first-name>
        <last-name>Atwood</last-name>
      </author>
      <price>29.95</price>
    </book>
    <bookList>
    <book genre="novel" publicationdate="1991" id = "001">
      <title>Emma</title>
      <author>
        <first-name>Jane</first-name>
        <last-name>Austen</last-name>
      </author>
      <price>19.95</price>
    </book>
    <book genre="novel" publicationdate="1982" id = "003">
      <title>Sense and Sensibility</title>
      <author>
        <first-name>Jane</first-name>
        <last-name>Austen</last-name>
      </author>
      <price>19.95</price>
    </book>
    </bookList>
  </bookstore>
</root>