ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  XML Data Binding with Castor
Subject:   How to bind all low-level elements in one top level class
Date:   2005-05-04 21:34:42
From:   vijaypriya
HI Castor Users,


<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">


<xsd:element name="employee">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="header" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" />
<xsd:element name="age" type="xsd:integer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="body" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="serviceId" type="xsd:integer" />
<xsd:element name="salary" type="xsd:integer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>


</xsd:schema>



using the source Generator , it will create employee, header, body classes and get/set methods with respect.


But i wanted only one class employee, and all the attribute elements(name ,age,serviceid,salary) should be in the employee class with get/set methods.
Is there any way to get the above .or please suggest me any other way to write the binding file for the requirement.
Please Send me a copy of your answer to this Email
thanks in advance



1 to 1 of 1
1 to 1 of 1