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");
Ïà¹ØÎĵµ£º
²»¹ÜÄãÐŲ»ÐÅ£¬¼´Ê¹¶àôÊìÁ·±à³ÌµÄÈËÔ±ÔÚcodingµÄʱºò¶¼»á³öÏÖÒâÏë²»µ½µÄbug¡£ÔÚÉÏƪÎÄÕÂÖÐÎÒÔøÌáµ½£¬bugµÄÔì³ÉÊǶà¸ö·½ÃæµÄ×ۺϽá¹û£¬ÓÐЩbugÊÇ¿ÉÒÔÐÞ¸´µÄ£¬µ«ÊÇÓÐЩÂß¼ÉϵÄbugÒªÐÞ¸´¿É²»ÊÇÄÇôÈÝÒ×µÄÊÂÇ飬¾ÍÏñÎÒÃÇ×ö´íÁËÒ»¼þÊÂÇ飬Èç¹û²»È¥´Ó¸ù±¾ÉϸÄÕý¾Í»á·¸¸ü´óµÄ´íÎóÒ»Ñù£¬ÓÐʱºòbugÒ²ÊÇÒ»¸ö»ýÀ ......
JavaÀïÓиöºÜÖØÒªµÄÌØÉ«ÊÇException £¬Ò²¾ÍÊÇ˵ÔÊÐí³ÌÐò²úÉúÀýÍâ×´¿ö¡£¶øÔÚѧJava µÄʱºò£¬ÎÒÃÇÒ²Ö»ÖªµÀException µÄд·¨£¬È´Î´±ØÕæÄÜÁ˽ⲻͬÖÖÀàµÄException µÄÇø±ð¡£
Ê×ÏÈ£¬ÄúÓ¦¸ÃÖªµÀµÄÊÇJava ÌṩÁËÁ½ÖÖException µÄģʽ£¬Ò»ÖÖÊÇÖ´ÐеÄʱºòËù²úÉúµÄException (Runtime Exception)£¬ÁíÍâÒ»ÖÖÔòÊÇÊÜ¿ØÖƵÄException ......
1.×Ö·û
x ×Ö·û x¡£ÀýÈça±íʾ×Ö·ûa
\\ ·´Ð±Ïß×Ö·û¡£ÔÚÊéдʱҪдΪ\\\\¡££¨×¢Ò⣺ÒòΪjavaÔÚµÚÒ»´Î½âÎöʱ,°Ñ\\\\½âÎö³ÉÕýÔò±í´ïʽ\\£¬ÔÚµÚ¶þ´Î½âÎöʱÔÙ½âÎöΪ\£¬ËùÒÔ·²ÊDz»ÊÇ1.1Áоٵ½µÄתÒå×Ö·û£¬°üÀ¨1.1µÄ\\,¶øÓÖ´øÓÐ\µÄ¶¼ÒªÐ´Á½´Î£©
\0n ´øÓа˽øÖÆÖµ 0µÄ×Ö·û ......
¹ØÓÚ Java Concurrency
×Ô´ÓJavaµ®Éú֮ʱ£¬Java ¾ÍÖ§³Ö²¢ÐеĸÅÄ±ÈÈçÏ̺߳ÍËø»úÖÆ¡£Õâ¸ö½Ì³Ì°ïÖú¿ª·¢¶àÏß³ÌJava³ÌÐòÔ±Äܹ»Àí½âºËÐĵÄJava²¢ÐÐÀíÄîÒÔ¼°ÈçºÎʹÓÃËûÃÇ¡£ ÄÚÈÝÉæ¼°µ½JavaÓïÑÔÖеÄỊ̈߳¬ ÖØÁ·¼¶ÒÔ¼°ÇáÁ¿¼¶Í¬²½»úÖÆ ÒÔ¼°JavaSE 5 ÖеÄËø£¬Ô×ÓÁ¿ ²¢ÐÐÈÝÆ÷£¬Ï̵߳÷¶È ÒÔ¼°Ïß³ÌÖ´ÐÐÕß ......
var ProjectName = document.getElementById("<%=ProjectName.ClientID%>").innerText;
ProjectName = ProjectName.replace(/(^\s*)|(\s*$)/g, ""); // Ï൱ÓÚTrim()º¯Êý ......