I was really tired..zzZZZ. I couldn't even spell google.
Monday, July 30, 2007
Tuesday, July 24, 2007
Nothing big here, but a good start
I finally got a chance to sit down and wrote a basic XML parser in C#. Took me about an hour to learn the correct functions for this purpose, plus another hour to mess with Visual Studio 2005 and Visual Source Safe 2005. I was having problems with renaming in VSS...
/* LargeXMLReader reads an XML file and outputs out to the console */ using System; using System.Xml; namespace LargeXmlReader { class LargeXmlReader { /* Pass in your XML file and starts reading it */ public void readXml(String fileName) { XmlTextReader reader = new XmlTextReader(fileName); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: Console.Write( "<" + reader.Name + ">" + "\n"); break; case XmlNodeType.Text: Console.Write(reader.Value); Console.WriteLine(); break; case XmlNodeType.EndElement: Console.Write("<\\" + reader.Name + ">" + "\n"); break; } } } /* Execute me */ public static void Main() { LargeXmlReader largeXmlReader = new LargeXmlReader(); largeXmlReader.readXml("C:\\Temp\\TeraDataResultSet.xml"); } } }
Subscribe to:
Posts (Atom)