Problem with setting the value on a node of type element in xml
Posted on 2004-10-14
I am trying to add a new record to my XML file. I was able to create the record and its fields, but when I tried to add values to the fields, I got the error: "Cannot set a value on node type: Element".
I am confident that I have something missing in my code, that it is not making it recognize the ability to set the value of my elements.
Here is a sample of my code:
XmlDocument SrcDoc = new XmlDocument();
XmlNode RootNode = SrcDoc.DocumentElement;
//create a new table node
XmlNode Newtable = SrcDoc.CreateNode(XmlNodeType.Element, "table", "");
//create the sub node
XmlNode ExtNode = SrcDoc.CreateNode(XmlNodeType.Element, "Ext","");
//fill the data in ----------------------------------my error is here
ExtNode.Value = newext; // being passed to the subroutine
//add the node to the new table node
//add the new table node to the root
//save the docment back to the file
Thank you in advance for your prompt help.