Need Help, How to read the xml?

i have a xml file that contins context like:

<cases>
<case>
<id>2</id>
<operator>abc</operator>
<saved>0</saved>
<Exectors>
<id>2</Id>
<t>1</t>
<name>abc</name>
<telephone>1234</telephone>
</Exectors>
</case>

<!-- more case node -->

</cases>

Each case node of the xml file contains two tables (case,exector ) .

How can i save the contents to related table

i think that you knew what i said!

thanks.




Answer this question

Need Help, How to read the xml?

  • Daniel E. marx

    Hi Benyu,

    There is a number of XmlTextReader samples available in MSDN and WWW. For example, http://msdn2.microsoft.com/en-us/library/system.xml.xmlreader.read.aspx. To check if the current node is <exector>, you need to write (reader.NodeType == XmlNodeType.Element && reader.Name == "exector"). If your XML file might contain namespaces, you should check (reader.NamespaceURI == "") as well. When you see <exector>, start reading its children, and read until you see </exector>, i.e. (reader.NodeType == XmlNodeType.EndElement && reader.Name == "exector").

    Hope it helps,
    Anton


  • SuranaSaurabh

    What data structures are you using for storing tables DataSet

    Thanks,
    Anton


  • CDR-Maverick-TG

    the data structure of table nearly as the xml file format.

    but the <exector> node is another table related to case.

    i adjust want to know how to get <exector> node and that child nodes then foreach case node!

    XmlTextReader reader = new XmlTextReader(@"E:\sample.xml");

    while(reader.Read())

    {

    //how to check out the node is <exector> or it's child nodes

    }



  • Need Help, How to read the xml?