Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

³¬¼¶¼òµ¥£ºÊ¹ÓÃFOR XML AUTO¿ØÖÆXMLÊä³ö(Òëת)

ÕâƪÎÄÕÂÃèÊöÈçºÎͨ¹ýʹÓÃFOR XML AUTO¸üºÃµÄ¿ØÖÆXMLÊä³ö¸ñʽ¡£ÀýÈçÌí¼ÓXML±ê¼Ç¡£ÓÃÕâ¸öÀ´Ìæ´úÄÑÓÚÀí½âµÄFOR XML EXPLICIT Óï¾ä¡£Èç¹ûÄãÔÚÓ¦ÓóÌÐòÖм´½«·´ÐòÁл¯Êä³öµÄXML£¬Äã¾Í»á¾õµÃÕâ¸öÐÅÏ¢¶ÔÄãÓÐÓá£
    ÔÚFor XML´Ó¾äÖУ¬Äúͨ³£Ê¹ÓÃÏÂÁз½Ê½Ö®Ò»£º
    RAW
    AUTO
    EXPLICIT
    PATH
    Èç¹ûÄãÏëÍêÈ«ÕƿزúÉúµÄXML£¬¿ÉÒÔʹÓÃFOR XML EXPLICIT¡£µ«ÊÇËüÀí½âÆðÀ´Ï൱µÄÀ§ÄÑ£¬ºóÃ滹Ҫά»¤¸´ÔÓµÄselectÓï¾ä¡£FOR XML AUTO ÄܲúÉú×î¿É¶ÁµÄSELECTÓï¾ä£¬µ«ÊÇËüÒ²ÓÐȱµã£¬²»ÈÝÒ׿ØÖÆÉú³ÉµÄXML¡£µ«Ê¹ÓÃһЩ¼¼ÇÉ£¬ÀýÈçͨ¹ýʹÓöîÍâµÄPATHÑ¡ÏÄã¿ÉÒÔ×öһЩ³¬¹ýÄãÔ¤ÆÚµÄÊÂÇé¡£RAWÑ¡ÏîÊǺÜÉÙʹÓã¬Òò´Ë²»ÌÖÂÛ¡£PATH Ñ¡ÏîÔÊÐíÄúºÜÈÝÒ׵ػìºÏÊôÐÔºÍÔªËØ¡£ÏÖÔÚ£¬ÈÃÎÒÃÇÀ´Ê¹ÓÃFOR XML AUTO¡£
    ÔÚÕâ¸öÀý×ÓÖУ¬ÎÒÃÇʹÓõÄÊÇ1£ºN¹ØϵµÄÁ½¸ö¼òµ¥µÄÊý¾Ý±í¡£Ò»¸ö±í£¨SalesOrder£©°üº¬¿Í»§ÐÅÏ¢µÄ¶©µ¥£¬ÀýÍâÒ»ÕÅ±í£¨Items£©Öаüº¬µÄ¾ßÌåµÄÏî¡£Ò»¸ö¶©µ¥¿ÉÒÔÓжà¸öÏһ¸öÏîÍùÍùÖ»ÊôÓÚÒ»¸ö¶©µ¥¡£
   ÒÔ×îÈÝÒ׵ĿªÊ¼¡£
 
SELECT * from salesorder
    ²úÉú£º
ordernumber customername customerstreet
----------- ------------ --------------
1           parker       first av  
2           lesley       sec av
    Èç¹ûÄãÏëҪʹ½á¹û¼¯ÊÇXML£¬ÎÒÃÇÌí¼ÓFOR XML AUTO Óï¾ä£º
SELECT * from salesorder FOR XML AUTO
    Ëü²úÉú£º
<salesorder ordernumber="1" customername="parker" customerstreet="first av"/>
<salesorder ordernumber="2" customername="lesley" customerstreet="sec av"/>
    ÏÖÔÚ£¬×Ö¶ÎÊÇ×÷ÊôÐԵģ¬´ó¶àÊýÇé¿öÏÂÏ£ÍûËûÃÇÊÇÔªËØ¡£ÎªÁË×öµ½Õâµã£¬Ìí¼ÓELEMENTS ²ÎÊý
SELECT * from salesorder FOR XML AUTO, ELEMENTS
  


Ïà¹ØÎĵµ£º

XML CDATA

 
ÔÚXMLÎĵµÖеÄËùÓÐÎı¾¶¼»á±»½âÎöÆ÷½âÎö¡£
Ö»ÓÐÔÚCDATA²¿¼þÖ®ÄÚµÄÎı¾»á±»½âÎöÆ÷ºöÂÔ¡£
½âÎöÊý¾Ý
XML ½âÎöÆ÷ͨ³£Çé¿öÏ»ᴦÀíXMLÎĵµÖеÄËùÓÐÎı¾¡£
µ±XMLÔªËر»½âÎöµÄʱºò£¬XMLÔªËØÄÚ²¿µÄÎı¾Ò²»á±»½âÎö:
<message>This text is also parsed</message>
XML½âÎöÆ÷ÕâÑù×öµÄÔ­ÒòÊÇXMLÔªËØÄÚ²¿¿ÉÄÜ» ......

asp.net ¶ÔxmlÎļþµÄ¶Áд,Ìí¼Ó,ÐÞ¸Ä,ɾ³ý²Ù×÷

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
private XmlDo ......

ÀûÓÃSqlHelper(ExecuteXmlReaderʹÓÃ)£¬×ª»»µ½xml¸ñʽ

ÀûÓÃsqlhelperÖеÄExcuteXmlReader·½·¨£¬¶ÁÈ¡Êý¾Ý²¢±£´æΪxmlÎļþ     
 string strConn = Properties.Settings.Default.Connections;
           SqlConnection connection = new SqlConnection(strConn);
    & ......

C++Öд¦ÀíXMLÎļþ

дUnmanaged CodeÔÚ.NETʱ´ú³ÉΪһÖֺܱ¯²ÒµÄÊ£¬µ±ÄãÐèÒª´¦ÀíXMLÎļþʱ£¬ÕâÖָоõ»á±äµÃÓÈÆäÇ¿ÁÒ¡£FCLÖеÄSystem.XML¶à¼òµ¥°¡£¬Á¬Steve Ballmer¶¼ÖªµÀÔõôÓá£
ÊÂÇé²»»á×ÜÊÇÄÇôÀíÏëµÄ£¬¼ÙÈçÄãÒªÔÚC/C++³ÌÐòÀï´¦ÀíXMLÔõô°ìÄØ£¿
Ñ¡ÔñÒ»£ºÊÐÃæÉϵÄXML lib»¹ÊÇÓм¸¸öµÄ£¬×îÓÐÃûµÄµ±È»ÊÇlibXML¡£ÎÒÒ»ÄêÇ°Óùý£¬ºÜ²»´í£¬ÎÒ»¹ ......

TinyXML£ºÒ»¸öÓÅÐãµÄC++ XML½âÎöÆ÷


TinyXML£ºÒ»¸öÓÅÐãµÄC++ XML½âÎöÆ÷
¶ÁÈ¡ºÍÉèÖÃxmlÅäÖÃÎļþÊÇ×î³£ÓõIJÙ×÷£¬ÊÔÓÃÁ˼¸¸öC++µÄXML½âÎöÆ÷£¬¸öÈ˸оõTinyXMLÊÇʹÓÃÆðÀ´×îÊæ·þµÄ£¬ÒòΪËüµÄAPI½Ó¿ÚºÍJavaµÄÊ®·ÖÀàËÆ£¬ÃæÏò¶ÔÏóÐԺܺá£
TinyXMLÊÇÒ»¸ö¿ªÔ´µÄ½âÎöXMLµÄ½âÎö¿â£¬Äܹ»ÓÃÓÚC++£¬Äܹ»ÔÚWindows»òLinuxÖбàÒë¡£Õâ¸ö½âÎö¿âµÄÄ£ÐÍͨ¹ý½âÎöXMLÎļþ£¬È»ºóÔ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ