java½âÎöxmlÎļþ
==========================================
xmlÎļþ
£¼?xml version="1.0" encoding="GB2312"?£¾
£¼RESULT£¾
£¼VALUE£¾
¡¡¡¡ £¼NO£¾A1234£¼/NO£¾
¡¡¡¡ £¼ADDR£¾ËÄ´¨Ê¡XXÏØXXÕòXX·X¶ÎXXºÅ£¼/ADDR£¾
£¼/VALUE£¾
£¼VALUE£¾
¡¡¡¡ £¼NO£¾B1234£¼/NO£¾
¡¡ ¡¡£¼ADDR£¾ËÄ´¨Ê¡XXÊÐXXÏçXX´åXX×飼/ADDR£¾
£¼/VALUE£¾
£¼/RESULT£¾
ÐèҪʲô°ü×Ô¼ºµ½ÍøÉÏÕÒÏ°ɣ¿
==========================================
1£©DOM£¨JAXP Crimson½âÎöÆ÷£©
DOMÊÇÓÃÓëƽ̨ºÍÓïÑÔÎ޹صķ½Ê½±íʾXMLÎĵµµÄ¹Ù·½W3C±ê×¼¡£DOMÊÇÒÔ²ã´Î½á¹¹×éÖ¯µÄ½Úµã»òÐÅϢƬ¶ÏµÄ¼¯ºÏ¡£Õâ¸ö²ã´Î½á¹¹ÔÊÐí¿ª·¢ÈËÔ±ÔÚÊ÷ÖÐÑ°ÕÒ
Ìض¨ÐÅÏ¢¡£·ÖÎö¸Ã½á¹¹Í¨³£ÐèÒª¼ÓÔØÕû¸öÎĵµºÍ¹¹Ôì²ã´Î½á¹¹£¬È»ºó²ÅÄÜ×öÈκι¤×÷¡£ÓÉÓÚËüÊÇ»ùÓÚÐÅÏ¢²ã´ÎµÄ£¬Òò¶øDOM±»ÈÏΪÊÇ»ùÓÚÊ÷»ò»ùÓÚ¶ÔÏóµÄ¡£DOM
ÒÔ¼°¹ãÒåµÄ»ùÓÚÊ÷µÄ´¦Àí¾ßÓм¸¸öÓŵ㡣Ê×ÏÈ£¬ÓÉÓÚÊ÷ÔÚÄÚ´æÖÐÊdz־õģ¬Òò´Ë¿ÉÒÔÐÞ¸ÄËüÒÔ±ãÓ¦ÓóÌÐòÄܶÔÊý¾ÝºÍ½á¹¹×÷³ö¸ü¸Ä¡£Ëü»¹¿ÉÒÔÔÚÈκÎʱºòÔÚÊ÷ÖÐÉÏÏÂ
µ¼º½£¬¶ø²»ÊÇÏñSAXÄÇÑùÊÇÒ»´ÎÐԵĴ¦Àí¡£DOMʹÓÃÆðÀ´Ò²Òª¼òµ¥µÃ¶à¡£
import java.io.*;
import java.util.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
public class MyXMLReader{
¡¡public static void main(String arge[]){
¡¡¡¡long lasting =System.currentTimeMillis();
¡¡¡¡try{
¡¡¡¡¡¡File f=new File("data_10k.xml");
¡¡¡¡¡¡DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
¡¡¡¡¡¡DocumentBuilder builder=factory.newDocumentBuilder();
¡¡¡¡¡¡Document doc = builder.parse(f);
¡¡¡¡¡¡NodeList nl = doc.getElementsByTagName("VALUE");
¡¡¡¡¡¡for (int i=0;i£¼nl.getLength();i++){
¡¡¡¡¡¡¡¡System.out.print("³µÅƺÅÂë:" + doc.getElementsByTagName("NO").item(i).getFirstChild().getNodeValue());
¡¡¡¡¡¡¡¡System.out.println("³µÖ÷µØÖ·:" + doc.getElementsByTagName("ADDR").item(i).getFirstChild().getNodeValue());
¡¡ ¡¡}
¡¡¡¡}catch(Exception e){
¡¡¡¡¡¡e.printStackTrace();
}
==========================================
2£©SAX
SAX´¦ÀíµÄÓŵã·Ç³£ÀàËÆÓÚÁ÷ýÌåµÄÓŵ㡣·ÖÎöÄܹ»Á¢¼´¿ªÊ¼£¬¶ø²»ÊǵȴýËùÓеÄÊý¾Ý±»´¦Àí¡£¶øÇÒ£¬ÓÉÓÚÓ¦ÓóÌÐ
Ïà¹ØÎĵµ£º
1.ʹÓÃjava.util.PropertiesÀàµÄload()·½·¨
InputStream in = lnew BufferedInputStream(new FileInputStream(name));
¡¡¡¡Properties p = new Properties();
¡¡¡¡p.load(in);
2.ʹÓÃjava.util.ResourceBundleÀàµÄgetBundle()·½·¨¡¡¡¡
ResourceBundle rb = ResourceBundle.getBundle(name, Locale.getDefault ......
×÷Õßͨ¹ýʹÓÃJAVAÖеĶ¯Ì¬´úÀíʵÏÖÊý¾Ý¿âÁ¬½Ó³Ø£¬Ê¹Ê¹ÓÃÕß¿ÉÒÔÒÔÆÕͨµÄjdbcÁ¬½ÓµÄʹÓÃÏ°¹ßÀ´Ê¹ÓÃÁ¬½Ó³Ø¡£
Êý¾Ý¿âÁ¬½Ó³ØÔÚ±àдӦÓ÷þÎñÊǾ³£ÐèÒªÓõ½µÄÄ£¿é£¬Ì«¹ýƵ·±µÄÁ¬½ÓÊý¾Ý¿â¶Ô·þÎñÐÔÄÜÀ´½²ÊÇÒ»¸öÆ¿¾±£¬Ê¹Óûº³å³Ø¼¼Êõ¿ÉÒÔÀ´Ïû³ýÕâ¸öÆ¿¾±¡£ÎÒÃÇ¿ÉÒÔÔÚ»¥ÁªÍøÉÏÕÒµ½ºÜ¶à¹ØÓ ......
¾³£¿´µ½Ðí¶àÈËÎÊÈçºÎÅäÖÃJDKºÍJSP£¬ÏÖÔÚÎÒ°Ñ·½·¨×ܽáÏ£¬Ï£Íû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
µÚÒ»²½£ºÏÂÔØjdkºÍtomcat
µÚ¶þ²½£º°²×°ºÍÅäÖÃÄãµÄjdkºÍtomcat£ºÖ´ÐÐjdkºÍtomcatµÄ°²×°³ÌÐò£¬È»ºóÉèÖð´ÕÕ·¾¶½øÐа²×°¼´¿É¡£
1.°²×°j2sdkÒÔºó£¬ÐèÒªÅäÖÃһϻ·¾³±äÁ¿£¬ÔÚÎҵĵçÄÔ->ÊôÐÔ->¸ß¼¶->»·¾³±äÁ¿->ϵͳ±äÁ¿ÖÐÌí¼Ó ......
¼ÇµÃ²¿ÃÅÀÏ´óÔø¾Ëµ¹ý£¬javaµÄÀ¬»ø»ØÊÕ»úÖƶÔÓÚjavaÌåϵ½á¹¹µÄѧϰ·Ç³£ÖØÒª¡£ÕâÀォÔĶÁµÄһЩÎÄÏ×ÕûÀí×ܽá³öÀ´£¬¼ÇÊöjavaµÄ¼¸ÖÖÀ¬»ø»ØÊÕËã·¨¡£
À¬»ø»ØÊÕËã·¨ÓÐÁ½¸ö»ù±¾µÄÎÊÌ⣺1.±ØÐë¼ì²âµ½À¬»ø¶ÔÏó¡£2.±ØÐëÖØÐÂÉùÃ÷±»À¬»ø¶ÔÏóÕ¼ÓõĶѿռ䲢ÇÒÈöѿռä¿ÉÓá£
¿É´ïÐÔ ......
public class MyEclipseGen {
private static final String LL = "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA, penalties range up ......