C#ɾ³ýXML½áµãµÄ¼òµ¥Àý×Ó
½ÓÉÏһƪ
ɾ³ýÔgenreÊôÐÔ£¬É¾³ýleixing=loveµÄËùÓнáµã¡£
1 ÔxmlÎļþ bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="love" ISBN="1234123">
<title>who am i </title>
<author>who</author>
<price>999</price>
</book>
<book leixing="love" ISBN="56756">
<title>CS´ÓÈëÃŵ½¾«Í¨</title>
<author>ÀèÃ÷</author>
<price>222</price>
</book>
</bookstore>
2 program.cs
using System;
using System.Xml;
namespace ReadXml
{
class Class1
{
static void Main(string[] args)
{
//ʵÀý»¯Ò»¸öXmlDocument¶ÔÏó
XmlDocument xmlDoc = new XmlDocument();
//ʵÀý¶ÔÏó¶ÁȡҪдÈëµÄXMLÎļþ
xmlDoc.Load("bookstore.xml");
XmlNodeList xnl = xmlDoc.SelectSingleNode("bookstore").ChildNodes;
foreach (XmlNode xn in xnl)
{
XmlElement xe = (XmlElement)xn;
if (xe.GetAttribute("genre") == "love")
{
&n
Ïà¹ØÎĵµ£º
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Syste ......
ÊÖ»úÉÏÍøÔ½À´Ô½ÆÕ¼°£¬ÊÖ»úÖÖÀàÔ½À´Ô½¶à£¬Òª¿ª·¢Ò»¸ö¹©ÊÖ»ú·ÃÎÊÍøÕ¾²¢¼æÈÝËùÓв»Í¬ÀàÐ͵ÄÊÖ»úºÍä¯ÀÀÆ÷ÊǺܲ»ÈÝÒ׵ģ¬±±¾©Ê¦·¶´óѧ×ÔÏ°ÊÒ²éѯƽ̨µÄÊÖ»ú°æ×î³õÊÇÖ±½ÓÓÃASP.NETʵÏֵģ¬Ö»ÊÇÓÃCSS¶¨Òå³ÉÁËÊʺÏÊÖ»úÆÁÄ»µÄÒ³Ã棬ËäȻͬѧÃÇ·ÃÎÊ»ù±¾Ã»ÓÐÎÊÌ⣬µ«ÊÇҲż¶û»áÓГ²»ÄÜÑ¡ÔñÏÂÀ²Ëµ¥”¡¢“°´Å¥button²»Ä ......
Õâ¸öÀý×ÓÒª°Ñbookstore.xmlÎļþÔö¼ÓÒ»Ìõbook¼Ç¼
1 bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="love" ISBN="1234123">
<title>who am i </title>
<author>who</author>
  ......
ÐòÁл¯Êǽ«¶ÔÏóת»»³ÉÒ×ÓÚ´«ÊäµÄÐÎʽµÄ¹ý³Ì¡£ÀýÈ磬¿ÉÒÔÐòÁл¯¶ÔÏ󣬲¢Ê¹Óà HTTP ͨ¹ý Internet ÔÚ¿Í»§¶ËºÍ·þÎñÆ÷Ö®¼ä½øÐд«Êä¡£ÁíÒ»·½Ã棬·´ÐòÁл¯ÔÚÁ÷ÖÐÖØй¹½¨¶ÔÏó¡£
XML ÐòÁл¯Ö»½«¶ÔÏóµÄ¹«¹²×ֶκÍÊôÐÔÖµÐòÁл¯Îª XML Á÷¡£XML ÐòÁл¯²»°üÀ¨ÀàÐÍÐÅÏ¢¡£ÀýÈ磬Èç¹û Library ÃüÃû¿Õ¼äÖдæÔÚ Book ¶ÔÏó£¬Ôò²»Äܱ£Ö¤½«Ëü·´ ......