Paul,

Thanks for the reply... I'm not very handy with XML (which is why I'm
trying to use xbeans :-)) so I'm not exactly sure if I can do what you
are recommending given my system constraints.  We have product that we
can't really modify that produces XML.  I want to bind to that xml with
xbeans.

I wrote the xsd, here's a piece of it:

<!-- begin share type definitions -->
<xs:complexType name="savingShareType">
        <xs:sequence>
        <xs:element name="suffix" type="xs:token" />
        <xs:element name="description" type="xs:token" />
        <xs:element name="beginningBalance" type="xs:decimal" />
        <xs:element name="endingBalance" type="xs:decimal" />
        <xs:element name="apyEarned" type="xs:float" minOccurs="0" />
        <xs:element name="overdraftFees" type="xs:decimal" minOccurs="0"
/>
        <xs:element name="returnedFees" type="xs:decimal" minOccurs="0"
/>
        <xs:element name="shareTransaction"
type="stmt:shareTransactionType"
                minOccurs="0" maxOccurs="unbounded" />
        <xs:element name="ytdDividends" type="xs:decimal" />
        </xs:sequence>
</xs:complexType>

<xs:complexType name="draftShareType">
        <xs:sequence>
        <xs:element name="suffix" type="xs:token" />
        <xs:element name="description" type="xs:token" />
        <xs:element name="beginningBalance" type="xs:decimal" />
        <xs:element name="endingBalance" type="xs:decimal" />
        <xs:element name="apyEarned" type="xs:float" minOccurs="0" />
        <xs:element name="overdraftFees" type="xs:decimal" minOccurs="0"
/>
        <xs:element name="returnedFees" type="xs:decimal" minOccurs="0"
/>
        <xs:element name="serviceCharges" type="xs:decimal"
minOccurs="0" />
        <xs:element name="numChecksPaid" type="xs:nonNegativeInteger"
minOccurs="0" />
        <xs:element name="shareTransaction"
type="stmt:shareTransactionType"
                minOccurs="0" maxOccurs="unbounded" />
        <xs:element name="ytdDividends" type="xs:decimal" />
        </xs:sequence>
</xs:complexType>

<xs:complexType name="certificateShareType">
        <xs:sequence>
        <xs:element name="suffix" type="xs:token" />
        <xs:element name="description" type="xs:token" />
        <xs:element name="beginningBalance" type="xs:decimal" />
        <xs:element name="endingBalance" type="xs:decimal" />
        <xs:element name="apyEarned" type="xs:float" minOccurs="0" />
        <xs:element name="issueDate" type="xs:date" minOccurs="0" />
        <xs:element name="maturityDate" type="xs:date" minOccurs="0" />
        <xs:element name="certRate" type="xs:float" minOccurs="0" />
        <xs:element name="shareTransaction"
type="stmt:shareTransactionType"
                minOccurs="0" maxOccurs="unbounded" />
        <xs:element name="ytdDividends" type="xs:decimal" />
        </xs:sequence>
</xs:complexType>

Notice they all begin and end with the same fields, and it's the content
in the middle that changes.  I can't modify the program that produces
the XML so I can't "move" the transactions and dividends elements.

In my java code, I want to get a SavingShare, DraftShare and
CertificateShare...all of which extend Share.

How can I have all three types extend a base type that holds the common
content while still allowing for the unbounded transaction type?

My other option is to run the xml through something that reorganizes the
content before using xbeans...which seems silly.

Jason



-----Original Message-----
From: Gillen, Paul [mailto:[email protected]] 
Sent: Friday, September 18, 2009 11:36 AM
To: '[email protected]'
Subject: RE: implementing a custom interface

If I understand you correctly, in your XSD create a base type with the
common attributes.  Create types for each of your 3 derived from the
base type.  In your code you can refer to each as basetype and for
specifics test with instanceof.

Paul Gillen
 
-----Original Message-----
From: Jason Berk [mailto:[email protected]] 
Sent: Friday, September 18, 2009 11:19 AM
To: [email protected]
Subject: implementing a custom interface

I have three types in my XSD: Savings, Checking, Certificate.

Is it possible to add something (to the .xsdconfig?) that makes all
three types implement an interface I created?

I want my beans to be like this:

Product
        getStaringBal()
        getEndingBal()

Savings implements Product
        getSavingsSpecificStuff()

Checking implements Product
        getCheckingSpecificStuff()

make sense?

Jason
Now serving Boiler Spirit with every purchase. Switch to the new Purdue
debit card today. Show your pride and earn Scorecard Rewards on the
side. Just sign for your purchases and score valuable rewards points you
can use for travel, electronics or even cash. 



***This is a transmission from Purdue Employees Federal Credit
Union (PEFCU) and is intended solely for its authorized
recipient(s), and may contain information that is confidential
and or legally privileged.  If you are not an addressee, or the
employee or agent responsible for delivering it to an addressee,
you are hereby notified that any use, dissemination,
distribution, publication or copying of the information 
contained
in this email is strictly prohibited. If you have received this
transmission in error, please notify us by telephoning (765)
497-3328 or returning the email. You are then instructed to
delete the information from your computer.  Thank you for your
cooperation.***



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Now serving Boiler Spirit with every purchase. Switch to the new Purdue debit 
card today. Show your pride and earn Scorecard Rewards on the side. Just sign 
for your purchases and score valuable rewards points you can use for travel, 
electronics or even cash. 



***This is a transmission from Purdue Employees Federal Credit
Union (PEFCU) and is intended solely for its authorized
recipient(s), and may contain information that is confidential
and or legally privileged.  If you are not an addressee, or the
employee or agent responsible for delivering it to an addressee,
you are hereby notified that any use, dissemination,
distribution, publication or copying of the information 
contained
in this email is strictly prohibited. If you have received this
transmission in error, please notify us by telephoning (765)
497-3328 or returning the email. You are then instructed to
delete the information from your computer.  Thank you for your
cooperation.***


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to