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

·â×°Êý¾Ý¿âÇý¶¯³ÌÐò£¬ÓýâÎö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


Ïà¹ØÎÊ´ð£º

xml½âÎöÎÊÌ⣡¼±

ÎÒÊÇÀûÓÃaxiom¶Ôxml½øÐнâÎö£¡
µ«È´³öÏÖÏÂÃæµÄ´íÎó£¡
Exception in thread "main" org.apache.axiom.om.OMException: [com.ctc.wstx.exc.WstxLazyException] com.ctc.wstx.exc.WstxUnexpectedCharEx ......

ÀûÓÃC#±àдtxtת»¯µ½xmlµÄ³ÌÐò

txt ºÍXML ¸ñʽÏàÓ¦
²»½èÖúDataSet
µ¼Èë¶ÁÈ¡TXTÎļþ
È»ºóÖ±½ÓдÈëXML(ͬһÎļþ,²»Í¬Êý¾Ý,µÝÔöÔ­Êý¾ÝûÓб»¸²¸ÇÇé¿öÏÂÔö¼ÓÊý¾Ý.)
½Ì¸öÒªµã»ò×îºÃÊÇÓиö´úÂëÌáʾµÄ
¹ý·ºÃºº °ï¸öæÈö^^
²»»á£¬°ïÂ¥Ö÷ ......

ÈçºÎÌá½»xmlÀàÐÍÊý¾Ý - .NET¼¼Êõ / ASP.NET

Êý¾Ý¿â±íÖÐÓÐÒ»ÁУ¨TranXml£©ÀàÐÍÊÇxml£¬´æ´¢µÄÊÇÀàËÆ
<fathernode>
  <a>aaa
  </a>
  <b>bbb
  </b>
</fathernode>
µÄÐÅÏ¢£¬²¢ÇÒͨ¹ý²éѯ·½· ......

³õѧ£º·µ»Øxml×Ö·û´®µÄ´¦ÀíÎÊÌ⣿

·µ»ØÈçÏÂxml×Ö·û´®£º
<?xml version="1.0" encoding="utf-8" ?>
<DeliverMsg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ