·â×°Êý¾Ý¿âÇý¶¯³ÌÐò£¬ÓýâÎöxmlÎļþµÄ·½Ê½»ñÈ¡Çý¶¯£¿
<?xml version="1.0" encoding="UTF-8"?>
<database>
<dbinfo id="100">
<dirver>com.mysql.jdbc.Driver </dirver>
<url>jdbc:mysql://localhost:3306/testdb </url>
<username>root </username>
<password>321 </password>
</dbinfo>
</database>
½âÎöxml£º
public class DBParse {
static DBConfig config = new DBConfig();
public static DBConfig parseXml(){
ConnectionDB con = new ConnectionDB();
SAXBuilder builder = new SAXBuilder();
File file = new File("c://MysqlDB.xml");
try {
Document doc = builder.build(file);
Element root = doc.getRootElement();
List list = root.getChildren();
for(Iterator iterator = list.iterator();iterator.hasNext();)
{
Element dbinfo = (Element) iterator.next();
config.setDriver(dbinfo.getChildText("driver"));
config.setUrl(dbinfo.getChildText("url"));
config.setUsername(dbinfo.getChildText("username"));
config.setPassword(dbinfo.getChildText("password"));
}
} catch (JDOMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOExceptio
Ïà¹ØÎÊ´ð£º
ÐèÒª¼æÈÝie firefox safari µÈä¯ÀÀÆ÷
IE ¿ÉÒÔÓÃFSO µ«ÊÇÔÚÆäËûä¯ÀÀÆ÷²»ÄÜÓÃ
Ò»°ãµÄä¯ÀÀÆ÷´¦ÓÚ°²È«¿¼ÂǶ¼²»ÔÊÐíJavaScript¶Áд±¾µØÎļþµÄ°É
XMLÎĵµÄÚÈÝÈçÏ£¨user.xml£©£º
<?xml version="1.0&qu ......
Êý¾Ý¿â±íÖÐÓÐÒ»ÁУ¨TranXml£©ÀàÐÍÊÇxml£¬´æ´¢µÄÊÇÀàËÆ
<fathernode>
<a>aaa
</a>
<b>bbb
</b>
</fathernode>
µÄÐÅÏ¢£¬²¢ÇÒͨ¹ý²éѯ·½· ......
·µ»ØÈçÏÂxml×Ö·û´®£º
<?xml version="1.0" encoding="utf-8" ?>
<DeliverMsg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www ......
XML¶ÔÏóÓëXMLList¶ÔÏóÓÐÊ²Ã´Çø±ð£¿[
¹ËÃû˼Ò壬XMLList¾ÍÊÇÒ»¸öLIST£¬ÊÇÒ»¸ö¼¯ºÏ¡£
List °üº¬XMLÖеÄËùÓÐÔªËØ£¬ÓÃList¿ÉÒÔ·ÃÎÊXML¸ùÔªËØÏµÄ×ÓÔªËØ
ÒýÓÃ
List °üº¬XMLÖеÄËùÓÐÔªËØ£¬ÓÃList¿ÉÒÔ·ÃÎÊXML¸ùÔª ......
RT ÓÐʲô·½·¨°ÑSTRINGת³ÉXMLµÄELEMENT¶ÔÏó£¬Ð´ÈëDOCUMENT¶ÔÏóÖÐÈ¥£¬²»ÒªÈ¥¶ÁдÎļþ
string = " <data> <id> </id> </data>",ÄÇDOCUMENTÖÐ2¸ö²ã´ÎµÄELEMENT¶ÔÏó
ÄÄλ´ ......