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

java ×Ô¼º×öµÄ¶ÔXMLÎļþµÄ¶Áд²Ù×÷

XMLÎļþʵÀý£º
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Resource auth="Container" maxActive="20" name="sss" password="123"
type="javax.sql.DataSource" />
<Resource auth="Container" maxActive="20" password="9003"
type="javax.sql.DataSource" />
<Resource as="nnnnnnnnnnnn" name="jdbc/sqlserver-database" />
</Context>

JavaÀࣺ
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import javax.imageio.metadata.IIOMetadataNode;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.sun.org.apache.xerces.internal.dom.AttrNSImpl;
import com.sun.org.apache.xerces.internal.impl.xs.opti.DefaultNode;
public class T2 {
/**
* ½«Ð޸ĵÄÄÚÈÝÌí¼Óµ½xmlÎļþÖÐ
*
* @param document
* @param filename
* @return
*/
public static boolean doc2XmlFile(Document document, String filename) {
boolean flag = true;
try {
/** ½«documentÖеÄÄÚÈÝдÈëÎļþÖÐ */
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
/** ±àÂë */
//transformer.setOutputProperty(OutputKeys.ENCODING, "GBK");
DOMSource source = new DOMSource(document);
//ÅжÏ·¾¶¿ªÍ·ÓÐûÓГ\”Èç¹ûÓÐÔòÈ¥µô
filename = "C".equals(filename.charAt(0)) ? filename : filename.substring(1);
StreamResult result = new StreamResult(new FileOutputStream(filename));
transformer.transform(source, result);
} catch (Exception ex) {
flag = false;
ex.printStackTrace();
}
r


Ïà¹ØÎĵµ£º

¡°XML DOM¶ÁÈ¡½ÚµãÐÅÏ¢¡±Ð¡½á

<?
XML DOM¶ÁÈ¡½ÚµãÐÅÏ¢Óöµ½ÎÊÌâ×ܽ᣺  
 
1:NodeList: ʹÓýڵãµÄchildNodesÊôÐÔ»òÕßdocument¶ÔÏóµÄgetElementsByTagName()·½·¨£¬¾Í»á·µ»ØÒ»¸ö°üº¬½ÚµãÁбíµÄNodeList
 
2: ÔÚ XML DOM ÖУ¬½ÚµãµÄ¹Øϵ±»¶¨ÒåΪ½ÚµãµÄÊôÐÔ£º
·  parentNode
·  childNodes
· ......

JavaÓïÑÔѧУµÄΣÏÕÐÔ£¨ÒëÎÄ£©


¾õµÃÁôÑÔºÜÓеÀÀí£¬ÎÄÕºÜÕÜÀí£¬Ò»²¢×ªÔØ ½¨Òé¶ÁÕß¿´Ô­ÎĵØÖ·
×÷Õߣº ÈîÒ»·å
ÈÕÆÚ£º 2008Äê12Ô 7ÈÕ
ÏÂÃæµÄÎÄÕÂÊÇMore Joel on SoftwareÒ»ÊéµÄµÚ8ƪ¡£
ÎÒ¾õµÃ·­ÒëÄѶȺܴó£¬ÕûÕûÁ½¸ö¹¤×÷ÈÕ£¬Ã¿Ìì8СʱÒÔÉÏ£¬²ÅÒë³öÁË5000×Ö¡£³ýÁËJoel´óÁ¿Ê¹ÓÃÙµÓÁíÒ»¸öÔ­ÒòÊÇÔ­ÎÄÉæ¼°"±à³ÌÔ­Àí"£¬ºÃ¶à¶«Î÷ÎÒ¸ù±¾²»¶®¡£Ï£ ......

JAVAÁ¬½ÓÊý¾Ý¿â´óÈ«

JAVAÁ¬½ÓÊý¾Ý¿â´óÈ«
 
 
1£®Oracle8/8i/9iÊý¾Ý¿â£¨thinģʽ£©
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:ts"; //tsΪÊý¾Ý¿âµÄSID
String user="sa";
String password="";
Connection conn= DriverManager.getConnection(url,u ......

java JDBC ResultSetÏê½â(javaÊý¾Ý¿â²Ù×÷)

ÕâƪÎÄÕ²¢Ã»Óиø³öÈçºÎʹÓÃResultSetµÄ¾ßÌåÀý×Ó£¬Ö»ÊÇ´ÓResultSetµÄ¹¦ÄÜÐÔÉϽøÐÐÁËÏêϸµÄ½²Êö¡£Ï£ÍûÕâƪÎÄÕ¶Դó¼ÒÀí½âResultSetÄܹ»ÓÐËù°ïÖú¡£ÏÂÃæ¾ÍÊÇÕâƪÎÄÕµľßÌåÄÚÈÝ¡£
½á¹û¼¯(ResultSet)ÊÇÊý¾ÝÖвéѯ½á¹û·µ»ØµÄÒ»ÖÖ¶ÔÏ󣬿ÉÒÔ˵½á¹û¼¯ÊÇÒ»¸ö´æ´¢²éѯ½á¹ûµÄ¶ÔÏ󣬵«Êǽá¹û¼¯²¢²»½ö½ö¾ßÓд洢µÄ¹¦ÄÜ£¬Ëûͬʱ»¹¾ßÓв ......

Java ¶ÔxmlÎļþµÄ¶Áд²Ù×÷

/**
* ÃèÊö£ºÊý¾Ý¿â³õʼ»¯»ù±¾Àà
*
* @×÷Õß ÍõȺ
* @´´½¨ÈÕÆÚ 2010-04-08
* @ÐÞ¸ÄÈË xxx
* @ÐÞ¸ÄÈÕÆÚ xxx
* @¼ì²éÈË xxx
* @¼ì²éÈÕÆÚ xxx
*/
import java.sql.SQLException;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.oumasoft.bstmanage.ibatis.SqlMapConfig;
import com.oumasof ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ