DOMÓëSAX½âÎöxmlµÄÇø±ð
SAX¸ÅÄî
SAXÊÇSimple API for XMLµÄËõд£¬Ëü²¢²»ÊÇÓÉW3C¹Ù·½ËùÌá³öµÄ±ê×¼£¬¿ÉÒÔ˵ÊÇ“Ãñ¼ä”µÄÊÂʵ±ê×¼¡£Êµ¼ÊÉÏ£¬ËüÊÇÒ»ÖÖÉçÇøÐÔÖʵÄÌÖÂÛ²úÎï¡£ËäÈ»Èç´Ë£¬ÔÚXMLÖжÔSAXµÄÓ¦ÓÃË¿ºÁ²»±ÈDOMÉÙ£¬¼¸ºõËùÓеÄXML½âÎöÆ÷¶¼»áÖ§³ÖËü¡£
ÓëDOM±È½Ï¶øÑÔ£¬SAXÊÇÒ»ÖÖÇáÁ¿Ð͵ķ½·¨¡£ÎÒÃÇÖªµÀ£¬ÔÚ´¦ÀíDOMµÄʱºò£¬ÎÒÃÇÐèÒª¶ÁÈëÕû¸öµÄXMLÎĵµ£¬È»ºóÔÚÄÚ´æÖд´½¨DOMÊ÷£¬Éú³ÉDOMÊ÷ÉϵÄÿ¸öNode¶ÔÏó¡£µ±Îĵµ±È½ÏСµÄʱºò£¬Õâ²»»áÔì³ÉʲôÎÊÌ⣬µ«ÊÇÒ»µ©Îĵµ´óÆðÀ´£¬´¦ÀíDOM¾Í»á±äµÃÏ൱·Ñʱ·ÑÁ¦¡£ÌرðÊÇÆä¶ÔÓÚÄÚ´æµÄÐèÇó£¬Ò²½«Êdzɱ¶µÄÔö³¤£¬ÒÔÖÁÓÚÔÚijЩӦÓÃÖÐʹÓÃDOMÊÇÒ»¼þºÜ²»»®ËãµÄÊ£¨±ÈÈçÔÚappletÖУ©¡£Õâʱºò£¬Ò»¸ö½ÏºÃµÄÌæ´ú½â¾ö·½·¨¾ÍÊÇSAX¡£
SAXÔÚ¸ÅÄîÉÏÓëDOMÍêÈ«²»Í¬¡£Ê×ÏÈ£¬²»Í¬ÓÚDOMµÄÎĵµÇý¶¯£¬ËüÊÇʼþÇý¶¯µÄ£¬Ò²¾ÍÊÇ˵£¬Ëü²¢²»ÐèÒª¶ÁÈëÕû¸öÎĵµ£¬¶øÎĵµµÄ¶ÁÈë¹ý³ÌÒ²¾ÍÊÇSAXµÄ½âÎö¹ý³Ì¡£ËùνʼþÇý¶¯£¬ÊÇÖ¸Ò»ÖÖ»ùÓڻص÷£¨callback£©»úÖƵijÌÐòÔËÐз½·¨¡££¨Èç¹ûÄã¶ÔJavaеĴúÀíʼþÄ£ÐͱȽÏÇå³þµÄ»°£¬¾Í»áºÜÈÝÒ×Àí½âÕâÖÖ»úÖÆÁË£©
ÔÚXMLReader½ÓÊÜXMLÎĵµ£¬ÔÚ¶ÁÈëXMLÎĵµµÄ¹ý³ÌÖоͽøÐнâÎö£¬Ò²¾ÍÊÇ˵¶ÁÈëÎĵµµÄ¹ý³ÌºÍ½âÎöµÄ¹ý³ÌÊÇͬʱ½øÐеģ¬ÕâºÍDOMÇø±ðºÜ´ó¡£½âÎö¿ªÊ¼Ö®Ç°£¬ÐèÒªÏòXMLReader×¢²áÒ»¸öContentHandler£¬Ò²¾ÍÊÇÏ൱ÓÚÒ»¸öʼþ¼àÌýÆ÷£¬ÔÚContentHandlerÖж¨ÒåÁ˺ܶ෽·¨£¬±ÈÈçstartDocument()£¬Ëü¶¨ÖÆÁ˵±ÔÚ½âÎö¹ý³ÌÖУ¬Óöµ½Îĵµ¿ªÊ¼Ê±Ó¦¸Ã´¦ÀíµÄÊÂÇé¡£µ±XMLReader¶Áµ½ºÏÊʵÄÄÚÈÝ£¬¾Í»áÅ׳öÏàÓ¦µÄʼþ£¬²¢°ÑÕâ¸öʼþµÄ´¦ÀíȨ´úÀí¸øContentHandler£¬µ÷ÓÃÆäÏàÓ¦µÄ·½·¨½øÐÐÏìÓ¦
Ïà¹ØÎĵµ£º
À©Õ¹±ê¼ÇÓïÑÔXML£¨eXtensible Markup Language£©£¬ÊÇÓÉW3C×éÖ¯Öƶ¨µÄ¡£×öΪÓÃÓÚÌæ´úHTMLÓïÑÔµÄÒ»ÖÖÐÂÐ͵ıê¼ÇÓïÑÔ£¬XMLÄÚ²¿ÓÐןܶà»ù±¾±ê×¼£¬XML¾ÍÊÇͨ¹ýÓëÕâЩÏà¹Ø±ê×¼µØ½áºÏ£¬Ó¦ÓÃÓÚ¿Æѧ¼ÆËã¡¢µç×Ó³ö°æ¡¢¶àýÌåÖÆ×÷ºÍµç×ÓÉÌÎñµÄ¡£C££×÷ΪһÖÖÐÂÐ͵ijÌÐòÓïÑÔ£¬ÊÇ.Net¿ò¼ÜµÄÒ»¸öÖØÒª×é³É²¿·Ö£¬ËûºÍXMLµÄ¹ØϵÆÄÉî¡£±¾ÎÄ¾Í´Ó ......
~/ ÔÚrunat=serverµÄ¿Ø¼þÖУ¬×Ô¶¯µÄ±»½âÎöΪRequest.ApplicationPathµÄÖµ£¬Êǵ±Ç°Ó¦ÓóÌÐò¼¶³ÌÐòµÄĿ¼ ÔÚÀý×ÓÖÐÊÇ£º/WebSite
./»òÕßʲô¶¼²»Ð´£º±íʾµ± ......
ÏÈ´´½¨Êý¾ÝÈ»ºóÉú³ÉÏàÓ¦µÄxmlÎļþ
DataSet ds = new DataSet();
#region Parent Table
DataTable dt1 = new DataTable("Parent");
......
//ÕâÊÇÌí¼Ó
private void button1_Click(object sender, EventArgs e)
{
string s = "Persist Security Info=False;Integrated Security=SSPI;database=IIntegration;server=(local)";
&n ......
SQL Server 2005ΪXMLÌṩ±¾µØÖ§³Ö;ÏÖÔÚ¿ÉÒÔÔÚOPENXML½ÚµãÖÐʹÓÃÒ»¸ö´øÓÐnodes()º¯ÊýµÄXML×Ö¶ÎÀàÐÍ°ÑÒ»¸öXMLÎļþת»¯ÎªÒ»¸öÐм¯¡£ÈÃÎÒÃÇÀ´¿´Ò»¸öʹÓÃOPENXMLµÄ¼òµ¥Àý×Ó£¬²¢ÏÔʾÈçºÎ°ÑËüת»¯ÎªÔÚSQL Server 2005ÖÐʹÓÃXML×Ö¶ÎÀàÐͺÍnodes()º¯Êý¡£
¡¡¡¡ÎªÁËʹÎÒÃǵÄÀý×Ó¼òµ¥»¯£¬ÎÒÃǽ«¼ÙÉèÎÒÃÇÐèÒªÖ´ÐÐijÖÖ»ùÓڲɹº¶©µ¥ÁÐ±íµ ......