看你使用的是什么package,用dom4j举一个例子: SAXReader saxreader = new SAXReader();
//saxreader.setValidation(true);
//File file = new File(cfgName);
try
{
InputStream in = this.getClass().getResourceAsStream(file);
Document doc;
doc= saxreader.read(in); Element root = doc.getRootElement();
Iterator ite = root.elementIterator();
while( ite.hasNext() )
System.out.println("element name attribute:" + root.attributeValue("name"));
}
catch(DocumentException ex)
{
ex.printStackTrace();
return false;
}
catch(Exception ex)
{
ex.printStackTrace();
return false;
}
还有很多对象和方法你可以看看dom4j的文档
//saxreader.setValidation(true);
//File file = new File(cfgName);
try
{
InputStream in = this.getClass().getResourceAsStream(file);
Document doc;
doc= saxreader.read(in); Element root = doc.getRootElement();
Iterator ite = root.elementIterator();
while( ite.hasNext() )
System.out.println("element name attribute:" + root.attributeValue("name"));
}
catch(DocumentException ex)
{
ex.printStackTrace();
return false;
}
catch(Exception ex)
{
ex.printStackTrace();
return false;
}
还有很多对象和方法你可以看看dom4j的文档
解决方案 »
- s2sh,删除jsp行数据。
- mysql 中limit 参数限定为常量。。。。但我需要使用变量啊。怎么办?
- hibernate3.5 中的slf4j报错求高手解决
- tomcat内存上涨问题
- 调用servlet时出错
- 在myeclipse下开发dwr有像开发extjs用的spket这种自动提示代码的插件么?
- struts2 初级问题
- struts tiles 的问题
- 关于对用户对数据操作的记录问题
- 一个比较大的web系统,业务层有一部分用ejb实现,我该如何来布置?
- joss如何给你的beans提供EJB container,jbossTx等服务,你的beans和jboss运行在同一个进程吗?
- 怎样让jboss技持jsp和servlet呢???回答马上结帖~~~~~
那位朋友有JDom得文档 ?
我也正在搞这个,但在JBuilder下实现很麻烦,要看看帮助