Example

The following is a sample run of the XMLBeanReader program with the XML code of Figure 5 as input. Debugging messages appear in gray, calls to setProperty() in red, and program output in blue.
$ java XMLBeanReader SampleXMLBean.xml
Created file reader
Created parser
Got document not null
eJavaBean is not null
Trying to get class attr
Got jbClassName: Player
Created JavaBean(Player): [email protected]
Got 11 child nodes of properties
Got 5 property descriptors
Hashing number: not null
Hashing stats: not null
Hashing class: not null
Hashing name: not null
Hashing highschool: not null
Done hashing
Got property Number
PD is not null
--- SetProperty Number
Value of Number is '12'
Getting setter for pd [email protected]
Setter is not null
Property type of Number is int
Getting ctor
ctor is not null
setterArg is not null
Setting Number to '12' via call to public void Player.setNumber(int)
Finished setProperty(Number)
Got property HighSchool
PD is not null
--- SetProperty HighSchool
Value of HighSchool is 'Eaton'
Getting setter for pd [email protected]
Setter is not null
Property type of HighSchool is class java.lang.String
Setter has 1 args
Finished setProperty(HighSchool)
Got property Name
PD is not null
--- SetProperty Name
Value of Name is '
  '
Getting setter for pd [email protected]
Setter is not null
Property type of Name is class PersonName
jbClassName = PersonName
loading JB
Trying to get class attr
Got jbClassName: PersonName
Created JavaBean(PersonName): [email protected]
Got 5 child nodes of properties
Got 3 property descriptors
Hashing last: not null
Hashing first: not null
Hashing class: not null
Done hashing
Got property First
PD is not null
--- SetProperty First
Value of First is 'Jonas'
Getting setter for pd [email protected]
Setter is not null
Property type of First is class java.lang.String
Setter has 1 args
Finished setProperty(First)
Got property Last
PD is not null
--- SetProperty Last
Value of Last is 'Grumby'
Getting setter for pd [email protected]
Setter is not null
Property type of Last is class java.lang.String
Setter has 1 args
Finished setProperty(Last)
Created new JavaBean of type PersonName
Setting Name to '[email protected]' via call to public void Player.setName(PersonName)
Finished setProperty(Name)
Got property Stats
PD is not null
--- SetProperty Stats
Value of Stats is '
  '
Getting setter for pd [email protected]
Setter is not null
Property type of Stats is class Statistics
jbClassName = Statistics
loading JB
Trying to get class attr
Got jbClassName: Statistics
Created JavaBean(Statistics): [email protected]
Got 13 child nodes of properties
Got 7 property descriptors
Hashing year: not null
Hashing atbats: not null
Hashing class: not null
Hashing hits: not null
Hashing homeruns: not null
Hashing runsbattedin: not null
Hashing runs: not null
Done hashing
Got property Year
PD is not null
--- SetProperty Year
Value of Year is '1997'
Getting setter for pd [email protected]
Setter is not null
Property type of Year is int
Getting ctor
ctor is not null
setterArg is not null
Setting Year to '1997' via call to public void Statistics.setYear(int)
Finished setProperty(Year)
Got property AtBats
PD is not null
--- SetProperty AtBats
Value of AtBats is '69'
Getting setter for pd [email protected]
Setter is not null
Property type of AtBats is int
Getting ctor
ctor is not null
setterArg is not null
Setting AtBats to '69' via call to public void Statistics.setAtBats(int)
Finished setProperty(AtBats)
Got property Runs
PD is not null
--- SetProperty Runs
Value of Runs is '31'
Getting setter for pd [email protected]
Setter is not null
Property type of Runs is int
Getting ctor
ctor is not null
setterArg is not null
Setting Runs to '31' via call to public void Statistics.setRuns(int)
Finished setProperty(Runs)
Got property Hits
PD is not null
--- SetProperty Hits
Value of Hits is '30'
Getting setter for pd [email protected]
Setter is not null
Property type of Hits is int
Getting ctor
ctor is not null
setterArg is not null
Setting Hits to '30' via call to public void Statistics.setHits(int)
Finished setProperty(Hits)
Got property HomeRuns
PD is not null
--- SetProperty HomeRuns
Value of HomeRuns is '2'
Getting setter for pd [email protected]
Setter is not null
Property type of HomeRuns is int
Getting ctor
ctor is not null
setterArg is not null
Setting HomeRuns to '2' via call to public void Statistics.setHomeRuns(int)
Finished setProperty(HomeRuns)
Got property RunsBattedIn
PD is not null
--- SetProperty RunsBattedIn
Value of RunsBattedIn is '15'
Getting setter for pd [email protected]
Setter is not null
Property type of RunsBattedIn is int
Getting ctor
ctor is not null
setterArg is not null
Setting RunsBattedIn to '15' via call to public void Statistics.setRunsBattedIn(int)
Finished setProperty(RunsBattedIn)
Created new JavaBean of type Statistics
Setting Stats to '[email protected]' via call to public void Player.setStats(Statistics)
Finished setProperty(Stats)
Created new JavaBean of type Player

--- Read a JavaBean of type Player

Player
-----
Name: Grumby, Jonas
High School:Eaton
Number: 12
Statistics:
Year(1997), AB(69), H(30), R(31), HR(2), RBI(15)