Created
June 23, 2014 22:05
-
-
Save Fhernd/2fd00b6a7379355e9fb1 to your computer and use it in GitHub Desktop.
Exploración de nodos con XmlReader en C#.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Xml; | |
using System.IO; | |
namespace Articulos.Preguntas | |
{ | |
public sealed class ExploracionNodos | |
{ | |
public static void Main() | |
{ | |
XmlReader lectorXml = XmlReader.Create ("libros.xml"); | |
// Este método obvia los nodos que no son parte del contenido, y pasa | |
// directamente a nodos de contenido: | |
lectorXml.MoveToContent(); | |
while (lectorXml.Read()) | |
{ | |
// Muestra el contenido de todos los nodos del documento XML: | |
if (lectorXml.NodeType == XmlNodeType.Text) | |
{ | |
Console.WriteLine (lectorXml.Value.ToString()); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment