XML ÐòÁл¯Ê¾Àý
XML ÐòÁл¯¿ÉÒÔ²ÉÓôӼòµ¥µ½¸´ÔӵĶàÖÖÐÎʽ¡£ÀýÈ磬¿ÉÒÔÐòÁл¯Ö»°üº¬¹«¹²×ֶκ͹«¹²ÊôÐÔµÄÀ࣬Èç XML ÐòÁл¯¼ò½éÖÐËùʾ¡£ÏÂÃæµÄ´úÂëʾÀýÌÖÂÛ¸÷Öָ߼¶·½°¸£¬°üÀ¨ÈçºÎʹÓà XML ÐòÁл¯Éú³É·ûºÏÌض¨ XML ¼Ü¹¹ (XSD) ÎĵµµÄ XML Á÷¡£
ÐòÁл¯Êý¾Ý¼¯
³ýÁËÐòÁл¯¹«¹²ÀàµÄʵÀýÍ⣬»¹¿ÉÐòÁл¯ DataSet µÄʵÀý£¬ÈçÏÂÃæµÄ´úÂëʾÀýËùʾ¡£
private void SerializeDataSet(string filename){
XmlSerializer ser = new XmlSerializer(typeof(DataSet));
// Creates a DataSet; adds a table, column, and ten rows.
DataSet ds = new DataSet("myDataSet");
DataTable t = new DataTable("table1");
DataColumn c = new DataColumn("thing");
t.Columns.Add(c);
ds.Tables.Add(t);
DataRow r;
for(int i = 0; i<10;i++){
r = t.NewRow();
r[0] = "Thing " + i;
t.Rows.Add(r);
}
TextWriter writer = new StreamWriter(filename);
ser.Serialize(writer, ds);
writer.Close();
}
ÐòÁл¯ XmlElement ºÍ XmlNode
»¹¿ÉÐòÁл¯ XmlElement »ò XmlNode ÀàµÄʵÀý
private void SerializeElement(string filename){
XmlSerializer ser = new XmlSerializer(typeof(XmlElement));
XmlElement myElement=
new XmlDocument().CreateElement("MyElement", "ns");
myElement.InnerText = "Hello World";
TextWriter writer = new StreamWriter(filename);
ser.Serialize(writer, myElement);
writer.Close();
}
private void SerializeNode(string filename){
XmlSerializer ser = new XmlSerializer(typeof(XmlNode));
XmlNode myNode= new XmlDocument().
CreateNode(XmlNodeType.Element, "MyNode", "ns");
myNode.InnerText = "Hello Node";
TextWriter writer = new StreamWriter(filename);
ser.Serialize(writer, myNode)
Ïà¹ØÎĵµ£º
1. ½éÉÜ
1£©DOM(JAXP Crimson½âÎöÆ÷)
DOMÊÇÓÃÓëƽ̨ºÍÓïÑÔÎ޹صķ½Ê½±íʾXMLÎĵµµÄ¹Ù·½W3C±ê×¼¡£DOMÊÇÒÔ²ã´Î½á¹¹×éÖ¯µÄ½Úµã»òÐÅϢƬ¶ÏµÄ¼¯ºÏ¡£Õâ¸ö²ã´Î½á¹¹ÔÊÐí¿ª·¢ÈËÔ±ÔÚÊ÷ÖÐÑ°ÕÒÌض¨ÐÅÏ¢¡£·ÖÎö¸Ã½á¹¹Í¨³£ÐèÒª¼ÓÔØÕû¸öÎĵµºÍ¹¹Ôì²ã´Î½á¹¹£¬È»ºó²ÅÄÜ×öÈκι¤×÷¡£ÓÉÓÚ ......
ÄܶÁдÈκÎXMLÅäÖÃÎļþ£¬ÄÜʵÏÖÓû§²ãÃæµÄ¼Ó½âÃÜ£¬ÒÔÏ´úÂëÖеÄB64Eº¯ÊýΪ¼ÓÃܺ¯Êý£¬B64DΪ½âÃܺ¯Êý£¬¿ÉÒÔ×Ô¼º±àд
Éú³ÉµÄXML¸ù½ÚµãΪZBS£¬¿ÉÒÔÌ滻ΪÆäËüÓÐÒâÒåµÄ½ÚµãÃû³Æ
Option Explicit
Public xmlDoc As DOMDocument
Public aNode As IXMLDOMElement 'µ±Ç°¼¤»îNode
Public xmlFilePath As String, ReadOnly As Bo ......
XMLÖÐÒ»ÖÖÀ©Õ¹µÄ±ê¼ÇÓïÑÔ,Ëü¾ßÓкܺõÄÀ©Õ¹ÐÔ±ê¼Ç.±¾ÎÄͨ¹ýXMLʵÏÖ²»Í¬Êý¾Ý¿âµÄ¶¨Òå,ʵÏÖ¶ÔXMLÊý¾Ý¿âµÄ·ÃÎʺÍÒì¹¹Êý¾Ý¿âÖ®¼äµÄ»¥·Ã.
¡¡¡¡¹Ø¼ü´Ê:XML Òì¹¹Êý¾Ý¿â ÐÅÏ¢½»»» Êý¾Ý¿â·ÃÎÊ
1 ÒýÑÔ
¡¡¡¡XML(Extensible Markup Language)ËüÊÇÓÉW3C×éÖ¯ÓÚ1998Äê2Ô &nb ......
ŪÁËÁ½Ì죬ÖÕÓڰѸ´ÔÓµÄxmlÎļþµÄÊý¾Ý¸ù¾Ý×Ô¼ºµÄÒªÇó¶Á³öÀ´£¬ÏÔʾÔÚÒ³ÃæÉÏÁË¡£flexͨ¹ýHTTPService×é¼þ·¢ËÍÇëÇ󣬶ÁÈ¡xmlÎļþÖÐÊý¾Ý£¬ÓÃxmllistcollection´æ´¢xmlÖÐijһ²¿·ÖÊý¾Ý£¬²¢°ó¶¨ÔÚgridview¿Ø¼þÉÏ¡£
xml£¬xmllist£¬xmllistcollectionÖÐÖ»ÓÐxmllistcollection¾ßÓÐÐ޸ĸüÐÂÊý¾ ......
µ÷ÊÔʱ·¢ÏÖÈÕÖ¾±¨ÈçÏ´íÎó org.xml.sax.SAXParseException
·¢ÏÖÊÇxml¶ÔÌØÊâ·ûºÅÒª×ö´¦Àí£¬¼¸¸öÌØÊâ·ûºÅÈçÏ£º
< < СÓÚºÅ
> > ´óÓÚºÅ
& & ºÍ
' ' µ¥ÒýºÅ
" " Ë«ÒýºÅ
ÔÚxmlÖаÑÌØÊâ·ûºÅÓÃÉÏÊöתϼ´ºÃÁË ......