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");
 
Ïà¹ØÎĵµ£º
private void save_db(){
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings[""].ToString());
SqlCommand comm = new SqlCommand();
conn.Open();
SqlTransaction rollbk2= conn.BeginTransaction();
& ......
ŪÁËÁ½Ì죬ÖÕÓڰѸ´ÔÓµÄxmlÎļþµÄÊý¾Ý¸ù¾Ý×Ô¼ºµÄÒªÇó¶Á³öÀ´£¬ÏÔʾÔÚÒ³ÃæÉÏÁË¡£flexͨ¹ýHTTPService×é¼þ·¢ËÍÇëÇ󣬶ÁÈ¡xmlÎļþÖÐÊý¾Ý£¬ÓÃxmllistcollection´æ´¢xmlÖÐijһ²¿·ÖÊý¾Ý£¬²¢°ó¶¨ÔÚgridview¿Ø¼þÉÏ¡£
xml£¬xmllist£¬xmllistcollectionÖÐÖ»ÓÐxmllistcollection¾ßÓÐÐ޸ĸüÐÂÊý¾ ......
µ÷ÊÔʱ·¢ÏÖÈÕÖ¾±¨ÈçÏ´íÎó org.xml.sax.SAXParseException
·¢ÏÖÊÇxml¶ÔÌØÊâ·ûºÅÒª×ö´¦Àí£¬¼¸¸öÌØÊâ·ûºÅÈçÏ£º
< < СÓÚºÅ
> > ´óÓÚºÅ
& & ºÍ
' ' µ¥ÒýºÅ
" " Ë«ÒýºÅ
ÔÚxmlÖаÑÌØÊâ·ûºÅÓÃÉÏÊöתϼ´ºÃÁË ......