java½âÎöXMLµÄËÄÖÖ·½·¨
XMLÏÖÔÚÒѾ³ÉΪһÖÖͨÓõÄÊý¾Ý½»»»¸ñʽ,ËüµÄƽ̨ÎÞ¹ØÐÔ,ÓïÑÔÎÞ¹ØÐÔ,ϵͳÎÞ¹ØÐÔ,¸øÊý¾Ý¼¯³ÉÓë½»»¥´øÀ´Á˼«´óµÄ·½±ã¡£¶ÔÓÚXML±¾ÉíµÄÓ﷨֪ʶÓë¼¼Êõϸ½Ú,ÐèÒªÔĶÁÏà¹ØµÄ¼¼ÊõÎÄÏ×,ÕâÀïÃæ°üÀ¨µÄÄÚÈÝÓÐDOM(Document Object Model),DTD(Document Type Definition),SAX(Simple API for XML),XSD(Xml Schema Definition),XSLT(Extensible Stylesheet Language Transformations),¾ßÌå¿É²ÎÔÄw3c¹Ù·½ÍøÕ¾Îĵµhttp://www.w3.org»ñÈ¡¸ü¶àÐÅÏ¢¡£
XMLÔÚ²»Í¬µÄÓïÑÔÀï½âÎö·½Ê½¶¼ÊÇÒ»ÑùµÄ,Ö»²»¹ýʵÏÖµÄÓï·¨²»Í¬¶øÒÑ¡£»ù±¾µÄ½âÎö·½Ê½ÓÐÁ½ÖÖ,Ò»ÖÖ½ÐSAX£¬ÁíÒ»ÖÖ½ÐDOM¡£SAXÊÇ»ùÓÚʼþÁ÷µÄ½âÎö,DOMÊÇ»ùÓÚXMLÎĵµÊ÷½á¹¹µÄ½âÎö¡£¼ÙÉèÎÒÃÇXMLµÄÄÚÈݺͽṹÈçÏÂ:
<?xml version="1.0" encoding="UTF-8"?>
<employees>
<employee>
<name>ddviplinux</name>
<sex>m</sex>
<age>30</age>
</employee>
</employees>
±¾ÎÄʹÓÃJAVAÓïÑÔÀ´ÊµÏÖDOMÓëSAXµÄXMLÎĵµÉú³ÉÓë½âÎö¡£
Ê×Ïȶ¨ÒåÒ»¸ö²Ù×÷XMLÎĵµµÄ½Ó¿ÚXmlDocument Ëü¶¨ÒåÁËXMLÎĵµµÄ½¨Á¢Óë½âÎöµÄ½Ó¿Ú¡£
package com.alisoft.facepay.framework.bean;
/**
*
* @author hongliang.dinghl
* ¶¨ÒåXMLÎĵµ½¨Á¢Óë½âÎöµÄ½Ó¿Ú
*/
public interface XmlDocument {
/**
* ½¨Á¢XMLÎĵµ
* @param fileName Îļþȫ·¾¶Ãû³Æ
*/
public void createXml(String fileName);
/**
* ½âÎöXMLÎĵµ
* @param fileName Îļþȫ·¾¶Ãû³Æ
*/
public void parserXml(String fileName);
}
1.DOMÉú³ÉºÍ½âÎöXMLÎĵµ
Ϊ XML ÎĵµµÄÒѽâÎö°æ±¾¶¨ÒåÁËÒ»×é½Ó¿Ú¡£½âÎöÆ÷¶ÁÈëÕû¸öÎĵµ£¬È»ºó¹¹½¨Ò»¸öפÁôÄÚ´æµÄÊ÷½á¹¹£¬È»ºó´úÂë¾Í¿ÉÒÔʹÓà DOM ½Ó¿ÚÀ´²Ù×÷Õâ¸öÊ÷½á¹¹¡£Óŵ㣺Õû¸öÎĵµÊ÷ÔÚÄÚ´æÖУ¬±ãÓÚ²Ù×÷£»Ö§³Öɾ³ý¡¢Ð޸ġ¢ÖØÐÂÅÅÁеȶàÖÖ¹¦ÄÜ£»È±µã£º½«Õû¸öÎĵµµ÷ÈëÄڴ棨°üÀ¨ÎÞÓõĽڵ㣩£¬ÀË·Ñʱ¼äºÍ¿Õ¼ä£»Ê¹Óó¡ºÏ£ºÒ»µ©½âÎöÁËÎĵµ»¹Ðè¶à´Î·ÃÎÊÕâЩÊý¾Ý£»Ó²¼þ×ÊÔ´³ä×㣨ÄÚ´æ¡¢CPU£©¡£
package com.alisoft.facepay.framework.bean;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.p
Ïà¹ØÎĵµ£º
ÔËÐÐʱ°ó¶¨Ò²½Ð¶¯Ì¬°ó¶¨£¬ËüÊÇÒ»ÖÖµ÷ÓöÔÏó·½·¨µÄ»úÖÆ¡£Javaµ÷ÓöÔÏó·½·¨Ê±£¬Ò»°ã²ÉÓÃÔËÐÐʱ°ó¶¨»úÖÆ¡£
1£®JavaµÄ·½·¨µ÷Óùý³Ì
±àÒëÆ÷²é¿´¶ÔÏóµÄÉùÃ÷ÀàÐͺͷ½·¨Ãû£¨¶ÔÏó±äÁ¿µÄÉùÃ÷ÀàÐÍ£©¡£Í¨¹ýÉùÃ÷ÀàÐÍÕÒµ½·½·¨ÁÐ±í¡£
±àÒëÆ÷²é¿´µ÷Ó÷½·¨Ê±ÌṩµÄ²ÎÊýÀàÐÍ¡£
Èç¹û·½·¨ÊÇprivate¡¢static¡¢final»òÕß¹¹ÔìÆ÷£¬±àÒëÆ ......
xml
<mime>
<content>
<type>text/plain</type>
<big>357</big>
<text>D:\\cybercourttext2009101410241364.txt</text>
</content>
<content>
<type>text/plain</type>
<big>357</big>
<text>D:\\cybercourttext2009 ......
40¡¢¹¹ÔìÆ÷ConstructorÊÇ·ñ¿É±»override?
¡¡¹¹ÔìÆ÷Constructor²»Äܱ»¼Ì³Ð£¬Òò´Ë²»ÄÜÖØдOverriding£¬µ«¿ÉÒÔ±»ÖØÔØOverloading¡£
41¡¢ÊÇ·ñ¿ÉÒԼ̳ÐStringÀà?
¡¡¡¡StringÀàÊÇfinalÀà¹Ê²»¿ÉÒԼ̳С£
42¡¢swtichÊÇ·ñÄÜ×÷ÓÃÔÚbyteÉÏ£¬ÊÇ·ñÄÜ×÷ÓÃÔÚlongÉÏ£¬ÊÇ·ñÄÜ×÷ÓÃÔÚStringÉÏ?
¡¡¡¡switch£¨expr1£©ÖУ¬expr1ÊÇÒ»¸öÕûÊý±í´ ......
58¡¢Ï̵߳Ļù±¾¸ÅÄî¡¢Ï̵߳Ļù±¾×´Ì¬ÒÔ¼°×´Ì¬Ö®¼äµÄ¹Øϵ
¡¡¡¡Ïß³ÌÖ¸ÔÚ³ÌÐòÖ´Ðйý³ÌÖУ¬Äܹ»Ö´ÐгÌÐò´úÂëµÄÒ»¸öÖ´Ðе¥Î»£¬Ã¿¸ö³ÌÐòÖÁÉÙ¶¼ÓÐÒ»¸öỊ̈߳¬Ò²¾ÍÊdzÌÐò±¾Éí¡£
JavaÖеÄÏß³ÌÓÐËÄÖÖ״̬·Ö±ðÊÇ£ºÔËÐС¢¾ÍÐ÷¡¢¹ÒÆð¡¢½áÊø¡£
59¡¢JSPµÄ³£ÓÃÖ¸Áî
<%@page language="java" csession="true" buffer="64kb" autoFlush ......
´«ÖDz¥¿ÍµÄJAVA SE¸ß¼¶ÊÓƵ2 IO ×Ôѧ±Ê¼Ç:
FileÀࣺ
1.IO°üÖÐΨһ´ú±í´ÅÅÌÎļþ±¾ÉíÐÅÏ¢µÄÀ࣬¶ø²»ÊÇÎļþÖÐÄÚÈÝ¡£
2.´´½¨¡¢É¾³ý¡¢ÖØÃüÃûÎļþµÈ·½·¨¡£
3.JavaÖÐĿ¼±»µ±×÷Ò»ÖÖÌØÊâÎļþʹÓã¬list·½·¨·µ»ØËùÓÐ×ÓĿ¼ºÍÎļþ¡£
4.UnixÏ·¾¶· ......