Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

´«ÖDz¥¿Í—XML»ù´¡£¨Ï£©

½ñÌì¼ÌÐø½²XML£¬ÕùÈ¡ÔÚÏÂÎç5µãÇ°Õ¼ÁìXML¸ßµØ¡£Ò»¹²Èý¸öÖ÷ÒªÄÚÈÝ£ºSAX½âÎö¼¼Êõ£¬DOM4JºÍSCHEMA¡£
Ê×ÏÈÊÇSAX½âÎö¼¼Êõ£ºSAX²ÉÓÃʼþ´¦ÀíµÄ·½Ê½½âÎöXMLÎļþ¡£ÀûÓà SAX ½âÎö XML Îĵµ£¬Éæ¼°Á½¸ö²¿·Ö£º½âÎöÆ÷ºÍʼþ´¦ÀíÆ÷¡£
½âÎöÆ÷¸ºÔð¶ÁÈ¡ XML Îĵµ£¬²¢Ïòʼþ´¦ÀíÆ÷·¢ËÍʼþ
ʼþ´¦ÀíÆ÷¸ºÔð¶Ôʼþ×ö³öÏàÓ¦£¬¶Ô´«µÝµÄ XML Êý¾Ý½øÐд¦Àí
1.ʹÓÃSAXParserFactory´´½¨SAX½âÎö¹¤³§
SAXParserFactory spf = SAXParserFactory.newInstance();
2.ͨ¹ýSAX½âÎö¹¤³§µÃµ½½âÎöÆ÷¶ÔÏó  
SAXParser sp = spf.newSAXParser();
3.ͨ¹ý½âÎöÆ÷¶ÔÏóµÃµ½Ò»¸öXMLµÄ¶ÁÈ¡Æ÷
XMLReader xmlReader = sp.getXMLReader();
4.ÉèÖöÁÈ¡Æ÷µÄʼþ´¦ÀíÆ÷  
xmlReader.setContentHandler(new BookParserHandler());
5.½âÎöxmlÎļþ 
xmlReader.parse("book.xml");
µ±ÔÚµÚÈý²½Äõ½Ò»¸öXMLµÄ¶ÁÈ¡Æ÷ºó£¬¾ÍÓ¦¸ÃÏòʼþ´¦ÀíÆ÷·¢ËÍʼþÁË£¬ÕâʱÄãËùдµÄʼþ´¦ÀíµÄ·½·¨¾ÍÓ¦¸ÃʵÏÖContentHandlerµÄËùÓз½·¨£¬ÒòΪContentHandlerÊÇÒ»¸ö½Ó¿ÚÀ࣬ÕâÑùÒ»À´¾Í±È½ÏÂé·³ÁË£¬ÒòΪÎÒÃÇÖ»¹ØϵÕâ¸ö½Ó¿ÚÀàÖеÄÈý¸ö·½·¨£ºcharacters£¨²ÎÊý...£©£¬startElement£¨²ÎÊý...£©£¬endElement(²ÎÊý...)¡£
ÏÖÔÚÎÒÃDz鿴APIÎĵµ·¢ÏÖSUN¹«Ë¾ÒѾ­ÎªÎÒÃÇдºÃÁËһϵÁеÄʵÏÖÀ࣬ÕâÀïÎÒÃÇÓÃDefaultHandlerÕâ¸öʵÏÖÀà¡£ÔÚÕâ¸öÀàÀïÃæÎÒÃÇÖØдÁËÉÏÃæÈý¸ö·½·¨£¬À´ÊµÏÖÎÒÃÇÏëÒªµÄ¹¦ÄÜ¡£
½ÓÏÂÀ´¿ªÊ¼ÁËdom4j¡£Dom4jÊÇÒ»¸ö¼òµ¥¡¢Áé»îµÄ¿ª·ÅÔ´´úÂëµÄ¿â¡£dom4jʹÓýӿںͳéÏó»ùÀ࣬Dom4jµÄAPIÏà¶ÔÒª¸´ÔÓһЩ£¬µ«ËüÌṩÁ˸üºÃµÄÁé»îÐÔ¡£Dom4jÊÇÒ»¸ö·Ç³£ÓÅÐãµÄJava XML API£¬¾ßÓÐÐÔÄÜÓÅÒì¡¢¹¦ÄÜÇ¿´óºÍ¼«Ò×ʹÓõÄÌص㡣ÏÖÔںܶàÈí¼þ²ÉÓõÄDom4j£¬ÀýÈçHibernate£¬°üÀ¨sun¹«Ë¾×Ô¼ºµÄJAXMÒ²ÓÃÁËDom4j¡£Ê¹ÓÃDom4j¿ª·¢£¬ ÐèÒªÏÂÔØdom4jÏàÓ¦µÄjarÎļþ¡£
 DOM4jÖУ¬»ñµÃDocument¶ÔÏóµÄ·½Ê½ÓÐÈýÖÖ£º
 1.¶ÁÈ¡XMLÎļþ,»ñµÃdocument¶ÔÏó:
        SAXReader reader = new SAXReader(); 
        Document   document = reader.read(new File("input.xml"));
 2.½âÎöXMLÐÎʽµÄÎı¾,µÃµ½document¶ÔÏó
        String text = "<members></members>";
        Document document = DocumentHelper.parseTex


Ïà¹ØÎĵµ£º

SQL Server2005µÄXMLÊý¾ÝÀàÐÍÖ®»ù´¡Æª2

value·½·¨
µ±Äã²»Ïë½âÊÍÕû¸ö²éѯµÄ½á¹û¶øÖ»ÏëµÃµ½Ò»¸ö±êÁ¿ÖµÊ±£¬Õâ¸övalue·½·¨ÊǺÜÓаïÖúµÄ¡£Õâ¸övalue·½·¨ÓÃÓÚ²éѯXML²¢ÇÒ·µ»ØÒ»¸öÔ­×ÓÖµ¡£
Õâ¸övalue·½·¨µÄÓï·¨ÈçÏ£º
value(XQuery£¬datatype)
½èÖúÓÚvalue·½·¨£¬Äã¿ÉÒÔ´ÓXMLÖеõ½µ¥¸ö±êÁ¿Öµ¡£Îª´Ë£¬Äã±ØÐëÖ¸¶¨XQueryÓï¾äºÍÄãÏëÒªËü·µ»ØµÄÊý¾ÝÀàÐÍ£¬²¢ÇÒÄã¿ÉÒÔ·µ»Ø³ ......

ÔÚXMLÀïдSQLÓï¾ä£¨°ÑSQLÓï¾äд½øXMLÀ

ÄãÖªµÀXMLÎļþ°É£¿£¨²»ÖªµÀµÄGOOGLEÈ¥£¡£©ÄÇÄãÌý˵¹ýÔÚXMLÀïÊéдSQLÓï¾äÂ𣿻»¾ä»°Ëµ£¬°ÑÄãµÄÏîÄ¿ÀïËùÓÐSQLÓï¾ä´æ´¢ÔÚXMLÎļþÀÄãÌý˵¹ýÂð£¿Äã×ö¹ýÂð£¿
ÎÒÍ·´ÎÌý˵ÊÇС°¬¸æËßÎҵģ¬ÎҸҿ϶¨ËûÊǸöÕâ·½ÃæµÄ¸ßÊÖ£¬ºÇºÇ£¨ÔÞÒ»¸ö£¬µ½´ËΪֹ£¡£©
ÄǸøÄãչʾһÏ£¬ÔÚXMLÀïÊéдSQLÓï¾ä°É
<commands>
  <comman ......

Java:Struts ÏîÄ¿ÖÐweb.xmlÎļþÅäÖÃ

 web.xmlÎļþ¶ÔÓÚÅäÖÃÈκÎJava WebÓ¦Óö¼±ØÐèµÄ¡£
£¨1£©ÅäÖÃStrutsµÄActionServlet
<servlet><!--ÔªËØÀ´ÉùÃ÷ActionServlet-->
<servlet-name><!--ÔªËØ£ºÓÃÀ´¶¨ÒåServletµÄÃû³Æ-->
<servlet-class><!--ÔªËØ:ÓÃÀ´Ö¸¶¨ServletµÄÍêÕûÀàÃû-->
<servlet>
<servlet-name& ......

¹ØÓÚSQLServer2005µÄѧϰ±Ê¼Ç——XMLµÄ´¦Àí

ÔÚ
SQLServer2005
ÖжÔ
XML
µÄ´¦Àí¹¦ÄÜÏÔÈ»ÔöÇ¿Á˺ܶ࣬ÌṩÁË
query(),value(),exist(),modify(),nodes()
µÈº¯Êý¡£
¹ØÓÚ
xml
£¬ÄÑÒÔÀí½âµÄ²»ÊÇ
SQLServer
ÌṩµÄº¯Êý£¬¶øÊǶÔ
xml
±¾ÉíµÄÀí½â£¬¿´Ëƺܼòµ¥µÄÎļþ¸ñʽ£¬´¦ÀíÆðÀ´È´ÊǷdz£À§Äѵġ£±¾ÎÄÖ»Êdzõ̽һ϶øÒÑ¡£
Ïê¼û
SQLServer
Áª»ú°ïÖú£º
Ö÷Ìâ
˵ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ