Hello all,
at the moment I am stuck with following problem:
The XML structure
<foo:identifier type="ABC">
<dc:identifier xml:lang="en-us">text1</dc:identifier>
</foo:identifier>
<foo:identifier type="GHI">
<dc:identifier xml:lang="en-us">text2</dc:identifier>
</foo:identifier>
[...]
shall get unmarshalled to a list of value objects, each of which containing two
properties:
- one property named "type" of type enum (with possible values e.g. ABC, DEF,
GHI)
which has to be mapped to the "type" attribute of "foo:identifier"
- one property named "id" of type String
which has to be mapped to the text content of "dc:identifier"
One of my binding tries:
<collection field="identifiers" factory="com.binding.JiBXHelper.VOListFactory">
<structure name="identifier" ns="http://foobar.com/foo"
type="com.binding.VO">
<value style="attribute" name="type" field="type"
deserializer="com.binding.VO$IdType.valueOf" />
<structure name="identifier" ns="http://purl.org/dc/elements/1.1/">
<!-- ignore xml:lang attribute -->
<value style="text" field="id" />
</structure>
</structure>
</collection>
where "identifiers" is the name of a property of type "List<com.binding.VO>" of
the enclosing value object,
results in the error message at binding time:
Error: No compatible mapping defined for type com.binding.VO
Another try, using an abstract mapping for the class "com.binding.VO":
<binding>
<namespace prefix="foo" uri="http://foobar.com/foo" />
<namespace prefix="dc" uri="http://purl.org/dc/elements/1.1/" />
[...]
<collection name="identifier" ns="http://foobar.com/foo" field="identifiers"
item-type="com.binding.VO"
factory="com.binding.JiBXHelper.VOListFactory" usage="optional" />
[...]
<mapping class="com.binding.VO" abstract="true">
<value style="attribute" name="type" field="type"
deserializer="com.binding.VO$IdType.valueOf" />
<structure name="identifier" ns="http://purl.org/dc/elements/1.1/">
<!-- ignore xml:lang attribute -->
<value style="text" field="id" />
</structure>
</mapping>
Compiling and binding works fine. However, at runtime, I get the following
error message:
org.jibx.runtime.JiBXException: No unmarshaller for element
"{http://purl.org/dc/elements/1.1/}identifier"
What are the reasons for these failures? How can I get this to work properly?
Any help would be appreciated.
Eckhardt Schulz
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users