¹ýÂËxmlÖеķǷ¨×Ö·û´®
Ò»°ãxmlÖÐÈç¹ûº¬ÓÐ&µÈ×Ö·û£¬¿ÉÒÔͨ¹ýCDATAÀ´¹ýÂË£¬µ«ÊǺ¬ÓÐһЩ²»ÈÏʶµÄÌØÊâ×Ö·ûʱºò¾Í»á²»Æð×÷Óã¬ÏÂÃæÊÇ´Ó±ðÈËÄǶùÄÃÀ´µÄÒ»¸ö¹ýÂË·½
·¨£¬¹ýÂËxmlÖеķǷ¨×Ö·û:
//XML±ê×¼¹æ¶¨µÄÎÞЧ×Ö½ÚΪ£º
/*
0×00 – 0×08
0×0b – 0×0c
0×0e – 0×1f
*/
//ËùÒԺܼòµ¥£¬Êä³öµÄʱºò¹ýÂËÕâЩ×Ö·û¾ÍÍòÎÞһʧÁË£¬ÏÂÃæÊÇPHPµÄʵÏÖ¡£
/* PHP ʵÏÖ */
function XmlSafeStr($s)
{
return preg_replace(“/[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]/”,”,$s);
}
W3CµÄXML¹æ·¶ÖйØÓÚ×Ö·ûµÄ¶¨ÒåÇë²Î¿´ÕâÀhttp://www.w3.org/TR/2004/REC-xml-20040204
/#charsets¡£
¹ýÂË·Ç·¨×Ö·û¶ÔÓ¦µÄJava°æ±¾ÈçÏ£º
public
String
filter(
String
s)
{
return
s.replaceAll
(
"[\\
x00-\\
x08\\
x0b-\\
x0c\\
x0e-\\
x1f]"
, ""
)
;
}
Ïà¹ØÎĵµ£º
.dtdÎļþÖÐÈç¹ûÓÐÖÐÎÄ,±ØÐëÁí´æÎªUTF-8±àÂë
ÎÊÌâ:
TransformerFactoryΪ³éÏóÀà,²»ÄÜnewʵÀý,µ«ÌṩÁË·½·¨À´»ñµÃ
TransformerFactory factory = TransformerFacory.newInstance();
factory.newDocumentBuilder();
ÕâÀïnewDocumentBuilder()Ϊ³éÏó·½·¨,ΪʲôÄܵ÷ÓÃÄØ?
×¢Òâ:ÕâÀïfactory±äÁ¿Ö¸ÏòµÄÊÇÒ»¸öʵÀý,´ËʵÀýÊ ......
sql2005ÖÐÒ»¸öxml¾ÛºÏµÄÀý×Ó ÊÕ²Ø
¸ÃÎÊÌâÀ´×ÔÂÛ̳ÌáÎÊ£¬ÑÝʾSQL´úÂëÈçÏÂ
--½¨Á¢²âÊÔ»·¾³
set nocount on
create table test(ID varchar(20),NAME varchar(20))
insert into test select '1','aaa'
insert into test select '1','bbb'
insert into test select '1','ccc'
insert into test select '2','ddd'
inser ......
·½·¨Ò»£º°´ÕÕXMLµÄ½á¹¹Ò»²½Ò»²½µÄ¹¹½¨XMLÎĵµ.
ͨ¹ý.Net FrameWork SDKÖеÄÃüÃû¿Õ¼ä"System.Xml"Öзâ×°µÄ¸÷ÖÖÀàÀ´ÊµÏÖµÄ
·½·¨¶þ£ºÖ±½Ó¶¨Ó°XMLÎĵµ£¬È»ºó±£´æµ½Îļþ¡£
ͨ¹ý"XmlDocument"ÀàÖеÄ"LoadXml"·½·¨
.aspxǰ̨´úÂë:
<%@ Page Language="C# ......
jaxpÊÇsun¹«Ë¾µÄ½âÎöxmlÎĵµµÄapi,ËûÖ§³ÖÓÃdomºÍsaxÁ½ÖÖ·½·¨½âÎöÒ»¸öxmlÎĵµ.
dom·½·¨ÊǽâÎöÒýÇæ½«Õû¸öxmlÎĵµ×°Ôص½ÄÚ´æÖÐ×÷Ϊһ¸ödocument¶ÔÏó,dom·½·¨µÃµ½Ò»¸ö¶ÔÏó¾ÍÖªµÀËùÓеĽڵã
Ôöɾ¸Ä²éºÜ·½±ã,ȱµãÊÇÒª×°ÔØÕû¸öxmlÎĵµ,Èç¹ûxmlÎĵµºÜ´ó,ЧÂʾͱȽϵÍ
sax·½·¨ÊDzÉÓÃʼþ×÷ΪÇý¶¯µÄ,Óöµ½Ò»¸ö±êÇ©ÊÇÒ»¸öʼþ,¶Áµ½±ê ......