Hi,
I'm having some problem unmarshalling an XML into different java objects
What I wanna do:
----------------
I want to unmarshal an XML message into different objects based on an
element (the element under bar in the XML examples below) so when the
underlaying element is "a" then it should unmarshal this XML into
ObjectA otherwise into ObjectB the bar element I don't need so I've use
the location attribute to accomplish this
my mapping is something like:
-----------------------------
<class name="ObjectA"
<field foo
<field data
<bind-xml name="a" node="element" location="bar"
<class name="ObjectB"
<field foo
<field data
<bind-xml name="b" node="element" location="bar"
XML1:
-----
<foo>
...
</foo>
<bar>
<a>
</a>
</bar>
XML2:
-----
<foo>
...
</foo>
<bar>
<b>
</b>
</bar>
what works:
-----------
java2XML works perfectly
what doesn't work:
------------------
XML2java: if you unmarshal XML1 first then it works for messages like
XML1 but not for messages like XML2 if you unmarshal XML2 first then
only messages like XML2 are unmarshalled
error received: unable to find FieldDescriptor for 'b' in
ClassDescriptor of bar
Ideally I'd just like to make it as if the bar element didn't exist for
unmarshalling: But that is not an option as I can't change the XML
schema
XML ideally:
------------
<foo>
...
</foo>
<b>
</b>
Tnx!,
grtz
Han
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user