Here is a working example. map file and domain files were automatically generated by my code.

-Henry

On 6/24/2010 1:59 PM, KURT PETERS wrote:
My xml file is essentially this:
<address>
- <#> <information>
- <#> <IPinfo>
<IPAddress>144.106.240.0</IPAddress>
<mask>24</mask>
</IPinfo>
<property propertyName="*Location*">P</property>
<property propertyName="*Owner*">E144</property>
<property propertyName="*Status*">Available</property>
</information>
</address>

Instead of an attribute that is a "property name" which is a "key" in a hashmap, it would be nice to have "property" replaced with something like this:
<address>
<#><information>
<#><IPinfo>
<IPAddress>144.106.240.0</IPAddress>
<mask>24</mask>
</IPinfo>
<*Location*>P</*Location*>
<*Owner*>E144</*Owner*>
<*Status*>Available</*Status*>
</information>
</address>


where the keys in the hashmap are Location, Owner, and Status...
I think it should be assumed in this case that keys will be java.lang.String {"Location",<object>}, etc.
The mapping entry for the top output is:
<class name="*org.mitre.mandi.model.addressing.SubnetInfo2*">
<field name="*scopedIpAddress*" type="*org.mitre.mandi.model.addressing.ScopedIpAddress*">
<bind-xml name="*IPinfo*" node="*element*" />
</field>
<field name="*tags*" collection="*map*">
<bind-xml name="*property*" node="*element*">
<class name="*org.exolab.castor.mapping.MapItem*">
<field name="*key*" type="*java.lang.String*">
<bind-xml name="*propertyName*" node="*attribute*"/>
</field>
<field name="*value*" type="*java.lang.String*">
<bind-xml name="*propertyValue*" node="*text*" />
</field>
</class>
</bind-xml>
</field>
</class>

It would be nice to have something for the "field name="key"" item to say "make it the xml parameter".
Does that clarify it at all?
Regards,
Kurt

Date: Thu, 24 Jun 2010 13:27:02 -0400
From: [email protected]
To: [email protected]
CC: [email protected]
Subject: Re: [castor-user] Using tag names as keys - redux

Kurt, send me the xml file and I may be able to come up with something you are looking for.

-Henry


On 6/24/2010 1:24 PM, Ralf Joachim wrote:

    Hi Kurt,

    to my knowledge we have not found a volunteer to work on that yet.
    As a workaround you may transform your XML to something supported
    by Castor. If you happen to find some time to work on the
    requested feature, Werner may be able to give you some hints where
    to start looking at.

    Regards
    Ralf


    KURT PETERS schrieb:

        I saw this message and answer:
        http://www.mail-archive.com/[email protected]/msg06674.html

        Has anything happened on this since 2008?  I, too, have a
        request from a customer to have the key to a hashmap be the
        "field tag name:" such as shown.

        Regards,
        Kurt

--
    Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
    Ralf Joachim
    Raiffeisenstraße 11
    72127 Kusterdingen
    Germany

    Tel.   +49 7071 3690 52
    Mobil: +49 173 9630135
    Fax    +49 7071 3690 98

    Internet:www.syscon.eu
    E-Mail:[email protected]

    Sitz der Gesellschaft: D-72127 Kusterdingen
    Registereintrag: Amtsgericht Stuttgart, HRB 382295
    Geschäftsleitung: Jens Joachim, Ralf Joachim

Reply via email to