How can I create the below XML
using Java DOM
, I want to create it from scratch. Is there any way?
I don't want to read it and clone it, I just want to create it by DOM
methods.
Java
Example:
Node booking=new Node();
Node bookingID=new Node();
booking.add(bookingID);
XML
Example:
<tns:booking>
<tns:bookingID>115</tns:bookingID>
<tns:type>double</tns:type>
<tns:amount>1</tns:amount>
<tns:stayPeriod>
<tns:checkin>
<tns:year>2013</tns:year>
<tns:month>11</tns:month>
<tns:date>14</tns:date>
</tns:checkin>
<tns:checkout>
<tns:year>2013</tns:year>
<tns:month>11</tns:month>
<tns:date>16</tns:date>
</tns:checkout>
</tns:stayPeriod>
</tns:booking>