[prev in list] [next in list] [prev in thread] [next in thread]
List: jibx-users
Subject: [jibx-users] Custom marshallers for proprietary collections & child
From: Night Tripper <nighttripper330 () yahoo ! com>
Date: 2010-01-27 15:23:02
Message-ID: 300680.19568.qm () web43410 ! mail ! sp1 ! yahoo ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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
[Attachment #5 (text/html)]
<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: \
inherit;">Hi,<br><br>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.<br><br>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).<br><br>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:<br><br>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:<br><br><mapping name="person" class="jpub.Person"> \
<br> <structure name="addresses" \
set-method="setAddresses"<br> \
get-method="getAddresses" \
marshaller="raso..jibx.ext.NestedTableMapper"<br> \
unmarshaller="raso.jibx.ext.NestedTableMapper"><br> \
<br> <structure \
...><br> ...structure \
definition(s) of the collection's contents...<br> \
</structure><br> </structure> \
<br></mapping><br><br>I have to use JiBX mapping \
elements instead, e.g.:<br><br><mapping name="address" \
class="jpub.Address"><br> <value \
name="street" set-method="setStreet" get-method="getStreet" \
/><br> ...<br></mapping> <br><br>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."<br><br>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>... ).<br><br>Is there a way to \
solve this problem in JiBX?<br><br>Another alternative for me would be to look into \
extending the JiBX collection features to support JPublisher collections.<br><br>Any \
help would really be appreciated!<br><br>Pete<br></td></tr></table><br>
------------------------------------------------------------------------------
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic