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

Java²Ù×÷XMLÎļþ dom4j ƪ¡¾×ª¡¿

ÔÚÏîÄ¿ÖУ¬ÎÒÃǺܶ඼Óõ½ÁËxmlÎļþ£¬ÎÞÂÛÊDzÎÊýÅäÖû¹ÊÇÓëÆäËüϵͳµÄÊý¾Ý½»»¥¡£
½ñÌì¾ÍÀ´½²Ò»ÏÂJava ÖÐʹÓÃdom4jÀ´²Ù×÷XMLÎļþ¡£
ÎÒÃÇÐèÒªÒýÈëµÄ°ü£º
//Îļþ°ü
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileWriter;
//¹¤¾ß°ü
import java.util.Iterator;
import java.util.List;
//dom4j°ü
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
1¡¢½«XMLÎļþµÄÄÚÈÝת»¯ÎªString
   /**
    * doc2String
    * ½«xmlÎĵµÄÚÈÝתΪString
    * @return ×Ö·û´®
    * @param document
    */
   public static String doc2String(Document document)
   {
      String s = "";
      try
      {
           //ʹÓÃÊä³öÁ÷À´½øÐÐת»¯
           ByteArrayOutputStream out = new ByteArrayOutputStream();
           //ʹÓÃGB2312±àÂë
           OutputFormat format = new OutputFormat("  ", true, "GB2312");
           XMLWriter writer = new XMLWriter(out, format);
           writer.write(document);
           s = out.toString("GB2312");
 &n


Ïà¹ØÎĵµ£º

Java NIO APIÏê½â

 
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔǰ£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......

JavaÓʼþȺ·¢Æ÷

JavaÓʼþȺ·¢Æ÷
 ¹¦ÄÜ˵Ã÷£º
  1¡¢ÅúÁ¿Ñ­»··¢ËÍÓʼþ
  2¡¢·¢ËÍHTMLÎļþ£¬´ý·¢Ë͵ÄÓʼþÒÔhtmµÄ¸ñʽ´æ·Å£¬¿ÉÒÔÊÇÍøÂçÉϵÄhtmÎļþ£¬¿ÉÒÔÊDZ¾µØµÄhtmÎļþ
  3¡¢¿ÉÒÔÖ¸¶¨·¢Ë͸½¼þµÄĿ¼£¬ÏµÍ³»á¼ÓÔØÖ¸¶¨Ä¿Â¼µÄÈ«²¿¸½¼þÒ»Æð·¢ËÍ
  4¡¢·¢ËÍÓʼþÒÔtxtÎļþ±£´æ£¬Ã¿Ðб£´æÒ»¸öÓʼþ ......

12.18 javaÖеÄview£¬ibatis dao

JavaÄÚ²¿À൱³õµÄÉè¼ÆÄ¿µÄÓ¦¸ÃÊÇʵÏÖ¶àÖØ¼Ì³Ð£¬ºóÀ´·¢ÏÖÄÚ²¿À໹´øÀ´ÁËÆäËûºÃ´¦£¬Èç¿ÉÒÔʹÓÃÄÚ²¿Àà°üװһЩº¯Êý£¬ÊµÏÖº¯Êý¼¶±ðµÄȨÏÞ¿ØÖƵȡ£
     JavaÖУ¬LIst.subList()µÈ·½·¨²úÉúµÄÊÇÒ»¸öview£¬¼´²»ÊÇ´«Öµ£¬¶ø½öÊÇÒýÓá£ËƺõÔÚjavaÖгýÁËprimitiveÀ࣬ÆäËûÀà¶¼Ðènew²ÅÄܲúÉúжÔÏó¡£
iBatis DAO¿ò¼ÜÍ ......

JDOMÉú³ÉXMLÎĵµ

Ê×ÏÈÏÂÔØJDOM.JAR¼ÓÈëµÄclasspathÖÐ
package com.test.search;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.output.XMLOutputter;
public class ToXML {
public ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ