8,906
社区成员
发帖
与我相关
我的任务
分享
#using <System.Xml.dll>
using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
XmlDocument^ doc = gcnew XmlDocument;
doc->LoadXml( "<book genre='novel' ISBN='1-861001-57-5'>"
"<title>Pride And Prejudice</title>"
"</book>" );
XmlNode^ root = doc->DocumentElement;
//Create a new node.
XmlElement^ elem = doc->CreateElement( "price" );
elem->InnerText = "19.95";
//Add the node to the document.
root->AppendChild( elem );
Console::WriteLine( "Display the modified XML..." );
doc->Save( Console::Out );
}