Re: [Simple-support] using mapping files with Simple XML
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2011-02-18 07:51:26
|
Hi,
There are some options in such cases, for instance you can write your own Converter to perform mappings on specific objects. Another is to accept both like so.
@Attribute(required=false)private String name;
@Attribute(required=false)private String login;
@Validateprivate void commit() throws Exception { if(name != null) { setUserName(name); } else if(login != null) { setUserName(login); }}
Niall
--- On Thu, 17/2/11, Alexey Skor <al...@gm...> wrote:
From: Alexey Skor <al...@gm...>
Subject: [Simple-support] using mapping files with Simple XML
To: sim...@li...
Received: Thursday, 17 February, 2011, 4:13 PM
Hi!
I'm working on a Java API for Redmine's REST service (www.redmine.org).
One of the users has recently submitted a bug that my API does not work under Android OS: https://code.google.com/p/redmine-java-api/issues/detail?id=17
I'm using Castor XML now, but unfortunately it does not work under Android so I'm looking for some other solution...I'd like to give SimpleXML a try, but don't want to add SimpleXML-specific annotations to my objects. moreover having annotations is not flexible - unfortunately, objects can be provided by the server in different xml formats depending on how exactly I requested them. so, in one case "user name" can be stored in "name" attribute, and in another XML response from the REST service the same "user name" can be provided in "login" attribute.
the way I deal with this in Castor XML is I use different XML mapping files for different requests/responses. e.g. one XML mapping file for getting "users list" and and another mapping for getting "project and its user/owner info".
any advice?
--
Alex
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|