Start New Discussion within our Software Development Community

I'm working on another piece of code that did the same thing as my Dom implementation only with Microsoft's System.Xml

Here's the idea, I want to take an element and insert some text into it.

<nameytag> *insert text here* </slashnameytag>

Currently, I have this:

#using <mscorlib.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::IO;
using namespace System::Xml;
using namespace System::Xml::XPath;
using namespace System::Text;
using namespace System::Collections;

int main(int argc, char* argv[])
{

	//Create and load the document
	XmlDocument* doc= new XmlDocument();
	doc->Load("C:\\Documents and Settings\\swartj\\Desktop\\Template.xml");

	//Create the navigator and iterator
	XPathNavigator* nav= doc->CreateNavigator();
	XPathNodeIterator* iter= nav->Select("metadata");

	while(iter->MoveNext())
	{
		XPathNodeIterator* contIter = iter->Current->SelectDescendants(XPathNodeType::Element,true);
		while(contIter->MoveNext())
		{
			XmlNode* n = dynamic_cast<IHasXmlNode*>(contIter->Current)->GetNode();
			Console::WriteLine(n->Name);
			}

			if(n->Name->Equals("progress"))
			{
				Console::WriteLine("found progress");
				n->InnerText = tvalue.c_str();//<-this part right here doesn't seem to work
			}
		}
	}
}

After working with Xerces DOM this seems like hell. The only thing I like about using Microsoft's DOM is the IHasXmlNode class :P
Thanks in advance.

This question has already been answered. Start a new discussion instead.