Hi James,
You can use a simple deserializer for this (either on the <value>
element, or define a <format> if you're going to be reusing the type).
The deserializer just needs to be a static method that takes the value
and returns the instance object; most enumeration patterns include this
method as part of the class. Most enumeration patterns also have the
instance object return the value as the toString() result, and as long
as that's the case you don't even need to specify a serializer.
- Dennis
Dennis M. Sosnoski
SOA, Web Services, and XML
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-296-6194 - Wellington, NZ +64-4-298-6117
James Abley wrote:
Hi,
I have a schema that contains something like this:
<xs:element name="proxy-parameter">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string">
<xs:annotation>
<xs:documentation>The name of this
parameter</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="type" type="ParameterType">
<xs:annotation>
<xs:documentation>The type of this
parameter</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="ParameterType">
<xs:restriction base="xs:string">
<xs:enumeration value="request-parameter"/>
<xs:enumeration value="request-header"/>
<xs:enumeration value="cookie"/>
</xs:restriction>
I need to marshal and unmarshal the xml and objects. I wanted to have
an enumerated object as per Effective Java's description. I've
searched the mailing list archives and tutorial, but haven't been able
to find anything that talks about enumerated type support.
What are the suggested ways of going about this? I think I need a
custom marshaller, but wanted to confirm that I'm on the right lines.
Cheers,
James
-------------------------------------------------------
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_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users
-------------------------------------------------------
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