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´¦ÀíµÄÓŵã·Ç³£ÀàËÆÓÚÁ÷ýÌåµÄÓŵ㡣·ÖÎöÄܹ»Á¢¼´¿ªÊ¼£¬¶ø²»ÊǵȴýËùÓеÄÊý¾Ý±»´¦Àí¡£¶øÇÒ£¬ÓÉÓÚÓ¦ÓóÌÐ
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
ת×Ôhttp://hi.baidu.com/oyamao/blog/item/bcc75d5128468868843524eb.html
Òì³£´¦ÀíÊdzÌÐòÉè¼ÆÖÐÒ»¸ö·Ç³£ÖØÒªµÄ·½Ã棬ҲÊdzÌÐòÉè¼ÆµÄÒ»´óÄѵ㣬´ÓC¿ªÊ¼£¬ÄãÒ²ÐíÒѾ֪µÀÈçºÎÓÃif...else...À´¿ØÖÆÒì³£ÁË£¬Ò²ÐíÊÇ×Ô·¢µÄ£¬È»¶øÕâÖÖ¿ØÖÆÒ쳣ʹ¿à£¬Í¬Ò»¸öÒì³£»òÕß´íÎóÈç¹û¶à¸öµØ·½³öÏÖ£¬ÄÇôÄãÿ¸öµØ·½¶¼Òª×öÏàͬ´¦Àí£¬¸Ð¾õÏൠ......
ÔÚÍøÉÏÒ²¿´Á˺ܶණÎ÷£¬¹ØÓÚJAVAÈí¼þ¼Ü¹¹·½ÃæµÄ¶«Î÷£¬ÏÖÔÚ»¹ÕæÊǺÜÄÑÕÒµ½£¬²»¹ý£¬Èí¼þ¿ª·¢µÄ¼Ü¹¹»ù±¾ÊÇÏàͬµÄ¡£ËùÒÔ£¬ÎÒÔÚÍøÉϲéÕÒÁ˺ܶàÆäËûÓïÑÔ¹ØÓÚÈí¼þ¼Ü¹¹·½ÃæµÄÎÄÕ¡£ÔÙÕâÀïÒ²À´ËµËµ×Ô¼º¶ÔÈí¼þ¼Ü¹¹£¬ÌرðÊÇÔÚJAVAÏîÄ¿¼Ü¹¹·½ÃæµÄ¿´·¨¡£ËµµÃ²»Ò»¶¨¶Ô£¬µ«ÕâÒ²ÊÇÎÒ¼¸ÄêÀ´µÄ×ܽá°É¡£
1. ¾¡Á¿²»Òª¿¼ÂÇÏîÄ¿ÍâµÄÖØÓÃ
Ðí¶àÈË ......
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 ......