Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C#ÐÞ¸ÄXMLµÄ¼òµ¥Àý×Ó

½ÓÉÏһƪ¡¶C#дXMLµÄ¼òµ¥Àý×Ó¡·
Õâ¸öÀý×ÓÒªÐÞ¸ÄXMLÎļþÖнáµãµÄÊôÐԺͺÍÔªËØµÄÎı¾
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="music" ISBN="56756">
    <title>CS´ÓÈëÃŵ½¾«Í¨</title>
    <author>ºò½Ý</author>
    <price>222</price>
  </book>
</bookstore>
2 program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            //ʵÀý»¯Ò»¸öXmlDocument¶ÔÏó
            XmlDocument xmlDoc = new XmlDocument();
            //ʵÀý¶ÔÏó¶ÁȡҪдÈëµÄXMLÎļþ
            xmlDoc.Load("bookstore.xml");
            //»ñÈ¡bookstore½ÚµãµÄËùÓÐ×Ó½Úµã
            XmlNodeList nodeList = xmlDoc.SelectSingleNode("bookstore").ChildNodes;
            //±éÀúËùÓÐ×Ó½Úµã
            foreach (XmlNode xn in nodeList)
            {
                //½«×Ó½ÚµãÀàÐÍ


Ïà¹ØÎĵµ£º

asp.netµÄXMLͨÓòÙ×÷Àà

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 ......

flexÖÐʹÓÃhttpservice¶ÁÈ¡xmlÎļþ

1¡¢mian.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="HTTPSrv.send();" width="242" height="442">
<mx:Script>
<!--[CDATA[

import mx.rpc.events.ResultEv ......

XML Ôöɾ¸Ä²é

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Xml;
using System.Data;
public class Cls_XML
{
    #region ´´½¨xmlÎļþ
    /// <summary>
    /// ´´½¨xmlÎļþ
    /// ......

FOR XML PATH¾ÙÀý

´ó¼Ò¶¼ÖªµÀÔÚSQL ServerÖÐÀûÓà FOR XML PATH Óï¾äÄܹ»°Ñ²éѯµÄÊý¾ÝÉú³ÉXMLÊý¾Ý£¬ÏÂÃæÊÇËüµÄһЩӦÓÃʾÀý¡£
DECLARE @TempTable table(UserID int , UserName nvarchar(50));
insert into @TempTable (UserID,UserName) values (1,'a')
insert into @TempTable (UserID,UserName) values (2,'b')
 
select UserID, ......

ģʽºÍxmlѧϰ£¨2£©

Ò»£ºÉè¼ÆÄ£Ê½²¿·Ö
״̬ģʽ£¨state£©
״̬ģʽÀàËÆÓÚÒ»ÖÖ¼òµ¥µÄ¹¤×÷Á÷£¬ÓÃÀ´°Ñ´óÁ¿µÄÅжϷÖÖ§½øÐвð·Ö£¬¸øÃ¿Ò»ÖÖÅжÏÔö¼ÓÒ»¸ö״̬£¬Èç¹û²»Âú×ã¸ÃÅжϿÉÒÔ½øÐÐ״̬ת»»£¬ÖªµÀÓöµ½Âú×ãÌõ¼þΪֹ
ÕâÑù×öµÄºÃ´¦¾ÍÊÇ£¬µ±ÐèÒªÔö¼ÓÅжϵÄʱºò£¬²»ÐèÒª¸Ä±äÒѾ­´æÔڵĴúÂë¡£Ö»ÐèÒªÔö¼ÓÅжϵÄÀ࣬ԭʼÅжÏÀàÖÐÔö¼ÓеÄ״̬ת»»¡£
Ê ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ