Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JAVA ½âÎö XML

XMLÎļþʱºÜ¶àÏîÄ¿¾­³£Ê¹ÓõÄÅäÖûòÕ߯äËûÓÃ;µÄÎļþ¸ñʽ£¬½âÎöxmlÎļþ¸ñʽµÄ¿ª·¢°üÒ²ºÜ¶à£¬±¾ÎÄÖ÷ҪʹÓÃjava×Ô´øµÄDOM½âÎö°ü¡£±¾ÎÄÒÔÒ»¸öʵ¼ÊÀý×ÓÀ´½²Êö½âÎöxmlÎļþµÄ¹ý³Ì¡£
Ä¿±ê£º½âÎöÕâÑùÒ»¸öXMLÎļþ
employees.xml
=======ÄÚÈÝ¿ªÊ¼========
<?xml version="1.0" encoding="UTF-8"?>
<Personnel>
  <Employee type="permanent">
        <Name>Seagull</Name>
        <Id>3674</Id>
        <Age>34</Age>
   </Employee>
  <Employee type="contract">
        <Name>Robin</Name>
        <Id>3675</Id>
        <Age>25</Age>
    </Employee>
  <Employee type="permanent">
        <Name>Crow</Name>
        <Id>3676</Id>
        <Age>28</Age>
    </Employee>
</Personnel>
=======ÄÚÈݽáÊø========
Ä¿±êÊÇ£ºÊä³öÈçÏÂÄÚÈÝ
Employee Details - Name:Seagull, Type:permanent, Id:3674, Age:34.
Employee Details - Name:Robin, Type:contract, Id:3675, Age:25.
Employee Details - Name:Crow, Type:permanent, Id:3676, Age:28.
Ö÷Òª²½Öè
1£¬
Get a document builder using document builder factory and parse the xml
file to create a DOM object

Get a list of employee elements from the DOM

For each employee element get the id, name, age and type. Create an
employee value object and add it to the list.

At the end iterate through the list and print the employees to verify we
parsed it right.
a) »ñÈ¡document builder
public void parseXmlFile(){
//get the factory
DocumentBuilderFactory dbf = DocumentBu


Ïà¹ØÎĵµ£º

¹ØÓÚJavaŵÂüµ×µÄÒ»µãСÀúÊ·

   ¹ØÓÚJavaŵÂüµ×µÄÒ»µãСÀúÊ·
 ×î½üºÜ¶àÈËÎÊJavaŵÂüµ×ÊÇʲôÒâ˼£¬×÷ΪJavaŵÂüµ×µÄÒ»ÃûÀÏͬ־£¬ÎÒ¼òµ¥µÄ½éÉÜÏÂJavaŵÂüµ×¡£
 JavaŵÂüµ×³ÉÁ¢ÓÚ2008Äê7ÔÂ29ÈÕ£¬ÔÚÒ»¸öÈȺ¹³¯ÌìµÄÈÕ×ÓÀ¼¸¸öÂú»³Ï£ÍûµÄÓÐÖ¾ÇàÄê£¬×øÔÚÏæ½­ºÓ°ø£¬Ì¸×Å×Ô¼ºÀíÏ룬ÆäÖÐÒ»ÈË˵£¬¼ÙÈçÎÒÃÇÓÐ×Ô¼ºµÄÍŶӸÃÓжàºÃ£¬ÓÚÊ ......

ÔÚJavaÖжÔExcel²Ù×÷

´´½¨Ò»¸öÎļþtemp£¬Í¬Ê±ÔÚtemp Ŀ¼Ï´´½¨Ò»¸öoutpath.xls
д²Ù×÷
 
package com;
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import jxl.Workbook;
import jxl.format.UnderlineStyle;
import jxl.write.DateTime;
import jxl.write.Label;
import jxl.write.Number ......

java¿ì½Ý¼ü

Ctrl+1 ¿ìËÙÐÞ¸´(×î¾­µäµÄ¿ì½Ý¼ü,¾Í²»Óöà˵ÁË)
Ctrl+D: ɾ³ýµ±Ç°ÐÐ
Ctrl+Alt+↓ ¸´ÖƵ±Ç°Ðе½ÏÂÒ»ÐÐ(¸´ÖÆÔö¼Ó)
Ctrl+Alt+↑ ¸´ÖƵ±Ç°Ðе½ÉÏÒ»ÐÐ(¸´ÖÆÔö¼Ó)
Alt+↓ µ±Ç°ÐкÍÏÂÃæÒ»Ðн»»¥Î»ÖÃ(ÌØ±ðʵÓÃ,¿ÉÒÔʡȥÏȼôÇÐ,ÔÙÕ³ÌùÁË)
Alt+↑ µ±Ç°ÐкÍÉÏÃæÒ»Ðн»»¥Î»ÖÃ(ͬÉÏ)
Alt+← ǰһ¸ö±à¼­µ ......

JavaÎļþ²Ù×÷´óÈ«£¨ËÄ£©

26.ÒÆ¶¯Ò»¸öÎļþ¼ÐÏÂËùÓÐÎļþµ½ÁíÒ»¸öĿ¼
//import java.io.*;
File movefile=new File(%%1);
File[] movefiles=movefile.listFiles();
for(int i=0;i<movefiles.length;i++){
if(movefiles[i].isFile()){
 int bytesum = 0;
 int byteread  ......

JavaÎļþ²Ù×÷´óÈ«£¨Î壩

34.¶ÁÈ¡iniÎļþÊôÐÔ
//import java.io.*;
//import java.util.*;
//import java.util.regex.*; 
//private HashMap configMap=null;
private Map<String, Serializable> configMap=null;
String %%2=null;
if (configMap == null)&n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ