Ò»¸ö½âÎöxmlµÄÎÊÌâ,¼±
ÒÔÏ´úÂë,ÔÚSQL Server 2005ÏÂÖ´ÐÐ,ΪʲôµÃ²»µ½ÎÒÏëÒªµÄֵĨ?
ÎÒÏëµÃµ½Õâ¸öxmlÖеÄij¸öÔªËØÖµ,±ÈÈç:RegisterTimeºÍFullName.
ÎÒµÄSQLÎÊÌâ³öÔÚÄÄÀï?»òÕßÓиüºÃµÄ½â¾ö°ì·¨?лл´ó¼Ò.
SQL code:
DECLARE @x XML
SET @x = '
<ModifyMember_Input xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ListOfMemberModIoV1 xmlns="http://www.siebel.com/xml/%20Member%20Mod%20IO%20v1">
<LoyMember>
<Control1>0</Control1>
<Description />
<RegisterTime>2010-01-21 17:20:00</RegisterTime>
<CardActive>Y</CardActive>
<ListOfContact>
<Contact>
<Alias />
<FullName>AAA</FullName>
</Contact>
</ListOfContact>
<ListOfLOYMember_FetchInfoMethod />
</LoyMember>
</ListOfMemberModIoV1>
</ModifyMember_Input>'
select @x
select RegisterTime = @x.value('(/ModifyMember_Input/ListOfMemberModIoV1/LoyMember/RegisterTime)[1]', 'varchar(255)')
,FullName = @x.value('(/ModifyMember_Input/ListOfMemberModIoV1/LoyMember/ListOfContact/Contact/FullName)[1]', 'varchar(255)')
ÄãÏëµÃµ½Ê²Ã´Öµ°¡?
ÎÊÌâ³öÔÚÃüÃû¿Õ¼äÉÏ£¬ÄãµÄ´úÂëÈ¥µôÃüÃû¿Õ¼äÊǺÃʵġ£
ÈçºÎÔÚÓÐ
Ïà¹ØÎÊ´ð£º
´ÓÊý¾Ý¿âÖвéѯһÕűíµÄÊý¾Ý
select ²¿ÃÅ,ÐÕÃû from tb
ÈçºÎ²ÅÄÜÉú³ÉÏÂÃæµÄxml¸ñʽÎļþ
<folder state="unchecked" label="È«²¿">
¡¡¡¡<folder state="unchecked" isBra ......
ÄÚÈÝÈçÌâ¡£¡£ÔÚC#Àï¸ÄÈçºÎÐ´ÄØ£¿
±¾À´Ë¼Â·ÊÇÏȱȶԽڵãÃû³Æ£¬ÈçÊǵϰ¾Í±£´æÒªÉ¾³ý½ÚµãµÄϱê·ÅÔÚÊý×éÀȻºóÑ»·É¾³ý£¬µ«·¢ÏÖ¡£¡£µ±ÎÒɾ³ýµÚÒ»¸öºó£¬ËùÓнڵãϱêÊýÁ¿¶¼·¢Éú¸Ä±ä¡£¡£
¾Í²»ÄÜÔÙ°´ÕÕ֮ǰ¼Í¼µÄ½Úµã ......
Private Sub Command1_Click()
Dim MyString() As String
Open "a.xml" For Binary As #1 ' ´ò¿ª¸Õ´´½¨µÄÎļþ¡£
ReDim MyString(LOF(1) - 1)
Put #1, , MyRecord ' ¶ÁÈëËùÓÐ×Ö·ûµ½±äÁ¿ÖÐ ......
ΪʲôÎҵijÌÐòµ÷ÓÃXMLÅäÖÃÎļþÖеİ¢À²®ÎÄÏÔʾ²»³öÀ´£¿ÆäËûµÄÓïÖÖ¶¼¿ÉÒÔ£¬ÈçÖÐÎÄ£¬Ó¢ÎÄ£¬µÂÎͼ¿É¡£
ÎÒ½«XMLµÄ±àÂë¸ÄΪutf-8ºÍunicodeµÄµ½µÃ½á¹û¶¼Ò»Ñù.
°¢À²®ÎĵÄ×Ö¿âÄãÓÐô£¿
ÓÐ,ÎÒµÄEXEÊÇ·ÅÔÚpc»úÉÏÖ´Ðе ......
˼·£ºÒªÓÃc#Éú³ÉÒ»¸ö²¥·Å»úµÄ²¥·ÅÁбíµÄxml£¬ÀýÈ磺
<daty datys='2010-04-05' datye='2010-05-01' > //ÕâÊDz¥·ÅµÄÈÕÆÚ¶Î
<time times='01:12:00' timee='02:30:00'> ......