i have an xml schema file consisting of data in the following manner
....................
.......
...............
..................
[U][B]i would like to get the data from
xs:element name
xs:documentation
xs:enumeration value[/B][/U]
i had the following code :
using System;
using System.Xml;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace ReadXMLfromFile
{
///
/// Summary description for Class1.
///
class Class1
{
static void Main(string[] args)
{
TextWriter tws = new StreamWriter("0.txt");
XmlTextReader reader = new XmlTextReader ("gribv-2schema.xsd");
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element: // The node is an element.
Console.Write("<" + reader.Name);
Console.WriteLine(">");
string documentation = "xs:documentation";
if (reader.Name == documentation) { Console.WriteLine("Element"); }
tws.WriteLine("<" + reader.Name + ">");
Console.ReadLine();
break;
case XmlNodeType.Text: //Display the text in each element.
Console.WriteLine (reader.Value);
tws.WriteLine(reader.Value);
break;
case XmlNodeType.EndElement: //Display the end of the element.
Console.Write("" + reader.Name);
Console.WriteLine(">");
tws.WriteLine("<" + reader.Name + ">");
break;
}
}
Console.ReadLine();
}
}
}
but it does not seem to read out all the data ,could any one of you please render me help
thanks in advance !
tom
Roei BarPosted Sep 10, 2009, 5:36 AM
here is a post for you to read
http://www.codeproject.com/KB/XML/XMLSchemaPlugin.aspx