I have this XML file:
(Actually, right now it is a StringBuffer, i don't want to save it to a file, i want to use it from the memory directly)
StringBuffer book =
<book>
<title>test</title>
<bookinfo>
<page>100</page>
</bookinfo>
</book>
In here, i want to add a element and a value like this:
<book>
<title>test</title>
<bookinfo>
<page>100</page>
<price>100</price>
</bookinfo>
</book>
what is the fast and easiest way to add an element and value in XML?
You absolutely want to familiarize yourself with javax.xml.
Here are some good tutorials:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.