reading XML files

Source: Internet
Author: User
Tags count manual string
Xml

1. xml file format


<?xml version= "1.0" encoding= "Utf-8"?>
<NodeList>
<node text= "GWGL" ></Node>
<node text= "manual filing" clsid= "header" >
<name>gwgl. Ep_pre_ems3_cus_head</name>
<Value>TRADE_CODE</Value>
</Node>
<node text= "manual Record" clsid= "single loss" >
<name>gwgl. Ep_pre_ems3_cus_consume</name>
<Value>TRADE_CODE</Value>
<Value>EXG_NO</Value>
<Value>IMG_NO</Value>
</Node>
</NodeList>
2, read the XML file function

<summary>
reading XML files
</summary>
<param name= "Name" > node name </param>
<param name= "ClassID" > Extended options Category </param>
<param name= "Dataobj" > Data source </param>
public void ReadXML (string Name, String classid, DataRowView dataobj)
{
Try
{
XmlDocument doc = new XmlDocument ();
Doc. Load (Application.startuppath + "\\Configure.xml");
XmlNodeList node = doc. selectSingleNode ("NodeList"). ChildNodes;
XmlNode TargetNode = null;
string s = node[0]. attributes["Text"]. Value;
for (int i = 1; i < node. Count; i++)
{
if (node[i). attributes["Text"]. Value = = Name
&& Node[i]. attributes["CLSID"]. Value = = ClassID)
{
TargetNode = Node[i];
Break
}
}
if (TargetNode!= null)
{
This.toolStrip1.Visible = true;
Count = Targetnode.ChildNodes.Count;
List = new String[count];
for (int j = 0; J < Count; J +)
{
LIST[J] = Targetnode.childnodes[j]. InnerText;
}
extendtable = list[0];
for (int i = 1; i < Count; i++)
//{
Columnname[i] = List[i];
//}
GetData (dataobj, s);
}
}
catch (Exception e)
{
MessageBox.Show (E.tostring ());
}
}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.