Map an XML document to a JavaBean. The XML document is assumed to be in a common format:
<person> <firstName>Jason</firstName> <lastName>van Zyl</lastName> <hobbies> <hobby>somnambulism</hobby> <hobby>squash</hobby> </hobbies> <address> <street>50 King</street> <city>Guelph</city> <country>Canada</country> </address> </person>
These are some of the assumptions employed to make mapping the object simpler:
- Any nested objects that are created are assumed to to be in the same package as the parent object.
-
Processing Rules:
Does Element refers to a noun plural? Yes: treewalk No: Does the Element have children? Yes: Create object and attach to parent, have to look for inclusion rules as we might need to create an object from another XML file. Is the parent Element a plural noun? Yes: We have a collection: addX(x) is executed No: We have a simple property: setProperty(x) is executed No: Is there an inclusion rule? Yes: Create object from an XML file and attach No: Simple String value to attach
This class is not thread safe.
@author Jason van Zyl
@author Daniel Rall
@version $Id: Mapper.java,v 1.17 2002/02/28 23:22:10 jvanzyl Exp $