我想用jbuilder7解析xml文件,大家给点建议吧!!!! 1、首先找一些xml的资料,看看xml是怎么一回事。2、大致了解之后,再学一学jdom包(java语言的xml工具包),这个包相对其他包而言,简单且易学易用。这时一般应用应该已经可以应付了。3、然后可以向更深层次发展。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.io.*;import javax.xml.parsers.*;import org.w3c.dom.*;DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Logger.global.info("Load settings from " + config_fullpath); Document doc = db.parse(config_fullpath); //get DB connection string { NodeList nl = doc.getElementsByTagName("connectionstring"); Node conn_node = nl.item(0); DBConnString = conn_node.getFirstChild().getNodeValue(); } //get port number { NodeList nl = doc.getElementsByTagName("portnumber"); Node conn_node = nl.item(0); port = Integer.parseInt(conn_node.getFirstChild().getNodeValue()); }<?xml version="1.0" encoding="UTF-8"?><configuration><connectionstring>jdbc:microsoft:sqlserver://192.168.0.2:1433;user=sa;password=sa;DatabaseName=test</connectionstring><portnumber>1000</portnumber></configuration> jbuilder里面用sax,还是dom解析xml,哪个好些? 至于用sax,还是dom解析xml,与JBuilder没有关系,关键还是你的需求,具体如何操作。 学习中,我是XML中级进阶,但我是JAVA菜鸟 建议关注JDOM包,功能强大,使用简单。JBuilder中已经包含了。 dwr 上传图片 返回值后file框的地址被清空 关于web框架 有需要计算机电子书籍的请进 有关InterceptorsFactory的一个无法解决的问题 想学j2ee,请问用什么教材 struts的问题 Throwable 是否经常使用 我公司招聘Java/JSP编程人员,准自行开发portal企业入口网站,办公OA系统(斑竹手下留情) 请问:哪里有关Struts的资料!! 请问一下!大哥在ejb2.0 cmp 的模糊查找 学习EJB的困惑 应用程序结构设计问题(servlet缓冲池)
import javax.xml.parsers.*;
import org.w3c.dom.*;DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Logger.global.info("Load settings from " + config_fullpath);
Document doc = db.parse(config_fullpath);
//get DB connection string
{
NodeList nl = doc.getElementsByTagName("connectionstring");
Node conn_node = nl.item(0);
DBConnString = conn_node.getFirstChild().getNodeValue(); }
//get port number
{
NodeList nl = doc.getElementsByTagName("portnumber");
Node conn_node = nl.item(0);
port = Integer.parseInt(conn_node.getFirstChild().getNodeValue());
}<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<connectionstring>jdbc:microsoft:sqlserver://192.168.0.2:1433;user=sa;password=sa;DatabaseName=test</connectionstring>
<portnumber>1000</portnumber>
</configuration>