Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/02/2012, 16:31
Ka0stj
 
Fecha de Ingreso: febrero-2010
Ubicación: México
Mensajes: 738
Antigüedad: 14 años, 2 meses
Puntos: 37
Respuesta: Problema con XMl C#

Prueba con lo siguiente:

Código C#:
Ver original
  1. //- Crear un objeto XmlDocument
  2.             XmlDocument xDoc = new XmlDocument();
  3.  
  4.             //- Cargar el XML que se va a modificar
  5.             xDoc.Load("c:/Archivos/archivo.xml");
  6.  
  7.             //- OBtener los elementos de album
  8.             XmlNodeList lista = xDoc.GetElementsByTagName("album");
  9.  
  10.             //- Recorrer los elementos de la lista
  11.             foreach (XmlElement nodo in lista)
  12.             {
  13.                 //- Verificar si el titulo es hola
  14.                 if (nodo.GetAttribute("title").ToString() == "hola")
  15.                 {
  16.                     //- Crear un Attribute
  17.                     XmlAttribute nodeAttribute = xDoc.CreateAttribute("NewNode");
  18.                     //- Asignar un valor al Attribute
  19.                     nodeAttribute.Value = "abc";
  20.                     //- Agregar el Attribute al Nodo
  21.                     nodo.Attributes.Append(nodeAttribute);
  22.                 }
  23.             }

Espero y sea lo que buscas.
__________________
http://ka0stj.wordpress.com/