C#¶ÁÈ¡xmlµÄÎÊÌâ¡£
СµÜ²ËÄñ£¬´ÓÍøÉÏÕÒÁËÒ»¸ö¶ÁÈ¡xmlµÄ°ì·¨£¬×Ô¼º¸Äдºó´úÂëÈçÏ£º
C# code:
XmlDocument xmlDoc = new XmlDocument();
XmlTextReader reader = new XmlTextReader(HttpContext.Current.Server.MapPath("..\\TestSet.xml"));
xmlDoc.Load(reader);
XmlNodeList nodeList = xmlDoc.SelectSingleNode("TestSetting").ChildNodes;//»ñÈ¡Enrol½ÚµãµÄËùÓÐ×Ó½Úµã
foreach (XmlNode xn in nodeList)//±éÀúËùÓÐ×Ó½Úµã
{
XmlNodeList xnf1 = xmlDoc.ChildNodes;
foreach (XmlNode xn2 in xnf1)
{
XmlElement xe = (XmlElement)xn2;//½«×Ó½ÚµãÀàÐÍת»»ÎªXmlElementÀàÐÍ
//Ê¡ÂÔ²¿·Ö
}
}
XMLÎļþÈçÏ£º
XML code:
<?xml version="1.0" encoding="utf-8"?>
<TestSetting>
<Test>
<EnrolDate1>2009-10-01</EnrolDate1>
<EnrolDate2>2009-10-01</EnrolDate2>
<PrintDate1>2009-10-01</PrintDate1>
<PrintDate2>2009-10-01</PrintDate2>
<TestTime>200910</TestTime>
<SumPerson>0</SumPerson>
</Test>
</TestSetting>
Ö´ÐÐʱ±¨´í£ºÎÞ·¨½«ÀàÐÍΪ¡°System.Xml.XmlDeclarati
Ïà¹ØÎÊ´ð£º
vbÖÐÔõôͨ¹ýxmlÀ´½âÎöÊý¾Ý¿âÖеÄ×Ö¶ÎÖµ¡£
û°ì·¨ÓÃXML½âÎöÊý¾Ý¿âµÄ×Ö¶ÎÖµ£¬³ý·ÇÊý¾Ý¿âÖб£´æµÄÊÇXML¸ñʽµÄ×Ö·û´®Îĵµ¡£
XMLÓÃÀ´Õ¹Ê¾²ã´ÎµÄÊý¾Ý¡£
Êý¾Ý¿âÒ»°ãÊǶþάÊý¾Ý¡£
Êý¾Ý¿âÖб£´æµÄÊÇXML×Ö·û´®¸ñʽ£ ......
ÇëÎʸ÷λ´óʦ£¬ÎÒÏÖÔÚÐèÒª½«XMLµÄÊý¾ÝʵʱµÄ´æÈëµ½Êý¾Ý¿âÖУ¬ÎÒÊÇÓÃasp±àµÄ³ÌÐò£¬´óÁ¿Ãǰïæ·ÖÎö һϣ¡£¡£¡
ÏÂÃæÊÇÎÒµÄXMLÎļþ´úÂë
XML code:
<?xml version="1.0" encoding="utf-8"? ......
ÎÒÃ÷ÄêÁ˾ÍÒª±ÏÒµÁË ¿´µ½ÕÐÆ¸ÍøÉ϶àÊý¶¼ÊÇÕÐjavaµÄ ÊDz»ÊÇѧjava±Èc#ºÃÕÒ¹¤×÷ÄØ£¿
ÃÔã°¡
²»ÊÇÕâÑù °¡
ÒªÊÇÄãµÄc#ѧϰµÄºÃµÄ»°
Ò²¿ÉÒԵõ½ºÃµÄ¹¤×÷°¡
²»ÊÇÂð?
Õâ¸öÎÊÌâ¹Ø¼üÔÚÓÚ ......
txt ºÍXML ¸ñʽÏàÓ¦
²»½èÖúDataSet
µ¼Èë¶ÁÈ¡TXTÎļþ
È»ºóÖ±½ÓдÈëXML(ͬһÎļþ,²»Í¬Êý¾Ý,µÝÔöÔÊý¾ÝûÓб»¸²¸ÇÇé¿öÏÂÔö¼ÓÊý¾Ý.)
½Ì¸öÒªµã»ò×îºÃÊÇÓиö´úÂëÌáʾµÄ
¹ý·ºÃºº °ï¸öæÈö^^
²»»á£¬°ïÂ¥Ö÷ ......
ÎÒµÄXMLÅäÖÃÎļþÀïÃæÓÐÖÐÎÄ×Ö·û,Ò²ÓÐÀàËÆÓÚ=~@!ÕâÖÖ×Ö·û,encodeingÉèÖÃΪgb2312 ºÍ unicode,unicode UTF-8,½á¹û¶¼Ìáʾϵͳ´íÎó,,,Èç¹ûÉèÖÃΪgb2312µÄ»°,È¥µô=!@ÕâÖÖ×Ö·û,Ò»Çж¼Õý³£.
ÓÉÓÚÎ ......