« Only the biggest news in the history of I.T., and it's free! | Main | Advanced CSS Course »

New Video Code Warmup - XML

Yet another blockbuster video code warmup.  This one is on XML.  Most of us find ourselves working with XML.  Whoever thought it up was a genius.  It's very easy to work with using the .NET framework.  In this video we simply create a stream using the XmlWriter class and write XML directly out to the console.  After you watch just a little bit of the video you will get the idea of how easy it is.  Of course  should you need to work with DOM properties you will have to use the XML Document class but the XmlWriter Class works fast as heck for getting the job done!

You can view the video by clicking Here.

This is a screen shot of what the console looks like when you are done (I have my console background white and font color navy):

 

finished.jpg

 

Here is the code:

using System;

using System.Collections.Generic;

using System.Text;

using System.Xml;

namespace CodeWarmUp_xml

{

class Program

{

static void Main(string[] args)

{

XmlWriterSettings settings = new XmlWriterSettings();

settings.Indent = true;

using (XmlWriter writer = XmlWriter.Create(Console.Out,settings))

{

writer.WriteStartElement(
"Categories");

writer.WriteStartElement("DotNet");writer.WriteStartElement(

"Instructor");writer.WriteAttributeString("Name", "Jennifer Campion");

writer.WriteEndElement();

writer.WriteStartElement("Instructor");writer.WriteAttributeString(

"Name", "Mike Palermo");

writer.WriteEndElement();

writer.WriteEndElement();

writer.WriteStartElement(
"Cisco");

writer.WriteStartElement("Instructor");writer.WriteAttributeString(

"Name", "Mike Storm");

writer.WriteEndElement();

writer.WriteEndElement();

writer.WriteEndElement();

}

 

 

 

 

}

}

}

Posted on Wednesday, December 20, 2006 at 10:36AM by Registered CommenterSpike Xavier | CommentsPost a Comment

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.
Editor Permission Required
You must have editing permission for this entry in order to post comments.