que tienen un XML (esto es exactamente lo que parece):cómo cambiar nodo XML valores
<PolicyChangeSet schemaVersion="2.1" username="" description="">
<Attachment name="" contentType="">
<Description/>
<Location></Location>
</Attachment>
</PolicyChangeSet>
Esto es en la máquina del usuario.
Necesito agregar valores a cada nodo: nombre de usuario, descripción, nombre del archivo adjunto, tipo de contenido y ubicación.
Esto es lo que tengo hasta ahora:
string newValue = string.Empty;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(filePath);
XmlNode node = xmlDoc.SelectSingleNode("/PolicyChangeSet");
node.Attributes["username"].Value = AppVars.Username;
node.Attributes["description"].Value = "Adding new .tiff image.";
node.Attributes["name"].Value = "POLICY";
node.Attributes["contentType"].Value = "content Typeeee";
//node.Attributes["location"].InnerText = "zzz";
xmlDoc.Save(filePath);
Cualquier ayuda?
que funcionó :) ... i sólo puede aceptar su respuesta en 10 minutos aunque. thx Jan! – Testifier
¿cómo agregaría un valor para "ubicación"? es solo entre <>> ... ?? – Testifier
En cualquier momento :) Mire la propiedad 'InnerText' de XmlNode. – Jan