社区
Java EE
帖子详情
XML(thanks a lot)
mykevinboy
2003-10-28 01:56:55
怎样生成一个新的XML并向你写数据.谢谢你的帮助.
...全文
28
2
打赏
收藏
XML(thanks a lot)
怎样生成一个新的XML并向你写数据.谢谢你的帮助.
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
tomtian
2003-10-28
打赏
举报
回复
上面的说的太简单的,呵呵
不过呢,我建议,不要单用dom或者sax
用jdom和sax结合比较好
try
{
SAXBuilder sb = new SAXBuilder();
//Document doc = sb.build(new FileInputStream("D:\\WF_EIS\\classes\\wf_eis\\sql.xml"));
//取得路径,FileInputStream是取绝对路径,所以下面这个取相对路径
fileName=this.getClass().getClassLoader().getResource("../sql/sql.xml");
//System.out.println(fileName);
/**************************
*当前文件得路径
File file = new File("sql.xml");
String path = file.getCanonicalPath();
*/
if(fileName==null)
throw new Exception("file not found");
//建立doc对象
Document doc = sb.build(fileName);
//取得根节点
Element root = doc.getRootElement();
//将根节点下所有节点放入list
java.util.List sqls = root.getChildren();
//取得第一个子节点
for(int i=0; i<sqls.size();i++)
{
Element sql = (Element)sqls.get(i);
//取得子节点的值
name=sql.getChild("name").getText();
if(name.equalsIgnoreCase(sqlName))
{
sqlDetail=sql.getChild("sql_detail").getText();
break;
}
else
{
sqlDetail="java not found this sql sentence.";
}
}
}
catch(JDOMException e)
{
e.printStackTrace();
}
catch(NullPointerException e)
{
e.printStackTrace();
}
catch(Exception e)
{
e.printStackTrace();
}
return sqlDetail;
}
whyxx
2003-10-28
打赏
举报
回复
先生成一个document.写入数据,再生成XML文件
VB编程资源大全(英文源码 其它)
6 , chun
ks
.zip This will open a file and read it in "Chun
ks
" of a selected file.<END><br>7 , logging.zip This is a bas that will log installation procedures so the file can be removed later....
simple-tags
It was written with this philosophy : best performances, more secured and brings a
lot
of new functions This plugin is developped on WordPress 3.3, with the constant WP_DEBUG to TRUE. * ...
XML
必知必会:Java、C#、Python多种语言解析
XML
文档
、XPath节点和XPath语法 第7章 解析
XML
文档 解析
XML
文档概述、DOM解析
XML
、SAX解析
XML
第8章 Java语言解析
XML
DOM4J概述、示例:遍历节点、示例:插入节点、示例:删除节点 第9章 Python语言解析
XML
ElementTree模块...
Java邮件开发Fundamentals of the JavaMail API
the source of a
lot
of confusion. Much of what people are familiar with when using POP, like the ability to see how many new mail messages they have, are not supported by POP at all. These ...
eac3to V3.17
* added a flush after every log line to help GUIs * "eac3to some.mpls" now also wor
ks
if the stream files aren't there, anymore * fixed: number of subtitles was not appended to demuxed subtitles' file...
Java EE
67,513
社区成员
225,880
社区内容
发帖
与我相关
我的任务
Java EE
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
复制链接
扫一扫
分享
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章