Xml GetElementsByTagName Error

G

Guest

I have the following code in my progam to edit an xml file with the correct data and the code when executed on the device keeps throwing an XMLException error
Error at this line:XmlNodeList nodeList = doc.GetElementsByTagName("Security")
foreach (XmlNode node in nodeList

node.FirstChild.InnerText = userName
node["Password"].InnerText = password
node.LastChild.InnerText = domain

"doc" is an XML file structured like this
<Payload><Security><Username>test</Username><Password>test</Password><Domain>test</Domain></Security></Payload
Any ideas on why this is causing an error? This code runs fine on the computer (not in the compact framework) but I'm pretty sure all the functions are inthe compact framework. It compiles and deploys fine
thanks
greg
 
A

Alex Feinman [MVP]

And what are the XmlException details?

--
Alex Feinman
---
Visit http://www.opennetcf.org
edwardraoul said:
I have the following code in my progam to edit an xml file with the
correct data and the code when executed on the device keeps throwing an
XMLException error:
Error at this line:XmlNodeList nodeList = doc.GetElementsByTagName("Security");
foreach (XmlNode node in nodeList)
{
node.FirstChild.InnerText = userName;
node["Password"].InnerText = password;
node.LastChild.InnerText = domain;
}
"doc" is an XML file structured like this:
test</Domain></Security></Payload>
Any ideas on why this is causing an error? This code runs fine on the
computer (not in the compact framework) but I'm pretty sure all the
functions are inthe compact framework. It compiles and deploys fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top