There are
many ways to get data from XML documents in to your program. One of
them is to use Java beans to get the XML documents.
_______________________________________________
To
do this there is a library called JOX. You can use this JOX to pass
data from an XML document to a Java Bean. With this you can match the
elements of the XML document to that of the fields in the bean.
From a
bean you can also create an XML document and this can also use the DTD
if any to be attached to the XML document. To use JOX, first you have
to create either a FileReader or a FileInputStream object that can read
the XML file.
After this
step you can make JOX read that object and map it to the class.Another
way to map the XML elements of an XML documents to that of a java bean
is to use the Koala Bean Markup Language.
To use
this method to map the XML document to a java bean the XML document
should follow the standards / format set by the Koala Markup Language.
If this approach of mapping XML to Java bean works for you, you can
go with it.