为什么我在读取xml时节点没有setattribute和getattribute的属性,
只有根节点有呢?纳闷
------解决方案--------------------------------------------------------
直接这样取,或者赋值
string text = XmlNode.Attribute[ "name "].Value;
XmlNode.Attribute[ "name "].Value = "new value ";
------解决方案--------------------------------------------------------
((XmlElement)XmlDoc.SelectNodes( "EVI/FlatExcelSchema/Item ")[0]).GetAttribute( "topCell ");
供参考
------解决方案--------------------------------------------------------
if (oNode.Attributes.GetNamedItem( "readonly ") != null)
{
_TrReadOnly = oNode.Attributes.GetNamedItem( "readonly ").Value.ToString();
}
------解决方案--------------------------------------------------------
如果没有属性,先创建一个再加到节点上
XmlAttribute xmlAtt= xmlDoc.CreateAttribute( "name ");
xmlAtt.Value = " ";
xmlnode.Attributes.Append(xmlAtt);