JAVA中,如何往现有xml文件中加入节点,请赐教,非常急

zhaoweizhao 2004-11-22 10:10:09
<?xml version='1.0'?>
<!-- This file represents a fragment of a book store inventory database -->
<bookstore>
<book genre="novel" publicationdate="1967" ISBN="0-201-63361-2">
<title>The Confidence Man</title>
<author>
<first-name>Herman</first-name>
<last-name>Melville</last-name>
</author>
<price>11.99</price>
</book>
</bookstore>

比如像这样一个XML,我现在要再加入
<book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
<title>The Autobiography of Benjamin Franklin</title>
<author>
<first-name>Benjamin</first-name>
<last-name>Franklin</last-name>
</author>
<price>8.99</price>
</book>
怎么写啊,用什么类什么方法啊,救命啊!
...全文
91 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
helphhhh 2004-11-22
  • 打赏
  • 举报
回复
我也想知道,顶
zhaoweizhao 2004-11-22
  • 打赏
  • 举报
回复
给个网址好吗,谢谢了
形印声传 2004-11-22
  • 打赏
  • 举报
回复
使用JDOM,具体API网上有,思路:
生成新的结点(子结点)和属性。

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧