File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes JAXB - getting java class for an xml-tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAXB - getting java class for an xml-tag" Watch "JAXB - getting java class for an xml-tag" New topic

JAXB - getting java class for an xml-tag

Simran Brar

Joined: Jun 01, 2004
Posts: 3
Hi All,

I just started using JAXB in a new project. I have successfully created the schema objects using the xsd and compiled etc etc.

One gating item is - I am not sure on how to get the name of corresponding java class depending on the xml-tag? For e.g. I have this defined in the xsd:

<xsd:element name="assembly-lot">
<xsd:element ref="lot" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="lot-attr" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="product" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="operation" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="route" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="lot-hist" minOccurs="1" maxOccurs="unbounded"/>

Now the user can configure some update logic (in a customized flat file)like if value of assembly-lot/product = 'XYZ' then change

After unmarshalling and parsing this customized rule, how can I know that for assembly-lot, the name of the class that I need to work with is AssemblyLot? Is there a way to get the java class instance depending on QName?

- Any help would be much appreciated
I agree. Here's the link:
subject: JAXB - getting java class for an xml-tag
It's not a secret anymore!