How do I convert an XML persistence to Java Bean?
Category: java.beans, viewed: 3225 time(s).
In the previous example you can see how to convert a bean into an XML persistence. Now we'll do the opposite, converting the XML back to a bean. For the BeanToXML class use in this example please refer to How do I convert a bean to XML persistence? example.
Here is our Bean.xml persistence file:
<?xml version="1.0" encoding="UTF-8"?> <java version="1.6.0_02" class="java.beans.XMLDecoder"> <object class="org.kodejava.example.bean.BeanToXML"> <void property="id"> <long>1</long> </void> <void property="itemColour"> <string>Dark Red</string> </void> <void property="itemName"> <string>T-Shirt</string> </void> <void property="itemQuantities"> <int>100</int> </void> </object> </java>
The result are:
ID = 1 Item Name = T-Shirt Item Colour = Dark Red Item Quantities = 100
Download Hundreds of Complimentary Industry Resources
Get hundreds of popular Industry magazines, white papers, webinars, podcasts, and more;
all available at no cost to you. With more than 600 complimentary offers, you'll find
plenty of titles to suit your professional interests and needs.
Click Here and Sign up today!
Related Examples
|
|


