这是我用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")就可以了
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")就可以了
doc.Load("xxx.xml");
XmlNode book;
XmlElement root = doc.DocumentElement;
book = root.SelectSingleNode("//title");
Console.WriteLine(book.InnerXml);
doc.Load("xxx.xml");
XmlNode book;
XmlElement root = doc.DocumentElement;
book = root.SelectSingleNode("//title");
string content = book.innerText给出一个NullRefelectionExpetion得异常阿……