C#дXMLµÄ¼òµ¥Àý×Ó
Õâ¸öÀý×ÓÒª°Ñ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>
<price>999</price>
</book>
</bookstore>
2 bookstore.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace toxml
{
public class ToXml
{
public static void Main(string[] args)
{
//ʵÀý»¯Ò»¸öXmlDocument¶ÔÏó
XmlDocument xmlDoc = new XmlDocument();
//ʵÀý¶ÔÏó¶ÁȡҪдÈëµÄXMLÎļþ
xmlDoc.Load("bookstore.xml");
//²éÕÒ<bookstore>
XmlNode root = xmlDoc.SelectSingleNode("bookstore");
//´´½¨Ò»¸ö<book>½Úµã
XmlElement xe1 = xmlDoc.CreateElement("book");
//ÉèÖøýڵãgenreÊôÐÔ
xe1.SetAttribute("leixing", "music");
//ÉèÖøýڵãISBNÊôÐÔ
xe1.SetAttribute("ISBN", "56756");
 
Ïà¹ØÎĵµ£º
×î½ü¿Í»§Ë÷Òª²úÆ·µÄ¶þ´Î¿ª·¢Àà¿âÎĵµ,ÓÉÓÚ¿ª·¢¹ý³ÌÖв¢Ã»Óп¼Âǹý´ËÀàÎĵµ,¶øÇÒÏîÄ¿¹æ·¶±È½Ï£¬³ÖÐøÊ±¼ä±È½Ï³¤£¬¾ÊÖÈ˱Ƚ϶࣬»¹ÕæÊÇÂé·³,Èç¹ûÈ˹¤ÖÆ×÷ÎĵµÐèÒªÊÇÒ»¸ö±È½Ï´óµÄ¹¤³Ì.»¹ºÃÓÐÕâ¸öÎĵµÉú³É¹¤¾ß,Äܹ»¸ù¾ÝÏîÄ¿Éú³ÉÎĵµ,¶øÇÒ¸ñʽ¿´ÆðÀ´È·ÊµºÜרҵ.
Sa ......
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 ......
AjaxºÍjspµÄ¹ÖÏÖÏó
Èç¹ûÓÃAjaxÈ¥ÇëÇóÒ»¸öjspÒ³Ãæ£¬¸ÃjspÒ³Ãæ·µ»ØµÄÊÇxml£¨response.setContentType("text/xml; charset=GB2312");£©£¬²¢ÇÒ¸Ãjsp°üº¬ÏÂÃæÕâЩͷ@pageÖ¸ÁîµÄ»°£¬ÔòÔÚ¿Í»§¶Ëxml=XMLHttpRequest.responseXMLµÃµ½µÄÊÇÒ»¸ö²»°üº¬ÈÎÎñ¶«Î÷µÄxml¶ÔÏ󣬼´xml.childNodes.length½«»áÊÇ0.
......
ŪÁËÁ½Ì죬ÖÕÓڰѸ´ÔÓµÄxmlÎļþµÄÊý¾Ý¸ù¾Ý×Ô¼ºµÄÒªÇó¶Á³öÀ´£¬ÏÔʾÔÚÒ³ÃæÉÏÁË¡£flexͨ¹ýHTTPService×é¼þ·¢ËÍÇëÇ󣬶ÁÈ¡xmlÎļþÖÐÊý¾Ý£¬ÓÃxmllistcollection´æ´¢xmlÖÐijһ²¿·ÖÊý¾Ý£¬²¢°ó¶¨ÔÚgridview¿Ø¼þÉÏ¡£
xml£¬xmllist£¬xmllistcollectionÖÐÖ»ÓÐxmllistcollection¾ßÓÐÐ޸ĸüÐÂÊý¾ ......
µ÷ÊÔʱ·¢ÏÖÈÕÖ¾±¨ÈçÏ´íÎó org.xml.sax.SAXParseException
·¢ÏÖÊÇxml¶ÔÌØÊâ·ûºÅÒª×ö´¦Àí£¬¼¸¸öÌØÊâ·ûºÅÈçÏ£º
< < СÓÚºÅ
> > ´óÓÚºÅ
& & ºÍ
' ' µ¥ÒýºÅ
" " Ë«ÒýºÅ
ÔÚxmlÖаÑÌØÊâ·ûºÅÓÃÉÏÊöתϼ´ºÃÁË ......