Hello
I found some examples about this subject. Some of the examples gived a method to modify attribute with SelectNodes()
or SelectSingleNode()
, and others gived the method to modify attribute with someElement.SetAttribute("attribute-name", "new value");
But I still confused that how to build the relation if I only used a XpathNodeItterator it
?
Assumed I defined as below,
System.Xml.XPath.XPathDocument doc = new XPathDocument(xmlFile);
System.Xml.XPath.XPathNavigator nav = doc.CreateNavigator();
System.Xml.XPath.XPathNodeIterator it;
it = nav.Select("/Equipment/Items/SubItmes");
while (it.MoveNext())
{
name = it.Current.GetAttribute("name ", it.Current.NamespaceURI);
int vidFromXML = int.Parse(it.Current.GetAttribute("vid", it.Current.NamespaceURI));
if (vidFromXML = vid)
{
// How can I find the relation between it and element and node? I want to modify name attribute value.
}
}
Is there a method like it.setAttribute(name, "newValue")
?