JAVA²Ù×÷XMLµÄÍêÕûÀý×Ó——W3C DOMƪ
ÕâÊÇÒ»¸öÓÃJAVA W3C DOM ½øÐÐXML²Ù×÷µÄÀý×Ó£¬°üº¬Á˲éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý¡¢±£´æµÄ»ù±¾²Ù×÷¡£½ÏÍêÕûµÄÃèÊöÁËÒ»¸öXMLµÄÕû¸ö²Ù×÷Á÷³Ì¡£ÊʺϸÕÈëÃÅJAVA XML²Ù×÷µÄÅóÓѲο¼ºÍѧϰ¡£
¼ÙÉèÓÐXMLÎļþ£ºtest1.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>
<book>
<name>¹þÀﲨÌØ</name>
<price>10</price>
<memo>ÕâÊÇÒ»±¾ºÜºÃ¿´µÄÊé¡£</memo>
</book>
<book id="B02">
<name>Èý¹úÑÝÒå</name>
<price>10</price>
<memo>ËÄ´óÃûÖøÖ®Ò»¡£</memo>
</book>
<book id="B03">
<name>Ë®ä°</name>
<price>6</price>
<memo>ËÄ´óÃûÖøÖ®Ò»¡£</memo>
</book>
<book id="B04">
<name>ºìÂ¥</name>
<price>5</price>
<memo>ËÄ´óÃûÖøÖ®Ò»¡£</memo>
</book>
</books>
ÏÂÃæÊÇΪTest.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.*;
import javax.xml.xpath.*;
public class Test ...{
public static void main(String[] args) ...{
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
Element theBook=null, theElem=null, root=null;
try ...{
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder db=factory.newDocumentBuilder();
Ïà¹ØÎĵµ£º
Ò»¡¢IOÁ÷µÄÈýÖÖ·ÖÀ෽ʽ
1.°´Á÷µÄ·½Ïò·ÖΪ£ºÊäÈëÁ÷ºÍÊä³öÁ÷
2.°´Á÷µÄÊý¾Ýµ¥Î»²»Í¬·ÖΪ£º×Ö½ÚÁ÷ºÍ×Ö·ûÁ÷
3.°´Á÷µÄ¹¦Äܲ»Í¬·ÖΪ£º½ÚµãÁ÷ºÍ´¦ÀíÁ÷
¶þ¡¢IOÁ÷µÄËÄ´ó³éÏóÀࣺ
×Ö·ûÁ÷£ºReader Writer
× ......
[ÕªÒª]
±¾ÎĽéÉÜÁËһϵÁлùÓÚWindows CEµÄJavaÐéÄâ»úÒÔ¼°¼¯³É¿ª·¢»·¾³£¬ÆäÖаüÀ¨ IBM¹«Ë¾µÄVisual Age Micro Edition
£¨¾ÍÊÇÏÖÔÚµÄWebSphere Studio Device Developer£©,
Sun¹«Ë¾µÄPersonal Java, WabaSoft ·¢ÆðµÄWaba£¬Insignia¹«Ë¾µÄJeode (¾ÍÊÇÏÖÔÚEsmertecµÄJeode)£¬Nsicom¹«Ë¾µÄCrEmeÒÔ¼°New
Monics¹«Ë¾µÄPE ......
ÔÚstrutsÖÐÓкöàµÄ±êÇ©·½±ã¿ª·¢£¬±ÈÈç<logic:iterate>±êÇ©£¬¿ÉÒԺܺõÄÏÔʾlistµÄÄÚÈÝ£º
£¨Ò»£©¶ÔListµÄÑ»·±éÀú£º
1.Ïȶ¨ÒåÒ»¸öUserÀࣺ
import java.io.Serializable;
public final class User implements Serializable {
private String name = null;
private String password ......
http://babyjoycry.javaeye.com/blog/587527
1. import info.monitorenter.cpdetector.io.CodepageDetectorProxy;
2. import info.monitorenter.cpdetector.io.HTMLCodepageDetector;
3. import info.monitorenter.cpdetector.io.JChardetFacade;
4.
5. import java.io.BufferedReader;
......