Thanks Werner. What I'm actually looking for is the following.
When someone sends me XML that has any (or all) of the sub exception types (such as RatingException, HubException), I want to be able to marshall the XML and be able to loop through all of the exceptions which are inherited from GenericException) in one shot. Right now, I have to loop through RatingExceptionCount, then HubExceptionCount etc. If I add a new exception type to the XSD which inherits from GenericException, I would currently need to amend the above looping code each time to account for the new exception type. Is this possible to do? Thanks, George -----Original Message----- From: Werner Guttmann [mailto:[EMAIL PROTECTED] Sent: Friday, April 11, 2008 3:51 AM To: [email protected] Subject: Re: [castor-user] RE: Castor 1.1 XSD Inheritance Well, you do not really have to alter your XSD, as you already have an element definition 'genericExceptions' that can hold a number of GenericException instances, that is GenericExceptions and children thereof (polymorphism at work). When you generate code from this, the signature of he Java property generated ('genericExcetions') will accept a Java collection of GenericExceptions. But as always with inheritence, the actual object instances stored in this collection can be of GenericException of any sub-type thereof. I hope this helps. Werner Louis, George (Liquidity & Risk Technology) wrote: > True. Maybe this is more of an XSD question. > > How can I alter my XSD so that UMAExceptionsType can accept any > Exception that extends "GenericException"? > > Thank again! > George > > > -----Original Message----- > From: Werner Guttmann [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 10, 2008 6:01 AM > To: [email protected] > Subject: Re: [castor-user] RE: Castor 1.1 XSD Inheritance > > How would that be possible ? In the complex type definition of > UMAExceptionsType, you are defining a sequence of elements where each is > > strongly typed. > > <complexType name="UMAExceptionsType" mixed="false"> > <sequence> > <element name="GenericException" > type="tns:GenericExceptionType" minOccurs="0" > maxOccurs="unbounded"> > </element> > <element name="RatingException" > type="tns:RatingExceptionType" minOccurs="0" > maxOccurs="unbounded"> > </element> > ... > </sequence> > ... > </complexType> > > So there's a <RatingException> element that is a collection of elements > of type 'RatingExceptionType'. As such (i.e. as per your definition), > the corresponding member in the UMAExceptionsType class will carry a > type of 'RatingExceptionType'. > > Werner > > Louis, George (Liquidity & Risk Technology) wrote: >> Werner, >> >> I was hoping that in the generated UMAExceptionsClass, that I would be >> able to get all Exceptions (of any type) through one method calls > which >> returns an options of the parent type "GenericException". Eg: ue. >> Ue.getAllGenericExceptionsCount(). >> >> Right now I have to do the following: >> >> for (int i=0; i<ue.getFeedExceptionCount();i++) >> for (int i=0; i<ue.getGenericExceptionCount();i++) >> for (int i=0; i<ue.getRatingExceptionCount();i++) >> for (int i=0; i<ue.getMarginHubExceptionCount();i++) >> >> As we add new exception types (which are inherited in the XSD from >> GenericException), I'd prefer my java code not have to change. >> >> Thanks, >> George >> >> >> -----Original Message----- >> From: Werner Guttmann [mailto:[EMAIL PROTECTED] >> Sent: Saturday, April 05, 2008 2:36 PM >> To: [email protected] >> Subject: Re: [castor-user] RE: Castor 1.1 XSD Inheritance >> >> Okoay, I have used the source generator to have the corresponding >> classes generated. What is the abnormality again I should be able to >> observe, based upon the XML schema you have sent ? >> >> Werner >> >> Louis, George (Liquidity & Risk Technology) wrote: >>> Wener, >>> >>> Here's the xsd. I used trade types as an example. It's really >>> exceptions inherited from genericexceptions. >>> >>> Thanks, >>> George >>> >>> >>> >>> <?xml version="1.0" encoding="UTF-8"?> >>> <schema xmlns="http://www.w3.org/2001/XMLSchema" >>> targetNamespace="http://www.example.org/NewXMLSchema" >>> xmlns:tns="http://www.example.org/NewXMLSchema" >>> elementFormDefault="qualified"> >>> >>> >>> <complexType name="GenericExceptionType" mixed="false"> >>> <sequence> >>> <element name="GUID" type="string" >> minOccurs="0" >>> maxOccurs="1"> >>> <annotation> >>> <documentation> >>> Global Unique ID >>> assigned by API during >>> exception creation >>> </documentation> >>> </annotation> >>> </element> >>> <element name="ClientSystem" type="string" >>> minOccurs="1" >>> maxOccurs="1"> >>> <annotation> >>> <documentation> >>> Client System who is >>> logging exception >>> </documentation> >>> </annotation> >>> </element> >>> <element name="ClientProcess" type="string" >>> minOccurs="0" >>> maxOccurs="1"> >>> <annotation> >>> <documentation> >>> The Client can >> identify >>> a particular "process" >>> for which they are >>> logging exceptions,eg. >>> "VMasterFeed". > Through >>> the API which clears >>> exceptions, the > Client >>> has the ability to >>> specify this value to > >>> delete all exceptions for >>> this value >>> </documentation> >>> </annotation> >>> </element> >>> >>> >>> <element name="Severity" >> type="tns:SeverityType" >>> minOccurs="1" maxOccurs="1"> >>> <annotation> >>> <documentation> >>> Enumerated Severity > of >>> trade (Warning or Error) >>> </documentation> >>> </annotation> >>> </element> >>> >>> <element name="MarginGroup" type="string" >>> minOccurs="0" >>> maxOccurs="1"> >>> <annotation> >>> <documentation> >>> May contain >> margingroup >>> or CoperID >>> </documentation> >>> </annotation> >>> </element> >>> >>> >>> <element name="COBDate" minOccurs="0" >> maxOccurs="1" >>> type="tns:DateType"> >>> >>> <annotation> >>> <documentation> >>> Close of business > date >>> for data causing >>> exception in format >>> YYYYMMDD >>> </documentation> >>> </annotation> >>> </element> >>> <element name="Descr" type="string" >> minOccurs="0" >>> maxOccurs="1"> >>> </element> >>> >>> <element name="GenericFields" >>> type="tns:GenericFieldType" >>> minOccurs="0" maxOccurs="unbounded"> >>> <annotation> >>> <documentation> >>> Generic Key/Value >> pairs >>> used for flexibility for >>> future releases >>> </documentation> >>> </annotation> >>> </element> >>> >>> </sequence> >>> <attribute name="Status" type="string" use="optional" > >>> default="NEW"> >>> <annotation> >>> <documentation> >>> Field "Status" is for > internal >>> use only. No need to >>> set. >>> </documentation> >>> </annotation></attribute> >>> </complexType> >>> >>> <simpleType name="SeverityType"> >>> <restriction base="string"> >>> <enumeration value="Error"></enumeration> >>> <enumeration value="Warning"></enumeration> >>> <enumeration value="Fatal"></enumeration> >>> </restriction> >>> </simpleType> >>> >>> >>> >>> >>> <complexType name="RatingExceptionType" block="extension"> >>> <annotation> >>> <documentation> >>> Exception to handle missing ratings >>> </documentation> >>> </annotation> >>> <complexContent> >>> <extension base="tns:GenericExceptionType"> >>> <sequence> >>> <element name="MLSecNumber" type="string" >>> minOccurs="0" maxOccurs="1"> >>> </element> >>> <element name="Cusip" type="string" >> minOccurs="0" >>> maxOccurs="1"> >>> </element> >>> <element name="ISIN" type="string" >> minOccurs="0" >>> maxOccurs="1"> >>> </element> >>> >>> <element name="Ticker" type="string" >> minOccurs="0" >>> maxOccurs="1"> >>> </element> >>> <element name="SecurityDescr" type="string" >>> minOccurs="0" maxOccurs="1"> >>> </element> >>> >>> </sequence> >>> </extension> >>> </complexContent> >>> </complexType> >>> >>> >>> <complexType name="GenericFieldType"> >>> <annotation> >>> <documentation> >>> Key/Value pairs. Intended for future > expansion >>> </documentation> >>> </annotation> >>> <sequence> >>> <element name="Value" type="string"></element> >>> </sequence> >>> <attribute name="Key" type="string"></attribute> >>> </complexType> >>> >>> <complexType name="UMAExceptionsType" mixed="false"> >>> <sequence> >>> <element name="GenericException" >>> type="tns:GenericExceptionType" minOccurs="0" >>> maxOccurs="unbounded"> >>> </element> >>> <element name="RatingException" >>> type="tns:RatingExceptionType" minOccurs="0" >>> maxOccurs="unbounded"> >>> </element> >>> <element name="MarginHubException" >>> type="tns:MarginHubExceptionType" >> minOccurs="0" >>> maxOccurs="unbounded"> >>> </element> >>> <element name="FeedException" >> type="tns:FeedExceptionType" >>> minOccurs="0" maxOccurs="unbounded"> >>> </element> >>> >>> </sequence> >>> <attribute name="APIVersion" type="string" use="optional"> >>> <annotation> >>> <documentation> >>> This value is automatically populated >> by >>> the API to >>> identify to the server what version > of >>> the client >>> API is running >>> </documentation> >>> </annotation> >>> </attribute> >>> <attribute name="MessageGUID" type="string"></attribute> >>> </complexType> >>> >>> <complexType name="FeedExceptionType"> >>> <complexContent> >>> <extension base="tns:GenericExceptionType"> >>> <sequence> >>> <element name="FeedSystem" >> type="string" >>> minOccurs="1" maxOccurs="1"></element> >>> <element name="FeedRowException" >>> type="tns:FeedRowExceptionType" minOccurs="1" maxOccurs="unbounded"> >>> >>> <annotation> >>> <documentation> >>> Data value >>> exceptions for feed >>> </documentation> >>> </annotation> >>> </element> >>> </sequence> >>> </extension> >>> </complexContent> >>> </complexType> >>> >>> >>> <simpleType name="DateType"> >>> <restriction base="string"> >>> <length value="8"></length> >>> </restriction> >>> </simpleType> >>> >>> <complexType name="FeedDataExceptionType"> >>> <sequence> >>> <element name="Column" type="string" minOccurs="1" >>> maxOccurs="1"> >>> <annotation> >>> <documentation> >>> Column with data issue >>> </documentation> >>> </annotation> >>> </element> >>> <element name="ColumnValue" type="string" >> minOccurs="0" >>> maxOccurs="1"> >>> <annotation> >>> <documentation> >>> Value of Column having data >> issue >>> </documentation> >>> </annotation> >>> </element> >>> <element name="DataExceptionDescr" type="string" >>> minOccurs="0" maxOccurs="1"> >>> </element> >>> <element name="ErrorKey" type="string" minOccurs="1" >>> maxOccurs="1"> >>> <annotation> >>> <documentation> >>> Key used to group column data > >>> errors (ie, >>> "CURRENCYMISSING", >> "PRICEMISSING" >>> </documentation> >>> </annotation></element> >>> </sequence> >>> </complexType> >>> >>> <complexType name="ColumnType" mixed="true"> >>> <sequence> >>> >>> </sequence> >>> <attribute name="ColumnName" type="string" >>> use="required"></attribute> >>> <attribute name="OrderBy" type="int"></attribute> >>> </complexType> >>> >>> >>> <complexType name="FeedRowExceptionType"> >>> <sequence> >>> <element name="RowID" type="string" minOccurs="1" >>> maxOccurs="1"> >>> <annotation> >>> <documentation> >>> Row identifier provide by >> client >>> system >>> </documentation> >>> </annotation> >>> </element> >>> <element name="TradeID" type="string" minOccurs="0" >>> maxOccurs="1"> >>> </element> >>> <element name="ProductType" type="string"></element> >>> <element name="FeedRowExceptionGUID" >> type="string"></element> >>> <element name="FeedDataException" >>> type="tns:FeedDataExceptionType" > minOccurs="1" >>> maxOccurs="unbounded"> >>> </element> >>> <element name="FeedRowData" > type="tns:FeedRowDataType" >>> maxOccurs="unbounded" minOccurs="0"> >>> </element> >>> >>> </sequence> >>> </complexType> >>> >>> <complexType name="MarginHubExceptionType"> >>> <annotation> >>> <documentation> >>> The name given by the user to the strategy >> (not the >>> strategy type) >>> </documentation> >>> </annotation> >>> <complexContent> >>> <extension base="tns:GenericExceptionType"> >>> <sequence> >>> <element name="CalculatorName" >>> type="string" minOccurs="0" maxOccurs="1"> >>> </element> >>> >>> <element name="StrategyName" >>> type="string" minOccurs="0" maxOccurs="1"> >>> </element> >>> <element name="MarginHubExceptionKey" > >>> type="string" minOccurs="0" maxOccurs="1"> >>> <annotation> >>> <documentation> >>> Key to group >>> like exceptions together >>> for front end > >>> (IE, "Currency MXN not >>> support") >>> </documentation> >>> </annotation></element> >>> <element name="MarginHubExceptionDescr" >>> type="string" minOccurs="0" maxOccurs="1"> >>> </element> >>> </sequence> >>> </extension> >>> </complexContent> >>> </complexType> >>> >>> >>> <element name="UMAExceptions" >> type="tns:UMAExceptionsType"></element> >>> <complexType name="FeedRowDataType"> >>> <sequence> >>> <element name="Column" type="tns:ColumnType" >>> maxOccurs="unbounded" minOccurs="0"></element> >>> </sequence> >>> >>> </complexType> >>> >>> >>> >>> </schema> >>> >>> _____________________________________________ >>> *From: * Louis, George (Liquidity & Risk Technology) >>> *Sent: * Wednesday, April 02, 2008 3:33 PM >>> *To: * '[email protected]' >>> *Subject: * Castor 1.1 XSD Inheritance >>> >>> Hello, >>> >>> I have an XSD which defines a generic "Trade" (with some common >>> elements) >>> In that XSD, I subclass TradeType into "Bond" and "Equity" > (with >>> trade specific elements, inherited by "extension") >>> >>> When I build the java Castor objects, I get the following >> methods: >>> getBond(index) >>> getBondCount >>> GetEquity(index) >>> getEquity(Count) >>> >>> What I really want is a "getTrade(index)" and "getTradeCount()" >>> which give me everything for both Equity and Bond (and which I >> can >>> cast into Equity and Bond later) >>> >>> As I add new subclassed trade types (ie, "Swap"), I'd like it > so >>> my code doesn't have to change (everything is initially > referred >>> to as "Trade"). Right now I have to loop through getBond and >>> getEquity. >>> >>> Any idea how to do this? >>> >>> TIA -George >>> >>> >>> > ------------------------------------------------------------------------ >>> This message w/attachments (message) may be privileged, confidential >> or >>> proprietary, and if you are not an intended recipient, please notify >> the >>> sender, do not use or share it and delete it. Unless specifically >>> indicated, this message is not an offer to sell or a solicitation of >> any >>> investment products or other financial product or service, an > official >>> confirmation of any transaction, or an official statement of Merrill >>> Lynch. Subject to applicable law, Merrill Lynch may monitor, review >> and >>> retain e-communications (EC) traveling through its networks/systems. >> The >>> laws of the country of each sender/recipient may impact the handling >> of >>> EC, and EC may be archived, supervised and produced in countries > other >>> than the country in which you are located. This message cannot be >>> guaranteed to be secure or error-free. This message is subject to >> terms >>> available at the following link: >>> http://www.ml.com/e-communications_terms/. By messaging with Merrill >>> Lynch you consent to the foregoing. >>> > ------------------------------------------------------------------------ >>> >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> -------------------------------------------------------- >> >> This message w/attachments (message) may be privileged, confidential > or proprietary, and if you are not an intended recipient, please notify > the sender, do not use or share it and delete it. Unless specifically > indicated, this message is not an offer to sell or a solicitation of any > investment products or other financial product or service, an official > confirmation of any transaction, or an official statement of Merrill > Lynch. Subject to applicable law, Merrill Lynch may monitor, review and > retain e-communications (EC) traveling through its networks/systems. The > laws of the country of each sender/recipient may impact the handling of > EC, and EC may be archived, supervised and produced in countries other > than the country in which you are located. This message cannot be > guaranteed to be secure or error-free. This message is subject to terms > available at the following link: > http://www.ml.com/e-communications_terms/. By messaging with Merrill > Lynch you consent to the foregoing. > >> -------------------------------------------------------- >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >> > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email -------------------------------------------------------- This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. -------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

