Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 ......

ÓÃC#Éú³ÉWAPÒ³Ãæ½éÉÜ

ÊÖ»úÉÏÍøÔ½À´Ô½ÆÕ¼°£¬ÊÖ»úÖÖÀàÔ½À´Ô½¶à£¬Òª¿ª·¢Ò»¸ö¹©ÊÖ»ú·ÃÎÊÍøÕ¾²¢¼æÈÝËùÓв»Í¬ÀàÐ͵ÄÊÖ»úºÍä¯ÀÀÆ÷ÊǺܲ»ÈÝÒ׵쬱±¾©Ê¦·¶´óѧ×ÔϰÊÒ²éѯƽ̨µÄÊÖ»ú°æ×î³õÊÇÖ±½ÓÓÃASP.NETʵÏֵģ¬Ö»ÊÇÓÃCSS¶¨Òå³ÉÁËÊʺÏÊÖ»úÆÁÄ»µÄÒ³Ãæ£¬ËäȻͬѧÃÇ·ÃÎÊ»ù±¾Ã»ÓÐÎÊÌ⣬µ«ÊÇҲż¶û»áÓГ²»ÄÜÑ¡ÔñÏÂÀ­²Ëµ¥”¡¢“°´Å¥button²»Ä ......

flexͨ¹ýHTTPService×é¼þ¶ÁÈ¡¸´ÔӽṹµÄxmlÎļþ

    ŪÁËÁ½Ì죬ÖÕÓڰѸ´ÔÓµÄxmlÎļþµÄÊý¾Ý¸ù¾Ý×Ô¼ºµÄÒªÇó¶Á³öÀ´£¬ÏÔʾÔÚÒ³ÃæÉÏÁË¡£flexͨ¹ýHTTPService×é¼þ·¢ËÍÇëÇ󣬶ÁÈ¡xmlÎļþÖÐÊý¾Ý£¬ÓÃxmllistcollection´æ´¢xmlÖÐijһ²¿·ÖÊý¾Ý£¬²¢°ó¶¨ÔÚgridview¿Ø¼þÉÏ¡£
    xml£¬xmllist£¬xmllistcollectionÖÐÖ»ÓÐxmllistcollection¾ßÓÐÐ޸ĸüÐÂÊý¾ ......

VC¶ÁдXMLÎļþ

MSXML2::IXMLDOMDocumentPtr pDoc;
MSXML2::IXMLDOMElementPtr  xmlRoot ;
 // ´´½¨DOMDocument¶ÔÏó
 HRESULT hr  =  pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40));
 if ( ! SUCCEEDED(hr))
  { 
 MessageBox( " ÎÞ·¨´´½¨DOMDocument¶ÔÏó£¬Çë¼ì²é ......

xmlÖÐÌØÊâ·ûºÅµÄת»»

µ÷ÊÔʱ·¢ÏÖÈÕÖ¾±¨ÈçÏ´íÎó org.xml.sax.SAXParseException
·¢ÏÖÊÇxml¶ÔÌØÊâ·ûºÅÒª×ö´¦Àí£¬¼¸¸öÌØÊâ·ûºÅÈçÏ£º
&lt; < СÓÚºÅ
&gt; > ´óÓÚºÅ
&amp; & ºÍ
&apos; ' µ¥ÒýºÅ
&quot; " Ë«ÒýºÅ
ÔÚxmlÖаÑÌØÊâ·ûºÅÓÃÉÏÊöתϼ´ºÃÁË ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ