Hi,

we need to map complex XML documents to Java classes that are generated by 
Oracle JPublisher (= Java Proxies for Oracle PL/SQL object types). JiBX seems 
to be a great tool for our use case, especially because we need to perform what 
the JiBX docs refer to as structure mappings.

Problem: The collection classes generated by JPublisher are not supported by 
JiBX (they don't derive from java.util.collection, and the JiBX's collection 
element customization features are not sufficient to handle the JPublisher 
generated collection classes).

So I wrote a custom marshaller/unmarshaller for this use case. While it is now 
generally possible to handle the JPublisher collection classes, I have a 
different problem now:

It seems that structure elements with custom un-/marshallers cannot contain any 
child structure element definitions, i.e. this does not seem to be possible:

<mapping name="person" class="jpub.Person">        
    <structure name="addresses" set-method="setAddresses"
        get-method="getAddresses" marshaller="raso.jibx.ext..NestedTableMapper"
        unmarshaller="raso.jibx.ext.NestedTableMapper">
        
        <structure ...>
            ...structure definition(s) of the collection's contents...
        </structure>
    </structure>        
</mapping>

I have to use JiBX mapping elements instead, e.g.:

<mapping name="address" class="jpub.Address">
        <value name="street" set-method="setStreet" get-method="getStreet" />
        ...
</mapping> 

But the mapping name (name of the xml element to map, "address" in the example 
above) has to be unique (regarding the scope of the mapping definition).. And 
the JiBX documentation says that mapping elements should not be nested: "JiBX 
2.0 will prohibit nesting of non-abstract mappings, so it's best to structure 
your binding definitions with all non-abstract mappings as direct children of 
the root element."

But our documents can contain xml elements with the same name (e.g. 
<leafElement>), that are mapped to different Java classes, depending on where 
they appear in the xml document. (e.g. <root><node1><leafElement>... can map to 
a different Java class than <root><node2><leafElement>... ).

Is there a way to solve this problem in JiBX?

Another alternative for me would be to look into extending the JiBX collection 
features to support JPublisher collections.

Any help would really be appreciated!

Pete



      
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to