Sqlserver£º´ÓXMLÎļþÖжÁÈ¡ÅäÖÃÐÅÏ¢
ÈçºÎÔÚSqlserverÖдÓÍⲿXMLÎļþÖжÁÈ¡ÅäÖÃÐÅÏ¢ÄØ£¿¸ÃÎÊÌâÔ´×ÔÒ»¼ÒÆóÒµµÄ±ÊÊÔÐÅÏ¢ÓиС£
Ò»xmlÎļþÄÚÈÝ£º
<?xml version="1.0" encoding="utf-8"?>
<root>
<db name="ClientDB1" datasize="512MB" datagrowth="100MB" logsize="100MB" loggrowth ="50MB">
</db>
<db name="ClientDB2" datasize="1536MB" datagrowth="200MB" logsize="100MB" loggrowth ="100MB">
</db>
<db name="ClientDBN" datasize="1024MB" datagrowth="200MB" logsize="100MB" loggrowth ="80MB">
</db>
</root>
½Å±¾£º
declare @x xml
declare @hdocid int
/*´ÓÍⲿÎļþ¶ÁÈ¡ÎļþÄÚÈÝ
ÓкܶàÖÖ·½Ê½£º
xp_cmdshell µ÷ÓòÙ×÷ϵͳµÄÏÔʽÎı¾ÎļþÄÚÈݵÄÀ©Õ¹´æ´¢¹ý³Ì¡£
bcp.exe µ¼Èëµ¼³ö¹¤¾ß
openrowset¶ÁÈëÎı¾ÎļþÄÚÈÝ£¨sql2005µÃµ½ÔöÇ¿£©
bulk insertÓï¾ä
*/
select @x=bulkcolumn
from openrowset(bulk 'c:\db_conifig.xml',SINGLE_CLOB ) as t¡¡¡¡--sqlserver2005µÄÔöÇ¿bulkÓï·¨
--½âÎö³ÉxmlÊ÷ÐÎÎĵµÔÚÄÚ´æÖÐ
exec sp_xml_preparedocument @hdocid output,@x
--sqlserver½âÎö³É½á¹û¼¯µÄÐÎʽ£¬±ãÓÚʹÓ᣻òÕßÖ±½ÓÀûÓÃxmlÀàÐ͵ķ½·¨½âÎö£¡
select *
from openxml(@hdocid,'/root/db') with (name varchar(50),datasize varchar(50),datagrowth varchar(50),logsize varchar(50),loggrowth varchar(50))
Ïà¹ØÎĵµ£º
SAX£¨Simple API for XML¼ò³ÆSAX£©Ê¼þÊÇÎÞ״̬µÄ£¬Ò²¾ÍÊÇ˵£¬µ±½ÓÊÕµ½×Ö·ûÊý¾ÝµÄʼþºó£¬²¢²»ÖªµÀ¸Ã×Ö·ûÊý¾ÝÊÇÄÄÒ»¸öÔªËصÄ
ÄÚÈÝ¡£Í¬ÑùµØ£¬µ±ÊÕµ½ÔªËØ¿ªÊ¼µÄʼþºó£¬Ò²ÎÞ·¨ÖªµÀ¸ÃÔªËØÊÇ·ñÓи¸ÔªËØ£¬ÊÇ·ñÓÐ×ÓÔªËØ£¬ÕâÊÇ
SAXºÍDOM²»Í¬µÄµØ·½¡£SAX½âÎöÆ÷±¾Éí²¢²»ÌṩԪËصÄÉÏÏÂÎÄÐÅÏ¢£¬ËùÓÐÏà¹ØÐÅÏ¢µÄ¼Ç¼ÐèÒªÎÒÃÇ×Ô
¼º±à³ ......
¾³£»áÓõ½xmlÎļþ£¬ÄÚÈݼÓÔØ£¬ Èç¹ûʹÓÃlinq xmlÊ÷¼ÓÔØ£¬ÐèҪͨ¹ýXElementÀ࣬һÖÖ·½Ê½ÊÇÒÔ×Ö·û´®µÄÐÎʽ¼ÓÔØ£¬ÁíÍâÒ»ÖÖ·½Ê½ÊÇÒÔÎļþÐÎʽ¼ÓÔØ¡£ 1.ÒÔ×Ö·û´®ÐÎʽ¼ÓÔØ¡£ ÔÚXElementÀàÖУ¬Í¨¹ý¾²Ì¬µÄParse()·½·¨ ......
ÎÄÕÂת×Ô¡¾PHP̽·Õß¡¿
XML Ó¦ÓÃÓÚ web ¿ª·¢µÄÐí¶à·½Ã棬³£ÓÃÓÚ¼ò»¯Êý¾ÝµÄ´æ´¢ºÍ¹²Ïí¡£
Èç¹ûÐèÒªÔÚ HTML ÎĵµÖÐÏÔʾ¶¯Ì¬Êý¾Ý£¬ÄÇôÿµ±Êý¾Ý¸Ä±äʱ½«»¨·Ñ´óÁ¿µÄʱ¼äÀ´±à¼ HTML£¬
XML ¿ÉÒÔ°ÑÊý¾Ý´Ó HTML ÖзÖÀ뿪À´¡£
ͨ¹ý XML£¬Êý¾ÝÄܹ»´æ´¢ÔÚ¶ÀÁ¢µÄ XML ÎļþÖС£ÕâÑùÄã¾Í¿ÉÒÔרעÓÚʹÓà HTML ½øÐв¼¾ÖºÍÏÔʾ£¬²¢È·±£ÐÞ ......
XMLÏÖÔÚÒѾ³ÉΪһÖÖͨÓõÄÊý¾Ý½»»»¸ñʽ,ËüµÄƽ̨ÎÞ¹ØÐÔ,ÓïÑÔÎÞ¹ØÐÔ,ϵͳÎÞ¹ØÐÔ,¸øÊý¾Ý¼¯³ÉÓë½»»¥´øÀ´Á˼«´óµÄ·½±ã¡£¶ÔÓÚXML±¾ÉíµÄÓ﷨֪ʶÓë¼¼Êõϸ½Ú,ÐèÒªÔĶÁÏà¹ØµÄ¼¼ÊõÎÄÏ×,ÕâÀïÃæ°üÀ¨µÄÄÚÈÝÓÐDOM(Document Object Model),DTD(Document Type Definition),SAX(Simple API for XML),XSD(Xml Schema Definition),XSLT(Exten ......