java½âÎöxmlÎļþËÄÖÖ·½Ê½
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½âÎöÆ÷µÄʱºò±àÂ빤×÷»á±È½ÏÀ§ÄÑ£¬¶øÇÒºÜÄÑͬʱ·ÃÎÊͬһ¸öÎĵµÖеĶദ²»Í¬Êý¾Ý¡
Ïà¹ØÎĵµ£º
ÕâÊÇÒ»¸öÓÃJAVA W3C DOM ½øÐÐXML²Ù×÷µÄÀý×Ó£¬°üº¬Á˲éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý¡¢±£´æµÄ»ù±¾²Ù×÷¡£½ÏÍêÕûµÄÃèÊöÁËÒ»¸öXMLµÄÕû¸ö²Ù×÷Á÷³Ì¡£ÊʺϸÕÈëÃÅJAVA XML²Ù×÷µÄÅóÓѲο¼ºÍѧϰ¡£
¼ÙÉèÓÐXMLÎļþ£ºtest1.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>
<book>
< ......
1.¼ÆËãijһÔ·ݵÄ×î´óÌìÊý
Calendar time=Calendar.getInstance();
time.clear();
time.set(Calendar.YEAR,year);
time.set(Calendar.MONTH,i-1);//×¢Òâ,Calendar¶ÔÏóĬÈÏÒ»ÔÂΪ0
int day=time.getActualMaximum(Calendar.DAY_OF_MONTH);//±¾Ô·ݵÄÌìÊý ......
1 JDK5.0°üÀ¨µÄµ÷ÊÔ¹¤¾ß
ÎÒÃÇÔÚÕâÀï¶ÔJDK5.0µÄµ÷ÊÔ¹¤¾ß×ö´óÖµĸÅÄîÐԵĽéÉÜ£¬È»ºóÏ£Íûͨ¹ý½éÉÜÎÒ×Ô¼ºÔÚʵ¼Ê¹¤×÷ÖÐʹÓÃÕâЩ¹¤¾ß½â¾öÎÊÌâµÄʵÀýÀ´Èôó¼Ò¶ÔÕâЩ¹¤¾ßÓиüÉîÈëµÄÁ˽⡣
¡¡JDK5.0ÀïÃæ¼ÓÈëÁËjstack, jconsole, jinfo, jmap, jdb, jstat, jps, ÏÂÃæ¶ÔÕâЩ¹¤¾ß×ö¼òµ¥½éÉÜ£º
¡¡jstack -- Èç¹ûjava³Ì ......
Bean Serializable Interface µÄ½Ó¿ÚÈÃBEAN¿ÉÒÔ´®Ðл¯£¬½«Æä±ä³ÉÒ»¸ö¿É±£´æΪÒÔºóʹÓõĶþ½øÖÆÁ÷¡£µ±Ò»¸öBEAN±»ÏµÁл¯µ½´ÅÅÌÉÏ»òÕßÆäËûÈκεط½£¬Æä״̬±»±£´æÆðÀ´£¬ÆäÖеÄÊôÐÔÖµÒ²²»»á¸Ä±ä¡£ÔÚBEANµÄ¹æ·¶ÖУ¬JSP²¢Ã»ÓÐÒªÇóBEANʵÏÖSerializable½Ó¿Ú¡£µ«ÊÇ£¬Èç¹ûÄúÏ£Íû×Ô¼º¿ØÖÆÄúËù´´½¨µÄ×é¼þµÄserialization½ø³Ì£¬»òÕßÄúÏë ......
1 ÍøÂçͨÐŵı¾ÖÊÊǽø³Ì¼äͨÐÅ¡£
2 TcpÐÒéºÍUDPÐÒé
TCP£º¿ªÏú´ó£¬ÓÃÓÚ¿É¿¿ÐÔÒªÇó¸ßµÄ³¡ºÏ¡£
TCPµÄ¹ý³ÌÏ൱ÓÚ´òµç»°µÄ¹ý³Ì
UDP£ºÓÃÔÚ¶ÔʵʱÐÔÒªÇó±È½Ï¸ßµÄ³¡ºÏ¡£
UDPµÄ¹ý³ÌÏ൱ÓÚдÐŵĹý³Ì¡£
×¢Ò⣺socketÊÇÌ×½Ó×Ö£¬ipºÍport£¨¶Ë¿ÚºÅ 0~65535¸ö¶Ë¿Ú£¬Ò»¸ö¶Ë¿ÚÖ»ÄÜÓÐÒ»¸ö½ø³Ì£©
3£¬   ......