这是我用MC写的一个函数,不太好,但可以用
String * ENCODEXML(String *XMLStr,String *XMLPath)
{
String *tmpStr;
tmpStr="ERRORXML";
try
{
XmlDocument *doc = new XmlDocument();
doc->LoadXml(XMLStr);
XmlNode *chile =doc->SelectSingleNode(XMLPath);
XmlNodeReader *nr = new XmlNodeReader(chile);
nr->MoveToContent();
tmpStr=nr->ReadString();
nr->Close();
}
catch(...)
{}
    return tmpStr;
}ENCODEXML(String *XMLStr,S"rdf\title")就可以了

解决方案 »

  1.   

    用xpathXmlDocument doc = new XmlDocument();
    doc.Load("xxx.xml");
    XmlNode book;
    XmlElement root = doc.DocumentElement;
    book = root.SelectSingleNode("//title");
    Console.WriteLine(book.InnerXml);
      

  2.   

    是啊,用xpath就可以搞定了,楼上的说得很多。
      

  3.   

    不行啊,如net_lover说的XmlDocument doc = new XmlDocument();
    doc.Load("xxx.xml");
    XmlNode book;
    XmlElement root = doc.DocumentElement;
    book = root.SelectSingleNode("//title");
    string content = book.innerText给出一个NullRefelectionExpetion得异常阿……