XML ÐòÁл¯¼ò½é
ÐòÁл¯Êǽ«¶ÔÏóת»»³ÉÒ×ÓÚ´«ÊäµÄÐÎʽµÄ¹ý³Ì¡£ÀýÈ磬¿ÉÒÔÐòÁл¯¶ÔÏ󣬲¢Ê¹Óà HTTP ͨ¹ý Internet ÔÚ¿Í»§¶ËºÍ·þÎñÆ÷Ö®¼ä½øÐд«Êä¡£ÁíÒ»·½Ã棬·´ÐòÁл¯ÔÚÁ÷ÖÐÖØй¹½¨¶ÔÏó¡£
XML ÐòÁл¯Ö»½«¶ÔÏóµÄ¹«¹²×ֶκÍÊôÐÔÖµÐòÁл¯Îª XML Á÷¡£XML ÐòÁл¯²»°üÀ¨ÀàÐÍÐÅÏ¢¡£ÀýÈ磬Èç¹û Library ÃüÃû¿Õ¼äÖдæÔÚ Book ¶ÔÏó£¬Ôò²»Äܱ£Ö¤½«Ëü·´ÐòÁл¯ÎªÍ¬Ò»ÀàÐ͵ĶÔÏó¡£
×¢Òâ:
XML ÐòÁл¯²»ÄÜת»»·½·¨¡¢Ë÷ÒýÆ÷¡¢Ë½ÓÐ×ֶλòÖ»¶ÁÊôÐÔ£¨Ö»¶Á¼¯ºÏ³ýÍ⣩¡£ÒªÐòÁл¯¶ÔÏóµÄËùÓй«¹²ºÍ˽ÓÐ×ֶκÍÊôÐÔ£¬ÇëʹÓà BinaryFormatter ¶ø²»ÒªÊ¹Óà XML ÐòÁл¯¡£
XML ÐòÁл¯ÖеÄÖÐÐÄÀàÊÇ XmlSerializer À࣬¸ÃÀàÖÐ×îÖØÒªµÄ·½·¨ÊÇ Serialize ºÍ Deserialize ·½·¨¡£XmlSerializer ´´½¨ C# Îļþ²¢½«Æä±àÒëΪ .dll Îļþ£¬ÒÔÖ´ÐдËÐòÁл¯¡£
¶ÔÏóÖеÄÊý¾ÝÊÇÓñà³ÌÓïÑÔ¹¹ÔìÀ´ÃèÊöµÄ£¬ÈçÀà¡¢×ֶΡ¢ÊôÐÔ (Property)¡¢»ùÔªÀàÐÍ¡¢Êý×飬ÉõÖÁ XmlElement »ò XmlAttribute ¶ÔÏóÐÎʽµÄǶÈë XML¡£¿ÉÒÔ´´½¨×Ô¼ºµÄÓÃÊôÐÔ (Attribute) Åú×¢µÄÀ࣬Ҳ¿ÉÒÔʹÓà XML ¼Ü¹¹¶¨Ò幤¾ßÉú³É»ùÓÚÏÖÓÐ XML ¼Ü¹¹µÄÀà¡£
Èç¹ûÓÐ XML ¼Ü¹¹£¬Ôò¿ÉÒÔÔËÐÐ XML ¼Ü¹¹¶¨Ò幤¾ßÉú³ÉÒ»×éÀ࣬½«Õâ×éÀàµÄÀàÐÍÇ¿ÖÆΪ´Ë¼Ü¹¹£¬²¢ÓÃÊôÐÔ (Attribute) ½øÐÐÅú×¢¡£µ±ÐòÁл¯ÕâÖÖÀàµÄʵÀýʱ£¬Éú³ÉµÄ XML ·ûºÏ XML ¼Ü¹¹¡£¶ÔÓÚÕâÖÖÀ࣬¿ÉÒÔ²ÉÓÃÒ×ÓÚ²Ù×÷µÄ¶ÔÏóÄ£ÐͽøÐбà³Ì£¬Í¬Ê±È·±£Éú³ÉµÄ XML ·ûºÏ XML ¼Ü¹¹¡£ÕâÊÇʹÓà .NET Framework ÖеÄÆäËûÀࣨÈç XmlReader ºÍ XmlWriter Àࣩ·ÖÎöºÍ±àд XML Á÷µÄÁíÒ»ÖÖ·½·¨¡£
ÊôÐÔ¿É¿ØÖÆ XmlSerializer ÀàÉú³ÉµÄ XML Á÷£¬´Ó¶øÔÊÐíÄúÉèÖà XML Á÷µÄ XML ÃüÃû¿Õ¼ä¡¢ÔªËØÃû³Æ¡¢ÊôÐÔÃû³ÆµÈ¡£
XmlSerializer Àà¿ÉÒÔ½øÒ»²½ÐòÁл¯¶ÔÏó²¢Éú³É±àÂëµÄ SOAP XML Á÷¡£XmlSerializer ÀàÉú³ÉÓÉ XML Web services ´´½¨²¢´«µÝ¸ø XML Web services µÄ SOAP ÏûÏ¢¡£Òª¿ØÖÆ SOAP ÏûÏ¢£¬¿ÉÒÔ½«ÊôÐÔÓ¦ÓÃÓÚÔÚ XML Web services Îļþ (.asmx) ÖÐÕÒµ½µÄÀà¡¢·µ»ØÖµ¡¢²ÎÊýºÍ×ֶΡ£ÓÉÓÚ XML Web services ¿ÉÒÔʹÓÃÎı¾»ò±àÂëµÄ SOAP Ñùʽ£¬Òò´Ë¼È¿ÉÒÔʹÓÓÓÃÀ´¿ØÖÆ XML ÐòÁл¯µÄÊôÐÔ”ÖÐÁгöµÄÊôÐÔ£¬Ò²¿ÉÒÔʹÓÓÓÃÀ´¿ØÖƱàÂëµÄ SOAP ÐòÁл¯µÄÊôÐÔ”ÖÐÁгöµÄÊôÐÔ¡£
XmlSerializer Ó¦ÓóÌÐòµÄ°²È«×¢ÒâÊÂÏî
´´½¨Ó¦ÓóÌÐòÀ´Ê¹Óà XmlSerializer ʱ£¬Ó¦×¢ÒâÒÔϼ¸Ïî¼°Æ京Ò壺
XmlSerializer ÔÚ TEMP »·¾³±äÁ¿ÃüÃûµÄĿ¼Öд´½¨ C# (.cs) Îļþ²¢½«Æä±àÒëΪ .dll Îļþ£»ÕâЩ DLL Îļþ½«½øÐÐÐòÁл¯¡£
×¢Òâ:
¿ÉÔ¤Ï
Ïà¹ØÎĵµ£º
1£©DOM£¨JAXP Crimson½âÎöÆ÷£©
DOMÊÇÓÃÓëƽ̨ºÍÓïÑÔÎ޹صķ½Ê½±íʾXMLÎĵµµÄ¹Ù·½W3C±ê×¼¡£DOMÊÇÒÔ²ã´Î½á¹¹×éÖ¯µÄ½Úµã»òÐÅϢƬ¶ÏµÄ¼¯ºÏ¡£Õâ¸ö²ã´Î½á¹¹ÔÊÐí¿ª·¢ÈËÔ±ÔÚÊ÷ÖÐÑ°ÕÒ
Ìض¨ÐÅÏ¢¡£·ÖÎö¸Ã½á¹¹Í¨³£ÐèÒª¼ÓÔØÕû¸öÎĵµºÍ¹¹Ôì²ã´Î½á¹¹£¬È»ºó²ÅÄÜ×öÈκι¤×÷¡£ÓÉÓÚËüÊÇ»ùÓÚÐÅÏ¢²ã´ÎµÄ£¬Òò¶øDOM±» ......
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 ......
ZT:http://www.mobpub.net/archiver/?tid-28.html
Symbianѧϰ±Ê¼Ç(15)——½âÎöXMLÎļþ(ÉÏ)
½ñÌìÏë·ÖÏíµÄÊÇÈçºÎÔÚSymbianƽ̨ÉϽâÎöXMLÎļþ£¬²»ÐèÒªµÚÈý·½µÄ¶«Î÷£¬SymbianÒѾΪÎÒÃÇÌṩÁËÕâ¸öÀàCParser¡£
ÍøÉÏÒ²ÓÐÕâ·½ÃæµÄ×ÊÁÏ£¬½¨Òé²Î¿¼£º
[url]http://wiki.forum.nokia.com/index.php/How_to_parse_XML_fi ......
MSXML2::IXMLDOMDocumentPtr pDoc;
MSXML2::IXMLDOMElementPtr xmlRoot ;
// ´´½¨DOMDocument¶ÔÏó
HRESULT hr = pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40));
if ( ! SUCCEEDED(hr))
{
MessageBox( " ÎÞ·¨´´½¨DOMDocument¶ÔÏó£¬Çë¼ì²é ......
Ò»£ºÉè¼Æģʽ²¿·Ö
״̬ģʽ£¨state£©
״̬ģʽÀàËÆÓÚÒ»ÖÖ¼òµ¥µÄ¹¤×÷Á÷£¬ÓÃÀ´°Ñ´óÁ¿µÄÅжϷÖÖ§½øÐвð·Ö£¬¸øÿһÖÖÅжÏÔö¼ÓÒ»¸ö״̬£¬Èç¹û²»Âú×ã¸ÃÅжϿÉÒÔ½øÐÐ״̬ת»»£¬ÖªµÀÓöµ½Âú×ãÌõ¼þΪֹ
ÕâÑù×öµÄºÃ´¦¾ÍÊÇ£¬µ±ÐèÒªÔö¼ÓÅжϵÄʱºò£¬²»ÐèÒª¸Ä±äÒѾ´æÔڵĴúÂë¡£Ö»ÐèÒªÔö¼ÓÅжϵÄÀ࣬ÔʼÅжÏÀàÖÐÔö¼ÓеÄ״̬ת»»¡£
Ê ......