java½âÎöxmlÎļþËÄÖÖ·½Ê½
from: http://blog.csdn.net/WOSHISUNXIANGFU/archive/2008/08/25/2828634.aspx
1.½éÉÜ
1£©DOM£¨JAXP Crimson½âÎöÆ÷£©
DOMÊÇÓÃÓëƽ̨ºÍÓïÑÔÎ޹صķ½Ê½±íʾXMLÎĵµµÄ¹Ù·½W3C±ê×¼¡£DOMÊÇÒÔ²ã´Î½á¹¹×éÖ¯µÄ½Úµã»òÐÅϢƬ¶ÏµÄ¼¯ºÏ¡£Õâ¸ö²ã´Î½á¹¹ÔÊÐí¿ª·¢ÈËÔ±ÔÚÊ÷ÖÐÑ°ÕÒÌض¨ÐÅÏ¢¡£·ÖÎö¸Ã½á¹¹Í¨³£ÐèÒª¼ÓÔØÕû¸öÎĵµºÍ¹¹Ôì²ã´Î½á¹¹£¬È»ºó²ÅÄÜ×öÈκι¤×÷¡£ÓÉÓÚËüÊÇ»ùÓÚÐÅÏ¢²ã´ÎµÄ£¬Òò¶øDOM±»ÈÏΪÊÇ»ùÓÚÊ÷»ò»ùÓÚ¶ÔÏóµÄ¡£DOMÒÔ¼°¹ãÒåµÄ»ùÓÚÊ÷µÄ´¦Àí¾ßÓм¸¸öÓŵ㡣Ê×ÏÈ£¬ÓÉÓÚÊ÷ÔÚÄÚ´æÖÐÊdz־õģ¬Òò´Ë¿ÉÒÔÐÞ¸ÄËüÒÔ±ãÓ¦ÓóÌÐòÄܶÔÊý¾ÝºÍ½á¹¹×÷³ö¸ü¸Ä¡£Ëü»¹¿ÉÒÔÔÚÈκÎʱºòÔÚÊ÷ÖÐÉÏϵ¼º½£¬¶ø²»ÊÇÏñSAXÄÇÑùÊÇÒ»´ÎÐԵĴ¦Àí¡£DOMʹÓÃÆðÀ´Ò²Òª¼òµ¥µÃ¶à¡£
2£©SAX
SAX´¦ÀíµÄÓŵã·Ç³£ÀàËÆÓÚÁ÷ýÌåµÄÓŵ㡣·ÖÎöÄܹ»Á¢¼´¿ªÊ¼£¬¶ø²»ÊǵȴýËùÓеÄÊý¾Ý±»´¦Àí¡£¶øÇÒ£¬ÓÉÓÚÓ¦ÓóÌÐòÖ»ÊÇÔÚ¶ÁÈ¡Êý¾Ýʱ¼ì²éÊý¾Ý£¬Òò´Ë²»ÐèÒª½«Êý¾Ý´æ´¢ÔÚÄÚ´æÖС£Õâ¶ÔÓÚ´óÐÍÎĵµÀ´ËµÊǸö¾Þ´óµÄÓŵ㡣ÊÂʵÉÏ£¬Ó¦ÓóÌÐòÉõÖÁ²»±Ø½âÎöÕû¸öÎĵµ£»Ëü¿ÉÒÔÔÚij¸öÌõ¼þµÃµ½Âú×ãʱֹͣ½âÎö¡£Ò»°ãÀ´Ëµ£¬SAX»¹±ÈËüµÄÌæ´úÕßDOM¿ìÐí¶à¡£
Ñ¡ÔñDOM»¹ÊÇÑ¡ÔñSAX£¿ ¶ÔÓÚÐèÒª×Ô¼º±àд´úÂëÀ´´¦ÀíXMLÎĵµµÄ¿ª·¢ÈËÔ±À´Ëµ£¬ Ñ¡ÔñDOM»¹ÊÇSAX½âÎöÄ£ÐÍÊÇÒ»¸ö·Ç³£ÖØÒªµÄÉè¼Æ¾ö²ß¡£ DOM²ÉÓý¨Á¢Ê÷ÐνṹµÄ·½Ê½·ÃÎÊXMLÎĵµ£¬¶øSAX²ÉÓõÄʼþÄ£ÐÍ¡£
DOM½âÎöÆ÷°ÑXMLÎĵµ×ª»¯ÎªÒ»¸ö°üº¬ÆäÄÚÈݵÄÊ÷£¬²¢¿ÉÒÔ¶ÔÊ÷½øÐбéÀú¡£ÓÃDOM½âÎöÄ£Ð͵ÄÓŵãÊDZà³ÌÈÝÒ×£¬¿ª·¢ÈËÔ±Ö»ÐèÒªµ÷Óý¨Ê÷µÄÖ¸ÁȻºóÀûÓÃnavigation APIs·ÃÎÊËùÐèµÄÊ÷½ÚµãÀ´Íê³ÉÈÎÎñ¡£¿ÉÒÔºÜÈÝÒ×µÄÌí¼ÓºÍÐÞ¸ÄÊ÷ÖеÄÔªËØ¡£È»¶øÓÉÓÚʹÓÃDOM½âÎöÆ÷µÄʱºòÐèÒª´¦ÀíÕû¸öXMLÎĵµ£¬ËùÒÔ¶ÔÐÔÄܺÍÄÚ´æµÄÒªÇó±È½Ï¸ß£¬ÓÈÆäÊÇÓöµ½ºÜ´óµÄXMLÎļþµÄʱºò¡£ÓÉÓÚËüµÄ±éÀúÄÜÁ¦£¬DOM½âÎöÆ÷³£ÓÃÓÚXMLÎĵµÐèҪƵ·±µÄ¸Ä±äµÄ·þÎñÖС£
SAX½âÎöÆ÷²ÉÓÃÁË»ùÓÚʼþµÄÄ£ÐÍ£¬ËüÔÚ½âÎöXMLÎĵµµÄʱºò¿ÉÒÔ´¥·¢Ò»ÏµÁеÄʼþ£¬µ±·¢ÏÖ¸ø¶¨µÄtagµÄʱºò£¬Ëü¿ÉÒÔ¼¤»îÒ»¸ö»Øµ÷·½·¨£¬¸æË߸÷½·¨Öƶ¨µÄ±êÇ©ÒѾÕÒµ½¡£SAX¶ÔÄÚ´æµÄÒªÇóͨ³£»á±È½ÏµÍ£¬ÒòΪËüÈÿª·¢ÈËÔ±×Ô¼ºÀ´¾ö¶¨ËùÒª´¦ÀíµÄtag.ÌرðÊǵ±¿ª·¢ÈËÔ±Ö»ÐèÒª´¦ÀíÎĵµÖÐËù°üº¬µÄ²¿·ÖÊý¾Ýʱ£¬SAXÕâÖÖÀ©Õ¹ÄÜÁ¦µÃµ½Á˸üºÃµÄÌåÏÖ¡£µ«ÓÃSAX½âÎöÆ÷µÄʱºò±àÂ빤×÷»á±È½ÏÀ§ÄÑ£¬¶øÇÒºÜÄÑͬʱ·ÃÎÊͬһ¸öÎĵµÖеĶദ²»Í¬Êý¾Ý¡£
3£©JDOM http://www.jdom.org
JDOMµÄÄ¿µÄÊdzÉΪJavaÌض¨ÎĵµÄ£ÐÍ£¬Ëü¼ò»¯ÓëXMLµÄ½»»¥²¢ÇÒ±ÈʹÓÃDOMʵÏÖ¸ü¿ì¡£ÓÉÓÚÊǵÚÒ»¸öJav
Ïà¹ØÎĵµ£º
JAVA³£ÓÃÀàµÄʹÓ÷½·¨
£±¡¢IntegerÀà
£²¡¢FloatÀà
£³¡¢DoubleÀà
£´¡¢CharacterÀà
£µ¡¢StringÀà
£¶¡¢StringTokenizerÀà
£·¡¢StringBufferÀà
£¸¡¢RandomÀà
1£®IntegerÀàµÄʹÓ÷½·¨
Interger£ºÕûÊýÀàÐÍ
£±¡¢ÊôÐÔ¡£
static int MAX_VALUE£º·µ»Ø×î´óµÄÕûÐÍÊý£»
static int MIN_VALUE£º·µ»Ø×îСµÄÕûÐÍÊý£»
static C ......
½Ì³Ì5 ËãÊýÔËËãѧϰ³ÌÐò ѧϰĿ±ê 5.1¼òµ¥¼Ó·¨Ñ§Ï°³ÌÐò СѧÉúÔÚ¸Õ¸Õ¿ªÊ¼Ñ§Ï°ÊýѧÔËËãµÄʱºò£¬ÐèÒª²»¶ÏµØ½øÐз´¸´´óÁ¿µÄÁ·Ï°£¬²ÅÄܹ»Ñ¸ËÙÕÆÎÕÕⲿ·ÖÄÚÈÝ¡£ÏÂÃ濪·¢Ò»¸ö¼òµ¥µÄ¼Ó·¨Ñ§Ï°³ÌÐò£¬Äܹ»²úÉú¼Ó·¨ÔËËãÈÃѧÉúÀ´Ñ§Ï°Ìá¸ß¡£ ±àд³ÌÐòÈçÏ£º 1 package lesson5; 2 3 public class Operation1 { 4 int number1; 5 ......
Java¸ß¼¶££JavaÏß³ÌÔËÐÐÕ»ÐÅÏ¢µÄ»ñÈ¡
·¢²¼Ê±¼ä£º2007.11.14 05:10 À´Ô´£ºÈüµÏÍø¼¼ÊõÉçÇø ×÷Õߣºbaocl
Ò»¡¢ÎÊÌâµÄÒýÈë
ÎÒÃÇÔÚJava³ÌÐòÖÐʹÓÃÈÕÖ¾¹¦ÄÜ£¨JDK Log»òÕßLog4J£©µÄʱºò£¬»á·¢ÏÖLogϵͳ»á×Ô¶¯°ïÎÒÃÇ´òÓ¡³ö·á¸»µÄÐÅÏ¢£¬¸ñʽһ°ãÈçÏ£º
[ÔËÐÐʱ¼ä] [µ ......