There are a few ways to do just this. Which is appropriate depends on
what the context, depends on what you exactly. How to do it depends
on what API, and that technology you use.

If you have a schema/dtd and even don't want to creat the java class yourself,
you may want to use some XML data binding utilities. You can check
out JAXB and Castor www.castor.com

If you are using JDom or Dom, then pick up any XML books, or simply go
to the web, you will easily find a plenty of articles talking about just that.

Regards,

Xuemin Guan

At 10:18 01/10/05 +0530, you wrote:
Hi,
I have a Document type object. What is the best way to obtain the values
from this document object? These values need to be put into a class.
e.g.

<XMLMessage>
        <Individual>
                <FirstName>abc<FirstName>
                <LastName>xyz</LastName>
        </Individual>

        <Org>
                <OrgName>abc</OrgName>
                <OrgAddress>xyz</OrgAddress>
        </Org>
</XMLMessage>

I need to put values for FirstName and LastName in a class Individual
that has attributes FirstName and LastName.
Similarly, I need to put value for OrgName and OrgAddress in a class
Organisation that has attributes OrgNameName and OrgAddress.

So far, I have been using a TreeWalker interface provided with xerces
1.4.3 . However it is proving difficult when the depth of elements
increases. Is there another API, or simply a better way of obtaining
these values?

TIA,
abhishek.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-------
Xuemin Guan
Software Engineer
Appresso SpA (www.appresso.com)
Tel: +81-3-4412-7790(Direct)
+81-3-4412-7700(Represent)
Email: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to