Hey all,
Not sure if this is a C# or a XML question but i decided to post it here as i'm trying to use C# to update XML.
I'm trying to update XML document Attributes from a XLS document. The XML documents are 1000's of lines long and there a many files. i need to iterate through the XML and find refernce tag then continue search through the parent element and up date two sibling elements. So fare this is what i've got
foreach(XmlNode node in lstStampsets)
{
//node.ChildNodes;
//node.NextSibling();
if (node.HasChildNodes)
{
int i = 0;
bool bFoundflag = false;
string mystring = node.FirstChild.InnerText.ToString();
while(node.ChildNodes.Count > i)
{
string Xmlstring = node.ChildNodes.Item(i).Name.ToString();
if (Xmlstring == "sg_no")
{
string sCurrentSGnumber = node.ChildNodes.Item(i).InnerXml.ToString();
if (sCurrentSGnumber == sCurrentXLSSGnumber)
{
bFoundflag = true;
}
}
if (Xmlstring == "unused_price" & bFoundflag == true)
{
if (node.ChildNodes.Item(i).InnerText.ToString() != sXLSnewprice)
{
}
}
i++;
}
}
What i need to do is when this code executes is...
if (node.ChildNodes.Item(i).InnerText.ToString() != sXLSnewprice)
{
}
to update the attribute of the node i'm currently looking at with a string from a variable.
Can anyone help?