Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAXB - getting java class for an xml-tag

 
Simran Brar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:complexType>
<xsd:sequence>
<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"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

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

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
Thanks
Simran
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic