Reputation: 115
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?
Upvotes: 0
Views: 676
Reputation: 121869
You absolutely want to familiarize yourself with javax.xml.
Here are some good tutorials:
Upvotes: 1