Werner Guttmann wrote:
> 
> HI,
> 
> not by the means of XML. But how about working with a base class at the
> OO Level, and indicate that to the Castor mapping file ?
> 
> Regards
> Werner
> 

thanks for your reply Werner, well I have tried something like that but it
seems not to work. Here's what I would lile to do: Supposing I have a
superclass Pet extended by two class Dog and Cat.

    <class name="Pet">
        <field name="petname" type="java.lang.String">
                <bind-xml name="pet-name" node="attribute" />
        </field>    
              ......
    </class>

    <class name="Dog">
        <map-to xml="pet-dog" />
    </class>

    <class name="Cat">
        <map-to xml="pet-cat" />
    </class>

Now if I istantiate:

Dog dog = new Dog();
dog.setPetName("tom"); // This method is in class Pet and inherithed by Dog
marshaller.marshal(dog);

I get
< pet-dog />

But I would like to get:
< pet-dog pet-name="tom" />

In other words it seems that Castor doesn't inherit the attributes of
superclasses when building xml.
I'm in a nice mess :-)
Regards
Francesco

fmarchioni wrote:
> Hello !
> I have a list of XML commands that I have coded with castor. Since the
> fields of the commands are always the same I'd like to put them in a
> template or file and include them in every command, is it possible to do
> it
> ?
> Here's what it looks like:
>       <class name="it.pride.iptv.netcentrex.BaseCommandCreate">
>               <map-to xml="ccsmp-create" />
> 
>               <field name="sessionId" type="java.lang.String">
>                       <bind-xml name="session" node="attribute" />
>               </field>
> 
>               <field name="enterprises" 
> type="it.pride.iptv.netcentrex.Enterprise"
>                       collection="arraylist">
>                       <bind-xml name="enterprise" />
>               </field>
>                        .....
>              </class>   
>       <class name="it.pride.iptv.netcentrex.BaseCommandDelete">
>               <map-to xml="ccsmp-delete" />
> 
>               <field name="sessionId" type="java.lang.String">
>                       <bind-xml name="session" node="attribute" />
>               </field>
> 
>               <field name="enterprises" 
> type="it.pride.iptv.netcentrex.Enterprise"
>                       collection="arraylist">
>                       <bind-xml name="enterprise" />
>               </field>
>                        .....
>              </class>   
>       <class name="it.pride.iptv.netcentrex.BaseCommandUpdate">
>               <map-to xml="ccsmp-update" />
> 
>               <field name="sessionId" type="java.lang.String">
>                       <bind-xml name="session" node="attribute" />
>               </field>
> 
>               <field name="enterprises" 
> type="it.pride.iptv.netcentrex.Enterprise"
>                       collection="arraylist">
>                       <bind-xml name="enterprise" />
>               </field>
>                        .....
>              </class>   
> 
> Can I avoid to repeat n times the fields list, for every new command ?
> thanks a lot
> francesco

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-include-an-XML-file-in-the-configuration---tp20030513p20032860.html
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to