如何将值插入xml? [英] how to insert value into xml?
本文介绍了如何将值插入xml?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是XML和JDOM的新手,所以我有一个noob问题,对不起。我有一个XML文件,我想在其中插入值。我的XML文件是这样的;
I am really new to XML and JDOM so I have a noob question, sorry for that. I have a XML file and I want to insert value into it. My XML file is like that;
<?xml version="1.0"?>
<message>
<header>
<messageType> </messageType>
<sendFrom> </sendFrom>
<HostName> </HostName>
<sendTo> </sendTo>
<receiverName> </receiverName>
<date> </date>
</header>
<body>
</body>
</message>
所以我想要的是例如在< sendTo>之间增加价值; < / sendTo>
我还想添加< A>
数据< / A>
介于< body>之间< /体>
。你能告诉我怎么做吗?
So what I want is for example is to add value between <sendTo> </sendTo>
and also I want to add <A>
data </A>
between <body> </body>
. Can you please tell me how to do that ?
非常感谢。
推荐答案
http://www.cafeconleche.org/books/xmljava/chapters/ch14s04.html
http://www.java2s.com/Code/Java/XML/MakeupandwriteanXMLdocumentusingDOM.htm
这篇关于如何将值插入xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文