mssqlÖÐÓÃxmlµÄ·½·¨²ð·ÖÒÔ²»¶¨¿Õ¸ñΪ·Ö¸î·ûºÅµÄ×Ö·û´®
---xml²ð·ÖÒÔ²»¶¨¿Õ¸ñΪ·Ö¸î·ûºÅµÄ×Ö·û´®
--²âÊÔÊý¾Ý
if object_id('[tb]') is not null drop table [tb]
create table [tb]([a] varchar(200))
go
insert [tb]
select 'aaaa bbbb cccc dddd'
insert [tb]
select 'eeeeee ffff hhhh yyyy '
--¿ªÊ¼²éѯ
select
rtrim(A.A) as a,B.A2
from (
select a,convert(xml,'<root><row>'+replace(replace(rtrim(ltrim(a)),' ','</row><row>'),'<row></row>','')+'</row></root>') AS A1
from [tb]
) a outer apply (select a2=T.C.value('.','nvarchar(100)') from a.a1.nodes('/root/row')T(C)) B
/*
a A2
-------------------------------------------------------------------------- --------------------
aaaa bbbb cccc dddd aaaa
aaaa bbbb cccc dddd &nb
Ïà¹ØÎĵµ£º
XMLÏÖÔÚÒѾ³ÉΪһÖÖͨÓõÄÊý¾Ý½»»»¸ñʽ,ƽ̨µÄÎÞ¹ØÐÔʹµÃºÜ¶à³¡ºÏ¶¼ÐèÒªÓõ½XML¡£±¾ÎĽ«Ïêϸ½éÉÜÓÃJava½âÎöXMLµÄËÄÖÖ·½·¨¡£
XMLÏÖÔÚÒѾ³ÉΪһÖÖͨÓõÄÊý¾Ý½»»»¸ñʽ,ËüµÄƽ̨ÎÞ¹ØÐÔ,ÓïÑÔÎÞ¹ØÐÔ,ϵͳÎÞ¹ØÐÔ,¸øÊý¾Ý¼¯³ÉÓë½»»¥´øÀ´Á˼«´óµÄ·½±ã¡£¶ÔÓÚXML±¾ÉíµÄÓ﷨֪ʶÓë¼¼Êõϸ½Ú,ÐèÒªÔĶÁÏà¹ØµÄ¼¼ÊõÎÄÏ×,ÕâÀïÃæ°üÀ¨µÄÄÚÈÝ ......
ÕªÒª£ºÎÒÃÇÃèÊöÒ»¸ö¼òµ¥µÄÒµÎñϵͳµÄÓÃÀý£¬È»ºó½éÉܲ»Í¬µÄʵÏÖ¼¼Êõ¼°Æä±È½Ï¡£ÎÒûÓÐ×ö¹ýʵ¼ÊµÄ»ùÓÚSW¼¼ÊõµÄÐÅϢϵͳ£¬Òò´Ë±¾ÎÄÖ»ÊÇһЩ²ÂÏëÐԵĶ«
Î÷£¬Ï£ÍûÅ×שÒýÓñ£¬Äܵõ½´ó¼ÒµÄÖ¸½Ì,Ò²»¶Ó´ó¼Ò²¹³ä£¬Ð»Ð»£¡
×¢ÒâÎÒÃÇÌÖÂ۵ĶÔÏóÊÇ´«Í³µÄMISϵͳ£¬ÈçͼÊé²éѯϵͳ£¬Ñ§Éú¹ÜÀíϵͳ֮ÀàµÄ¡£
ÓÃÀý£º Óû§ÔÚ²éѯ½çÃæÑ¡Ôñ ......
Îĵµ¼°´úÂëÏÂÔØ£ºhttp://www.dingos.cn/index.php?topic=1899.0
½éÉÜ
µ±²Ëµ¥ÏîÊǾ³£¸Ä±äʱ£¬´ÓXMLÎĵµÖд´½¨TreeView²Åµ±ÊǷdz£ÓÐÓõġ£ÀýÈ磬ʹÓÃXML×÷ΪÊý¾Ý¿â´æ´¢¼Ç¼¡£
ÕâÀïÓиö¼òµ¥Ê¾Àý¡£ÒÔ·À»ìÏýÕâ¸öÀý×ӱȽϼòµ¥¡£
±³¾°
¶ÔXML¡¢TreeView¿Ø¼þµÄÓ¦Óã¬ÔÚVisual StudioÖÐÓÐÖúÓÚÀí½âÕâЩ²½Öè¡£
ʹÓôúÂë
×¢Ò⣠......
¶ÔÓÚ½«TXTÎĵµÖÐÊý¾Ýµ¼ÈëXMLÖеijÌÐòÍøÉϲ»¶à£¬µ«ÊÇÓкܶàÊÇÏȽ«TXTµ¼Èëµ½DataSetÖУ¬ÔÚÓÃXML½øÐд«Êä¡£ËùÒÔ±¾È˾ÍÔÚÕâÀïÓë´ó¼Ò·ÖÏíÒ»ÏÂÖ±½Óµ¼ÈëµÄÕâÖÖ·½Ê½¡£
±¾³ÌÐòÒ²¿ÉÒÔÓ¦ÓÃÓÚASP.NETÖУ¬ÄÇôÏÂÃæµÄÃüÃû¿Õ¼ä¼°Ò»Ð©µØ·½¾ÍµÃ¸Ä¸ÄÁË£¬»¹ÓÐÒª½«³ÌÐò¶¼·ÅÓÚPage_LoadÖС£
using System;
using System.Collections.Generic;
......
²»ÐèÒªÉú³Édtd,ÎÞÓÃÅäÖÃ,²»ÐèÒªÉú³É¸¨ÖúÀ࣬Ëٶȿ졣Õâ¾ÍÊÇxstream+xpp³¬Ç¿»Æ½ð×éºÏ¡£
xstream´ó¼Ò¶¼ÖªµÀÀ²£¬XML Pull ParserÊÇÒ»ÖÖ¸ßËÙµÄ ½âÎöxmlÎļþµÄ·½Ê½£¬ËÙ¶ÈÒª±È´«Í³·½Ê½¿ìºÜ¶à£¨·¢ÏÖpullʽ½âÎöÏÖÔڱȽÏÁ÷ÐÐÁË£©¡£ÏÂÃæÎÒ¸ø³ö¶àÖÖʹÓ÷½·¨µÄÀý×Ó¡£
1.×î¼òµ¥µÄʹÓ÷½·¨
ÒòΪÕâ¸öÌ«¼òµ¥£¬ËùÒÔÎÒ´ÓmoogleµÄblog http: ......