javaÖÐËÄÖÖ²Ù×÷xml·½Ê½µÄ±È½ÏÒÔ¼°ËÄÖÖ·½·¨µÄ¼òµ¥Àý×Ó
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½âÎöÆ÷µÄʱºò±àÂ빤×÷»á±È½ÏÀ§ÄÑ£¬¶øÇÒºÜÄÑͬʱ·ÃÎÊͬһ¸öÎĵµÖеĶദ²»Í¬
Ïà¹ØÎĵµ£º
ÎÄÕÂ來Ô´:
http://www.blogjava.net/spark/archive/2006/09/29/72733.html
javaÖеÄioϵͳ×ܽá.
javaÖеÄioÖеģ¨input/output£©streamÎ޷ǾÍÊÇ°üÀ¨»ùÓÚ×Ö·ûµÄstream¡¢»ùÓÚ×Ö½ÚµÄstreamºÍ°Ñ×Ö½Úµ¼ÏòµÄstreamת»»
×Ö·ûΪµ¼ÏòµÄstreamµÄstream¡££¨ºÜÄÑÀí½âô£¿£©
ÒÔ×Ö½ÚΪµ¼ÏòµÄstream------InputStream/OutputStr ......
ÎÒÏ룬¿ÉÄܲ»Ö¹ÎÒÒ»¸öÈËÓÐÕâ¸öÒÉÎÊ£¬ËùÒÔ£¬°ÑËüÌù³öÀ´¡£
¡¡¡¡ÏÂÃæÊÇmadaiºÍclkrst¸øÎҵĻشð¡£
¡¡¡¡ÔÚ´ËллÁ½Î»¡£
¡¡¡¡ÎÒµÄÎÊÌâÊÇ£º
¡¡¡¡java µÄ½Ó¿Úµ½µ×Æðʲô×÷Óã¿
¡¡¡¡1¡¢´ÓÊéÖп´µ½µÄÊÇjava³ÌÐòµÄ½Ó¿ÚÖÐÖ»¶¨ÒåÁ˳£Á¿¼°¿Õ·½·¨£¬¿ÕµÄ·½·¨ÓÐʲôÓÃÄØ£¿»¹ÒªÔÚÀàÖÐÐ ......
ʹÓÃpoiÀ´Éú³ÉxlsÎļþ£ºÒýÓõİüpoi-3.2.final.jar;
ÒªÁ˽âµÄÀàHSSFWorkbook,HSSFSheet,HSSFRow,HSSFCell
HSSFWorkbook workbook=new HSSFWorkbook();µÃµ½Ò»¸öExcelÎļþµÄÒýÓÃ
HSSFSheet sheet=workbook.createSheet();µÃµ½Ò»¸ösheet,»¹ÓÐHSSFSheet sheet=workbook.createSheet("sheet1");·½·¨¿ÉÒÔÉèÖÃSheetµÄÃû³Æ¡£
È» ......
ÔÎijö´¦£ºhttp://developers.sun.com/techtopics/mobility/midp/articles/wtk23beta/
Sun Java Wireless ToolkitÔ½À´Ô½ºÃ£¬2.3beta°æ±¾Ôö¼ÓÁ˶ÔÓÚÈýÖÖеÄAPIµÄÖ§³Ö£º
l The Security and Trust Services APIs (SATSA, ......
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import net.sourceforge.pinyin4j.PinyinHelper;
public class PinyinComparator implements Comparator<Object> {
private String concatPinyinStringArray(String[] pinyinArray) {
&nb ......