1. first define javaBeanpackage com. wutka. jox. test; import com. wutka. jox. *; import java. util. *; public class TestBean implements java. io. serializable {protected int foo; protected String bar; protected java. util. date baz; protected Vector thingies; protected TestSubbean subbean; public TestBean () {bar = ""; baz = new Date (); thingies = new Vector ();} public int getFoo () {return foo;} public void setFo O (int aFoo) {foo = aFoo;} public String getBar () {return bar;} public void setBar (String aBar) {bar = aBar;} public java. util. date getBaz () {return baz;} public void setBaz (java. util. date aBaz) {baz = aBaz;} public TestSubbean getSub () {return subbean;} public void setSub (TestSubbean aSub) {subbean = aSub;} public String [] getThingies () {String [] retThingies = new String [thingies. s Ize ()]; if (thingies. size ()> 0) thingies. copyInto (retThingies); return retThingies;} public void setThingies (String [] newThingies) {thingies = new Vector (newThingies. length); for (int I = 0; I <newThingies. length; I ++) {thingies. addElement (newThingies [I]);} public String getThingies (int I) {return (String) thingies. elementAt (I);} public void setThingies (int I, String thingy) {thi Ngies. setElementAt (thingy, I);} public String toString () {StringBuffer ret = new StringBuffer ("foo =" + foo + "; bar =" + bar + "; baz = "+ baz. toString () + "; thingies ="); for (int I = 0; I <thingies. size (); I ++) {if (I> 0) ret. append (","); ret. append (String) thingies. elementAt (I);} ret. append ("; sub ="); ret. append (subbean. toString (); return ret. toString () ;}} 2. xml file <? Xml version = "1.0"?> <MarkTest> <thingies> Network </thingies> <thingies>: </thingies> <thingies> /thingies> <foo> 5 </foo> <baz> 6/25/00 AM </baz> <bar> This is the website value </bar> <sub> <age> 1 </age> <name> wangdei </name> </sub> </MarkTest> The following program converts xml into javanpackage com. wutka. jox. test; import com. wutka. jox. *; import java. io. *; public class TestDeser {public static void main (String [] args) {try {FileInputStream in = new FileInputStream ("bean. xml "); JOXBeanInputStream joxIn = new JOXBeanInputStream (in); TestBean testBean = (TestBean) joxIn. readObject (TestBean. class); System. out. println (testBean);} catch (Exception exc) {exc. the program in printStackTrace () ;}} is to convert javaBean into xmlpackage com. wutka. jox. test; import com. wutka. jox. *; import java. io. *; public class TestSer {public static void main (String [] args) {try {TestBean B = new TestBean (); B. setFoo (5); B. setBar ("This is the bar value"); B. setThingies (new String [] {"", ""}); TestSubbean sub = new TestSubbean (); sub. setName ("Mark"); sub. setAge (35); B. setSub (sub); FileOutputStream fileOut = new FileOutputStream ("bean. xml "); JOXBeanOutputStream joxOut = new JOXBeanOutputStream (fileOut); joxOut. writeObject ("MarkTest", B); joxOut. close ();}}}