simple-support Mailing List for Simple (Page 32)
Brought to you by:
niallg
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
(13) |
May
(13) |
Jun
(27) |
Jul
(4) |
Aug
(14) |
Sep
(7) |
Oct
|
Nov
(6) |
Dec
(24) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
|
Feb
(21) |
Mar
(10) |
Apr
(15) |
May
(24) |
Jun
(24) |
Jul
(30) |
Aug
(5) |
Sep
(19) |
Oct
(27) |
Nov
(16) |
Dec
(24) |
| 2009 |
Jan
(34) |
Feb
(24) |
Mar
(35) |
Apr
(26) |
May
(8) |
Jun
(17) |
Jul
(28) |
Aug
(31) |
Sep
(36) |
Oct
(35) |
Nov
(20) |
Dec
(16) |
| 2010 |
Jan
(40) |
Feb
(21) |
Mar
(47) |
Apr
(45) |
May
(34) |
Jun
(68) |
Jul
(46) |
Aug
(39) |
Sep
(47) |
Oct
(20) |
Nov
(42) |
Dec
(13) |
| 2011 |
Jan
(41) |
Feb
(16) |
Mar
(32) |
Apr
(44) |
May
(28) |
Jun
(35) |
Jul
(37) |
Aug
(33) |
Sep
(60) |
Oct
(20) |
Nov
(35) |
Dec
(23) |
| 2012 |
Jan
(34) |
Feb
(23) |
Mar
(34) |
Apr
(21) |
May
(48) |
Jun
(24) |
Jul
(31) |
Aug
(39) |
Sep
(25) |
Oct
(10) |
Nov
(27) |
Dec
(28) |
| 2013 |
Jan
(32) |
Feb
(24) |
Mar
(24) |
Apr
(9) |
May
(4) |
Jun
(6) |
Jul
(2) |
Aug
(5) |
Sep
|
Oct
(5) |
Nov
(1) |
Dec
(12) |
| 2014 |
Jan
(14) |
Feb
(16) |
Mar
(5) |
Apr
(3) |
May
(2) |
Jun
(8) |
Jul
(2) |
Aug
|
Sep
(6) |
Oct
|
Nov
(6) |
Dec
|
| 2015 |
Jan
(3) |
Feb
(15) |
Mar
(7) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
| 2016 |
Jan
|
Feb
(6) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Nugroho S. <nug...@gm...> - 2011-06-14 04:58:35
|
Hi,
Simple XML is a great framework, it support most of our requirements but I
have a question regarding dynamic element name.
I have some am working with XML that has dynamic element name. Please see
the sample below, in this case custom fields are dynamic:
<person>
<name>Nugroho</name>
.....
<custom_fields>
<birthdate>1976-12-26</birthdate>
<opted-out>true</opted-out>
</custom_fields>
</person>
It is possible to map custom fields in the above XML to a Map with element
name as map key ?
so the java class will be
class Person {
String name;
Map<String, String> customFields;
}
I have tried creating Converted for it. I can convert
from <custom_fields> InputNode to a Map but I am unable to convert Map to
OutputNode in write() method, because there are no method I can use to add a
child element in OutputNode.
Thank you.
Regards,
Nugroho
|
|
From: Robert M. <rob...@gm...> - 2011-06-12 13:40:07
|
Hi Simple XML, There was this really interesting question on SO regarding how to have nested elements that appear in every class. I answered the question but you might have a better way to do it. Either way after you have a look at it it might be worth incorporating it into your tutorial in some way: http://stackoverflow.com/q/6197196/83446 Enjoy, Robert |
|
From: Niall G. <gal...@ya...> - 2011-06-11 00:43:39
|
You would need to use the @Convert annotation and Converter interface to handle this, there are examples in the test cases and in the online tutorial. --- On Thu, 9/6/11, Artur T <at....@gm...> wrote: From: Artur T <at....@gm...> Subject: [Simple-support] Serializing into 2 similar classes with different names To: sim...@li... Received: Thursday, 9 June, 2011, 4:23 PM Hi, I'm trying to deserialize an object that contains Vector2f (a compiled class object from a Java game development framework). However, the object was serialized by another framework (for .NET) which deals with the same data type but defines it as Vector2... I don't have the option of altering the files native to either individual frameworks. What can I do to be able to interpret the Vector2 field for the Vector2f variable. Also, I just realized, since I cannot modify the Vector2f class, I cannot add the @Element identifier, does that mean that it won't serialize even if it's part of the classes that I am serializing? Your help is greatly appreciated. Thanks,Artur -----Inline Attachment Follows----- ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Niall G. <gal...@ya...> - 2011-06-11 00:42:32
|
new TreeStrategy("klazz") will fix, now it will use klazz instead of class, there are loads of examples in the test cases.
--- On Thu, 9/6/11, user <xx...@ra...> wrote:
> From: user <xx...@ra...>
> Subject: Re: [Simple-support] Problem consuming external XML that contains an element with an attribute with name "class"
> To: sim...@li...
> Received: Thursday, 9 June, 2011, 10:29 PM
> Does "(required=false)" attribute
> param helps?
>
> * Spam Mail <spa...@gm...>
> [Thu, 9 Jun 2011 22:49:10
> +0200]:
> > Hi,
> >
> > I get a ClassNotFoundException since Simple tries to
> create a class
> with
> > the
> > same class name as the value of the "class"
> attribute.
> >
> > Is there a way to tell Simple to ignore the class
> attribute?
> >
> > I am using Simple 2.5.3.
> >
> > Thanks for reading!
> >
> >
> ------------------------------------------------------------------------------
> > EditLive Enterprise is the world's most technically
> advanced content
> > authoring tool. Experience the power of Track Changes,
> Inline Image
> > Editing and ensure content is compliant with
> Accessibility Checking.
> > http://p.sf.net/sfu/ephox-dev2dev
> >
> > _______________________________________________
> > Simple-support mailing list
> > Sim...@li...
> > https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically
> advanced content
> authoring tool. Experience the power of Track Changes,
> Inline Image
> Editing and ensure content is compliant with Accessibility
> Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|
|
From: Spam M. <spa...@gm...> - 2011-06-10 21:05:07
|
I tried with this: @Attribute(name = "class", required = false) private String class_name; but I still get an exception: java.lang.ClassNotFoundException: pointData pointData is the value of the attribute "class" Thanks for trying to help! On Fri, Jun 10, 2011 at 7:29 AM, user <xx...@ra...> wrote: > Does "(required=false)" attribute param helps? > > * Spam Mail <spa...@gm...> [Thu, 9 Jun 2011 22:49:10 > +0200]: > > Hi, > > > > I get a ClassNotFoundException since Simple tries to create a class > with > > the > > same class name as the value of the "class" attribute. > > > > Is there a way to tell Simple to ignore the class attribute? > > > > I am using Simple 2.5.3. > > > > Thanks for reading! > > > > > > ------------------------------------------------------------------------------ > > EditLive Enterprise is the world's most technically advanced content > > authoring tool. Experience the power of Track Changes, Inline Image > > Editing and ensure content is compliant with Accessibility Checking. > > http://p.sf.net/sfu/ephox-dev2dev > > > > _______________________________________________ > > Simple-support mailing list > > Sim...@li... > > https://lists.sourceforge.net/lists/listinfo/simple-support > > > > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > |
|
From: joh sar..... <eh...@gm...> - 2011-06-10 13:35:55
|
Hi all,
Thanks for the library, it's very helpful and very efficient.
I am writing to you because I have a deserializing problem.
I try to deserializing a xml that i have serialized with your library and i
don't find my bug.
May be someone could help me or give me a clue;
The log is : ERROR/erreur(15302):
org.simpleframework.xml.core.PersistenceException: Constructor not matched
for class construction_Xml_Data.IDE
where IDE is one of my class that i have implemented. I don't know why it
did not find my class !
Thanks !
Johan
This is my code :
/-----------------------
@Root(strict = false)
public class Utilisateurs {
@ElementList(type = Medecin.class)
private ArrayList<Medecin> medecins;
@ElementList(type = IDE.class)
private ArrayList<IDE> ides;
... constructors and getters
------------------------------/
/---------------------------------
@Root
public class Medecin {
@Element
private String nom;
@Element
private String prenom;
@Element
private String specialite;
@Element
private int encours;
.... constructors and getters
-------------------------------------/
/---------------------------------------
@Root
public class IDE {
@Element
private String nom;
@Element
private String prenom;
@Element
private String specialite;
@Element
private int encours;
... constructor and getters
-------------------------------------------/
And that is the read code:
try {
Serializer serializer = new Persister();
File file = new File(path);
Utilisateurs util = serializer.read(Utilisateurs.class,
file,false); <--- the problem and i'm sure that my path is good
} catch (Exception e) {
// TODO Auto-generated catch block
Log.e("erreur", "pas d'ecriture xml", e);
}
|
|
From: user <xx...@ra...> - 2011-06-10 05:46:18
|
Does "(required=false)" attribute param helps? * Spam Mail <spa...@gm...> [Thu, 9 Jun 2011 22:49:10 +0200]: > Hi, > > I get a ClassNotFoundException since Simple tries to create a class with > the > same class name as the value of the "class" attribute. > > Is there a way to tell Simple to ignore the class attribute? > > I am using Simple 2.5.3. > > Thanks for reading! > > ------------------------------------------------------------------------------ > EditLive Enterprise is the world's most technically advanced content > authoring tool. Experience the power of Track Changes, Inline Image > Editing and ensure content is compliant with Accessibility Checking. > http://p.sf.net/sfu/ephox-dev2dev > > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Artur T <at....@gm...> - 2011-06-09 23:23:20
|
Hi, I'm trying to deserialize an object that contains Vector2f (a compiled class object from a Java game development framework). However, the object was serialized by another framework (for .NET) which deals with the same data type but defines it as Vector2... I don't have the option of altering the files native to either individual frameworks. What can I do to be able to interpret the Vector2 field for the Vector2f variable. Also, I just realized, since I cannot modify the Vector2f class, I cannot add the @Element identifier, does that mean that it won't serialize even if it's part of the classes that I am serializing? Your help is greatly appreciated. Thanks, Artur |
|
From: Spam M. <spa...@gm...> - 2011-06-09 20:49:17
|
Hi, I get a ClassNotFoundException since Simple tries to create a class with the same class name as the value of the "class" attribute. Is there a way to tell Simple to ignore the class attribute? I am using Simple 2.5.3. Thanks for reading! |
|
From: Niall G. <gal...@ya...> - 2011-06-09 11:35:48
|
Hi,
Can you write this as a unit test?
Thanks,
Niall
--- On Tue, 7/6/11, user <xx...@ra...> wrote:
> From: user <xx...@ra...>
> Subject: [Simple-support] Bug when read XML with ArrayList and HashMap created by simple
> To: sim...@li...
> Received: Tuesday, 7 June, 2011, 5:38 AM
> There is a small class which creates
> default configuration and saves it
> into file:
>
> package videocontroldesk.params;
>
> import java.io.File;
> import java.util.ArrayList;
> import java.util.HashMap;
> import java.util.List;
> import java.util.Map;
> import java.util.logging.Level;
> import java.util.logging.Logger;
> import org.simpleframework.xml.Element;
> import org.simpleframework.xml.ElementList;
> import org.simpleframework.xml.ElementMap;
> import org.simpleframework.xml.Root;
> import org.simpleframework.xml.Serializer;
> import org.simpleframework.xml.core.Persister;
>
> @Root
> public class VCDParams {
>
> private static VCDParams instance;
> private static final String filename =
> "VCDParams.xml";
> private static final Logger logger =
> Logger.getLogger(VCDParams.class.getName());
>
> @Element
> private int selectedLayoutIdx;
>
> @ElementList
> private List<LayoutParams> layouts;
>
> @ElementMap
> private Map<String, String>
> ipForCamera;
>
> private VCDParams() {
> selectedLayoutIdx = 0;
> layouts = new
> ArrayList<LayoutParams>();
> for (int i = 0; i < 4; ++i)
> {
> layouts.add(new
> LayoutParams());
> }
> ipForCamera = new
> HashMap<String, String>();
> ipForCamera.put("БК1",
> "192.168.0.101");
> }
>
> public int getLayoutsCount() {
> return layouts.size();
> }
>
> public LayoutParams getLayout(int layoutIdx)
> {
> return layouts.get(layoutIdx);
> }
>
> public static VCDParams getInstance() {
> if (instance == null) {
> try {
>
> instance = read();
> }
> catch (Exception
> ex) {
>
> instance = new VCDParams();
> }
> }
> return instance;
> }
>
> private static VCDParams read() throws
> Exception {
> Serializer reader = new
> Persister();
> File f = new File(filename);
> return
> reader.read(VCDParams.class, f);
> }
>
> public void save() {
> Serializer saver = new
> Persister();
> File f = new File(filename);
> try {
> saver.write(this,
> f);
> } catch (Exception ex) {
>
> logger.log(Level.WARNING, "Не могу сохранить
> файл {0}",
> filename);
> }
> }
>
> public static void main(String[] args) {
>
> //VCDParams.getInstance().save();
> VCDParams params =
> VCDParams.getInstance();
> //String[] cams =
> VCDParams.getInstance().getLayout(0).getAllCamIds();
> }
>
> }
>
>
> If I uncomment "save()" method call I get the following
> XML:
>
> <VCDParams>
> <selectedLayoutIdx>0</selectedLayoutIdx>
> <layouts
> class="java.util.ArrayList">
> <layoutParams columnsCount="2"
> rowsCount="1">
> <cell
> cellId="0">БК1</cell>
> </layoutParams>
> <layoutParams columnsCount="2"
> rowsCount="1">
> <cell
> cellId="0">БК1</cell>
> </layoutParams>
> <layoutParams columnsCount="2"
> rowsCount="1">
> <cell
> cellId="0">БК1</cell>
> </layoutParams>
> <layoutParams columnsCount="2"
> rowsCount="1">
> <cell
> cellId="0">БК1</cell>
> </layoutParams>
> </layouts>
> <ipForCamera
> class="java.util.HashMap">
> <entry>
>
> <string>БК1</string>
>
> <string>192.168.0.101</string>
> </entry>
> </ipForCamera>
> </VCDParams>
>
>
> It looks OK. Then I comment "save()" and uncomment "
> VCDParams.getInstance()" call.
> When I set breakpoint right after this call I check the
> value of
> layouts.size(). It return 8 instead of 4.
> Please fix it.
> Tested on 2.5.3 and 2.4.1.
>
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically
> advanced content
> authoring tool. Experience the power of Track Changes,
> Inline Image
> Editing and ensure content is compliant with Accessibility
> Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|
|
From: Mattis S. <sto...@gm...> - 2011-06-08 22:14:00
|
Hi, I get a ClassNotFoundException since Simple tries to create a class with the same class name as the value of the "class" attribute. Is there a way to tell Simple to ignore the class attribute? I am using Simple 2.5.3. Kind regards, Mattis |
|
From: Stumpf, J. T. <Tho...@st...> - 2011-06-07 16:16:12
|
Hi! I'm rather new to Simple XML-Serialization library/framework so please forgive me if I ask quite clear, frequently asked or obvious things: We have an existing XML scheme which I want to use in java within an Android app - to be exact I want to use the data exported as instances of this scheme. My problem right now is that we have existing IDs which are XML conform. These constist of a few characters and an unique number. These two parts are combined by a hyphen. So it's something like poi-123. As said before that is a unique and valid XML-ID-type conform value and it hast o be - so we can not change it to numbers (it doesn't make sense to give up valid document values for invalid, does it?). We are referencing these ids by id-references in childs within the object and sisters objects. So these childs are reference objects pointing tot he matching objects in a XML scheme conform way. ... <object id="poi-123"..> <oref idref="poi-124"/> <!-- pointing to subsequent sister object of parent --> ... </object> <object id="poi-124"..> <oref idref="poi-124"/> <!-- pointing to parent object and an subsequent object --> <oref idref="poi-125"/> ... </object> ... I tried to implement this reference by using the CycleStrategy-Pattern but it most probably fails because of the format of the id - the result is that the id attribute is ignored. I wanted to do it that way, because there may exist references to the object itself or one of it's parents. Of course I could implement a method to search all the objects to find one with the proper id but if the CycleStrategy exists it doesn't seem to be wise to reinvent the wheel... Can you give me a hint how to implement it or is the library right now not able to use this type of ids? If the later is true can/will the usage of XML-scheme conform ids be implemented soon? Can I help implementing it? Is there an alternative to do it? Regards Thorsten |
|
From: user <xx...@ra...> - 2011-06-07 12:38:57
|
There is a small class which creates default configuration and saves it
into file:
package videocontroldesk.params;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.ElementMap;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
@Root
public class VCDParams {
private static VCDParams instance;
private static final String filename = "VCDParams.xml";
private static final Logger logger =
Logger.getLogger(VCDParams.class.getName());
@Element
private int selectedLayoutIdx;
@ElementList
private List<LayoutParams> layouts;
@ElementMap
private Map<String, String> ipForCamera;
private VCDParams() {
selectedLayoutIdx = 0;
layouts = new ArrayList<LayoutParams>();
for (int i = 0; i < 4; ++i) {
layouts.add(new LayoutParams());
}
ipForCamera = new HashMap<String, String>();
ipForCamera.put("БК1", "192.168.0.101");
}
public int getLayoutsCount() {
return layouts.size();
}
public LayoutParams getLayout(int layoutIdx) {
return layouts.get(layoutIdx);
}
public static VCDParams getInstance() {
if (instance == null) {
try {
instance = read();
}
catch (Exception ex) {
instance = new VCDParams();
}
}
return instance;
}
private static VCDParams read() throws Exception {
Serializer reader = new Persister();
File f = new File(filename);
return reader.read(VCDParams.class, f);
}
public void save() {
Serializer saver = new Persister();
File f = new File(filename);
try {
saver.write(this, f);
} catch (Exception ex) {
logger.log(Level.WARNING, "Не могу сохранить файл {0}",
filename);
}
}
public static void main(String[] args) {
//VCDParams.getInstance().save();
VCDParams params = VCDParams.getInstance();
//String[] cams =
VCDParams.getInstance().getLayout(0).getAllCamIds();
}
}
If I uncomment "save()" method call I get the following XML:
<VCDParams>
<selectedLayoutIdx>0</selectedLayoutIdx>
<layouts class="java.util.ArrayList">
<layoutParams columnsCount="2" rowsCount="1">
<cell cellId="0">БК1</cell>
</layoutParams>
<layoutParams columnsCount="2" rowsCount="1">
<cell cellId="0">БК1</cell>
</layoutParams>
<layoutParams columnsCount="2" rowsCount="1">
<cell cellId="0">БК1</cell>
</layoutParams>
<layoutParams columnsCount="2" rowsCount="1">
<cell cellId="0">БК1</cell>
</layoutParams>
</layouts>
<ipForCamera class="java.util.HashMap">
<entry>
<string>БК1</string>
<string>192.168.0.101</string>
</entry>
</ipForCamera>
</VCDParams>
It looks OK. Then I comment "save()" and uncomment "
VCDParams.getInstance()" call.
When I set breakpoint right after this call I check the value of
layouts.size(). It return 8 instead of 4.
Please fix it.
Tested on 2.5.3 and 2.4.1.
|
|
From: Niall G. <gal...@ya...> - 2011-06-04 04:51:20
|
Hi,
I am sure you could use a strategy here and write your own way of determining the type. The persister will simply ask the strategy, what is the type for this XML element. The strategy then provides an object with the details. There should be some examples in the test cases of this.
You should then be able to do.
MyStrategy x = ...
Persister p = new Persister(x);
Object o = p.read(Object.class, xml);
Niall
--- On Fri, 3/6/11, Lumsdon, Hugo <Hug...@bl...> wrote:
> From: Lumsdon, Hugo <Hug...@bl...>
> Subject: [Simple-support] Dynamic object type determination
> To: sim...@li...
> Received: Friday, 3 June, 2011, 10:39 AM
> Hi,
>
> Very new to the Simple framework, but curious as to whether
> there is an
> easy way to dynamically determine the object type that
> we're
> de-serializing from the XML file itself without having to
> specify it in
> advance as an argument to the
> Serializer. i.e. the object type would
> be determined from the top-level XML element name.
>
> Basically in many cases we're not expecting to have to
> manipulate
> objects within our Java code - but purely pass them to a
> view (e.g.
> Freemarker) so it can pull back specific bean properties
> using
> introspection as normal. We're using
> Spring MVC - and it just means we
> can use a generic controller in many circumtances to read
> in the
> relevant content XML object and just hand off to the
> required view.
>
> I guess this is a bit like the functionality the @Union
> annotation
> provides, but that's obviously a level down so we'd have to
> wrap
> everything. Maybe that is the best solution here, but
> just exploring
> options.
>
> Thanks.
>
>
>
>
>
>
>
>
> THIS MESSAGE AND ANY ATTACHMENTS ARE CONFIDENTIAL,
> PROPRIETARY, AND MAY BE PRIVILEGED. If this message
> was misdirected, BlackRock, Inc. and its subsidiaries,
> ("BlackRock") does not waive any confidentiality or
> privilege. If you are not the intended recipient,
> please notify us immediately and destroy the message without
> disclosing its contents to anyone. Any distribution,
> use or copying of this e-mail or the information it contains
> by other than an intended recipient is unauthorized.
> The views and opinions expressed in this e-mail message are
> the author's own and may not reflect the views and opinions
> of BlackRock, unless the author is authorized by BlackRock
> to express such views or opinions on its behalf. All
> email sent to or from this address is subject to electronic
> storage and review by BlackRock. Although BlackRock
> operates anti-virus programs, it does not accept
> responsibility for any damage whatsoever caused by viruses
> being passed.
>
>
>
> --
> BlackRock Advisors (UK) Limited is authorized and regulated
> by The Financial Services Authority. Registered in England.
> Registered No:796793. Registered Office: 33 King William
> Street, London EC4R 9AS.
>
> ------------------------------------------------------------------------------
> Simplify data backup and recovery for your virtual
> environment with vRanger.
> Installation's a snap, and flexible recovery options mean
> your data is safe,
> secure and there when you need it. Discover what all the
> cheering's about.
> Get your free trial download today.
> http://p.sf.net/sfu/quest-dev2dev2
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|
|
From: Lumsdon, H. <Hug...@bl...> - 2011-06-03 17:57:15
|
Hi,
Very new to the Simple framework, but curious as to whether there is an
easy way to dynamically determine the object type that we're
de-serializing from the XML file itself without having to specify it in
advance as an argument to the Serializer. i.e. the object type would
be determined from the top-level XML element name.
Basically in many cases we're not expecting to have to manipulate
objects within our Java code - but purely pass them to a view (e.g.
Freemarker) so it can pull back specific bean properties using
introspection as normal. We're using Spring MVC - and it just means we
can use a generic controller in many circumtances to read in the
relevant content XML object and just hand off to the required view.
I guess this is a bit like the functionality the @Union annotation
provides, but that's obviously a level down so we'd have to wrap
everything. Maybe that is the best solution here, but just exploring
options.
Thanks.
THIS MESSAGE AND ANY ATTACHMENTS ARE CONFIDENTIAL, PROPRIETARY, AND MAY BE PRIVILEGED. If this message was misdirected, BlackRock, Inc. and its subsidiaries, ("BlackRock") does not waive any confidentiality or privilege. If you are not the intended recipient, please notify us immediately and destroy the message without disclosing its contents to anyone. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of BlackRock, unless the author is authorized by BlackRock to express such views or opinions on its behalf. All email sent to or from this address is subject to electronic storage and review by BlackRock. Although BlackRock operates anti-virus programs, it does not accept responsibility for any damage whatsoever caused by viruses being passed.
--
BlackRock Advisors (UK) Limited is authorized and regulated by The Financial Services Authority. Registered in England. Registered No:796793. Registered Office: 33 King William Street, London EC4R 9AS.
|
|
From: Robert S. <rob...@gm...> - 2011-05-31 22:04:25
|
Hello,
Let's say I have the following XML structure:
<?xml version="1.0" encoding="UTF-8"?>
<ResC>
<ConRes>
<Err text="Error text 1" />
<ConList>
<Con>
<Err text="Error text 2" />
</Con>
</ConList>
</ConRes>
<Err text="Error text 3" />
</ResC>
I also have created the following class:
@Element(required=false)
public class Err {
@Attribut
private String text;
public String getText() { return text; }
public void setText(String text) { this.text = text; }
}
However I don't understand how I can "find" any or all <Err> elements in
the document. I'd like to avoid defining an Err object in ResC, ConRes
and Con as this element may appear on almost any level.
Using the XPath //Err[1] to get the very first <Err> does not work :-(
Could anybody help me with that?
Thanks,
Robert
|
|
From: Niall G. <gal...@ya...> - 2011-05-31 09:46:54
|
Hi, I am sure there is a way to avoid obfuscation of certain packages and class. You should include these so they do not cause any issues. Niall --- On Mon, 30/5/11, Christian Rackerseder <log...@gm...> wrote: > From: Christian Rackerseder <log...@gm...> > Subject: [Simple-support] ProGuard for Android not working > To: sim...@li... > Received: Monday, 30 May, 2011, 8:06 AM > Hi, > > if I enable ProGuard for Android I get following warnings > and the > build breaks. Can anyone help me? > > [2011-05-30 16:57:32 - HelloAndroid] Proguard returned with > error code > 1. See console > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamProvider: can't find > referenced > class javax.xml.stream.XMLInputFactory > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamProvider: can't find > referenced > class javax.xml.stream.XMLEventReader > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader$Start: can't > find > referenced class javax.xml.stream.events.XMLEvent > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader$Start: can't > find > referenced class javax.xml.stream.Location > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader$Start: can't > find > referenced class javax.xml.stream.events.StartElement > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader$Start: can't > find > referenced class javax.xml.stream.events.XMLEvent > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader$Start: can't > find > referenced class javax.xml.stream.events.Attribute > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader$Entry: can't > find > referenced class javax.xml.stream.events.Attribute > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader$Text: can't > find > referenced class javax.xml.stream.events.XMLEvent > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader$Text: can't > find > referenced class javax.xml.stream.events.Characters > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader: can't find > referenced > class javax.xml.stream.XMLEventReader > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader: can't find > referenced > class javax.xml.stream.events.XMLEvent > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader: can't find > referenced > class javax.xml.stream.events.Attribute > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader: can't find > referenced > class javax.xml.stream.XMLEventReader > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader: can't find > referenced > class javax.xml.stream.events.XMLEvent > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader: can't find > referenced > class javax.xml.stream.XMLEventReader > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader: can't find > referenced > class javax.xml.stream.events.XMLEvent > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader: can't find > referenced > class javax.xml.stream.events.Attribute > [2011-05-30 16:57:32 - HelloAndroid] Warning: > org.simpleframework.xml.stream.StreamReader: can't find > referenced > class javax.xml.stream.events.XMLEvent > [2011-05-30 16:57:32 - HelloAndroid] Warning: there were 52 > unresolved > references to classes or interfaces. > [2011-05-30 16:57:32 - HelloAndroid] > You may need to specify > additional library jars (using '-libraryjars'), > [2011-05-30 16:57:32 - HelloAndroid] > or perhaps the > '-dontskipnonpubliclibraryclasses' option. > [2011-05-30 16:57:32 - HelloAndroid] java.io.IOException: > Please > correct the above warnings first. > [2011-05-30 16:57:32 - HelloAndroid] at > proguard.Initializer.execute(Initializer.java:308) > [2011-05-30 16:57:32 - HelloAndroid] at > proguard.ProGuard.initialize(ProGuard.java:210) > [2011-05-30 16:57:32 - HelloAndroid] at > proguard.ProGuard.execute(ProGuard.java:85) > [2011-05-30 16:57:32 - HelloAndroid] at > proguard.ProGuard.main(ProGuard.java:499) > > ------------------------------------------------------------------------------ > vRanger cuts backup time in half-while increasing > security. > With the market-leading solution for virtual backup and > recovery, > you get blazing-fast, flexible, and affordable data > protection. > Download your free trial now. > http://p.sf.net/sfu/quest-d2dcopy1 > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > |
|
From: Christian R. <log...@gm...> - 2011-05-30 15:06:43
|
Hi, if I enable ProGuard for Android I get following warnings and the build breaks. Can anyone help me? [2011-05-30 16:57:32 - HelloAndroid] Proguard returned with error code 1. See console [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamProvider: can't find referenced class javax.xml.stream.XMLInputFactory [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamProvider: can't find referenced class javax.xml.stream.XMLEventReader [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader$Start: can't find referenced class javax.xml.stream.events.XMLEvent [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader$Start: can't find referenced class javax.xml.stream.Location [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader$Start: can't find referenced class javax.xml.stream.events.StartElement [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader$Start: can't find referenced class javax.xml.stream.events.XMLEvent [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader$Start: can't find referenced class javax.xml.stream.events.Attribute [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader$Entry: can't find referenced class javax.xml.stream.events.Attribute [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader$Text: can't find referenced class javax.xml.stream.events.XMLEvent [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader$Text: can't find referenced class javax.xml.stream.events.Characters [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.XMLEventReader [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.Attribute [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.XMLEventReader [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.XMLEventReader [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.Attribute [2011-05-30 16:57:32 - HelloAndroid] Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent [2011-05-30 16:57:32 - HelloAndroid] Warning: there were 52 unresolved references to classes or interfaces. [2011-05-30 16:57:32 - HelloAndroid] You may need to specify additional library jars (using '-libraryjars'), [2011-05-30 16:57:32 - HelloAndroid] or perhaps the '-dontskipnonpubliclibraryclasses' option. [2011-05-30 16:57:32 - HelloAndroid] java.io.IOException: Please correct the above warnings first. [2011-05-30 16:57:32 - HelloAndroid] at proguard.Initializer.execute(Initializer.java:308) [2011-05-30 16:57:32 - HelloAndroid] at proguard.ProGuard.initialize(ProGuard.java:210) [2011-05-30 16:57:32 - HelloAndroid] at proguard.ProGuard.execute(ProGuard.java:85) [2011-05-30 16:57:32 - HelloAndroid] at proguard.ProGuard.main(ProGuard.java:499) |
|
From: Niall G. <gal...@ya...> - 2011-05-26 08:45:00
|
Hi, Yes, it does work for attributes. Check out the test cases, in particular PrimitiveArrayTransformTest. Niall --- On Mon, 23/5/11, Raphael Jolivet <rap...@gm...> wrote: From: Raphael Jolivet <rap...@gm...> Subject: Re: [Simple-support] Support for almost-primitive types, Converters in attributes and Arrays in attributes To: "Niall Gallagher" <gal...@ya...> Cc: sim...@li... Received: Monday, 23 May, 2011, 4:10 AM Hi, It seems that it does not work for attributes. Attributes require to parse / generate primitive types (and not array of it), whereas there should not be any fondamental difference from parsing / seriliazing the "text" value of a single element. Raphael 2011/5/20 Niall Gallagher <gal...@ya...> Hi, These capabilities are all ready there, take a look at the Matcher/Transform for transforming custom types and attributes. Also, @Elementon an array produces a comma separated list, all read and written via the Transform objects resolve to the types. Niall --- On Thu, 19/5/11, Raphael Jolivet <rap...@gm...> wrote: From: Raphael Jolivet <rap...@gm...> Subject: [Simple-support] Support for almost-primitive types, Converters in attributes and Arrays in attributes To: sim...@li... Received: Thursday, 19 May, 2011, 6:10 AM Hello there, I am using the Simple XML framework extensively for all my XML parsing / generating tasks and I am very happy with it.However, I would like to propose some enhancements that would enable me to serialize / deserialize almost all my classes without the need of further work, except for some annotations. = Almost-primitive types First, I would like to ask for the support of "almost-primitive" types. In the Jersey REST Servlet (based on JAX-RS API), there is a convention that states : Any class providing a "public Constructor(String)" or a static method "static public fromString(String)" can be considered as a native type and is parsed, serialized without having to write a custom Converter / Mapper. The toString() method is using for serialization. This is very handy, as writing a single static method for a class is less work than writing a Converter and having to register it, or to annotate every occurrence of attributes of its type. = Only primitive types supported for attributes ? Also, I have experienced that custom converters (either registered in a strategy, or specified as annotations with the AnnotationStrategy) are not supported for attributes. It seems that attributes explicitly require the use of Java primitive types. Therefore, I had to write custom getters / setters with Strings to overcome this limitation. = Unique annotation to parse Lists and Arrays, and new annotation to parse arrays of attributes (with a separator) I think that the distinction between ElementArray and ElementList is not necessary, as it is semantically the same structure of objects ( a sequence of objects) : The framework should handle transparently Arrays and List without having to specify it in the annotation. let's have a unique "ElementSequence" annotation. Also, this is a very common situation to have several values wrapped into a unique attributes, as comma separated values.<task times="2 s, 3 h, 4m" > I would like to be able to write something like AttributeSequence(name="times", separator=",")Duration[] durations; Duration being a class that provides a static "fromString(String)" method, to parse Strings. With that, the framework should be able to serialize / parse this code without the need of any other information / code. What do you think about those requests ?Some of them may be already supported : Please tell me if I missed something. Thanks again for your great work,Best regards, Raphael JOLIVET -----Inline Attachment Follows----- ------------------------------------------------------------------------------ What Every C/C++ and Fortran developer Should Know! Read this article and learn how Intel has extended the reach of its next-generation tools to help Windows* and Linux* C/C++ and Fortran developers boost performance applications - including clusters. http://p.sf.net/sfu/intel-dev2devmay -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Raphael J. <rap...@gm...> - 2011-05-23 11:10:57
|
Hi, It seems that it does not work for attributes. Attributes require to parse / generate primitive types (and not array of it), whereas there should not be any fondamental difference from parsing / seriliazing the "text" value of a single element. Raphael 2011/5/20 Niall Gallagher <gal...@ya...> > Hi, > > These capabilities are all ready there, take a look at the > Matcher/Transform for transforming custom types and attributes. Also, > @Elementon an array produces a comma separated list, all read and written > via the Transform objects resolve to the types. > > Niall > > --- On *Thu, 19/5/11, Raphael Jolivet <rap...@gm...>* wrote: > > > From: Raphael Jolivet <rap...@gm...> > Subject: [Simple-support] Support for almost-primitive types, Converters in > attributes and Arrays in attributes > To: sim...@li... > Received: Thursday, 19 May, 2011, 6:10 AM > > > Hello there, > > I am using the Simple XML framework extensively for all my XML parsing / > generating tasks and I am very happy with it. > However, I would like to propose some enhancements that would enable me to > serialize / deserialize almost all my classes without the need of further > work, except for some annotations. > > = Almost-primitive types > > First, I would like to ask for the support of "almost-primitive" types. > > In the Jersey REST Servlet (based on JAX-RS API), there is a convention > that states : Any class providing a "public Constructor(String)" or a static > method "static public fromString(String)" can be considered as a native type > and is parsed, serialized without having to write a custom Converter / > Mapper. The toString() method is using for serialization. > > This is very handy, as writing a single static method for a class is less > work than writing a Converter and having to register it, or to annotate > every occurrence of attributes of its type. > > = Only primitive types supported for attributes ? > > Also, I have experienced that custom converters (either registered in a > strategy, or specified as annotations with the AnnotationStrategy) are not > supported for attributes. > > It seems that attributes explicitly require the use of Java primitive > types. > Therefore, I had to write custom getters / setters with Strings to overcome > this limitation. > > = Unique annotation to parse Lists and Arrays, and new annotation to parse > arrays of attributes (with a separator) > > I think that the distinction between ElementArray and ElementList is not > necessary, as it is semantically the same structure of objects ( a sequence > of objects) : The framework should handle transparently Arrays and List > without having to specify it in the annotation. let's have a unique > "ElementSequence" annotation. > > Also, this is a very common situation to have several values wrapped into a > unique attributes, as comma separated values. > <task times="2 s, 3 h, 4m" > > > I would like to be able to write something like > > AttributeSequence(name="times", separator=",") > Duration[] durations; > > Duration being a class that provides a static "fromString(String)" method, > to parse Strings. > With that, the framework should be able to serialize / parse this code > without the need of any other information / code. > > What do you think about those requests ? > Some of them may be already supported : Please tell me if I missed > something. > > Thanks again for your great work, > Best regards, > > Raphael JOLIVET > > > > -----Inline Attachment Follows----- > > > ------------------------------------------------------------------------------ > What Every C/C++ and Fortran developer Should Know! > Read this article and learn how Intel has extended the reach of its > next-generation tools to help Windows* and Linux* C/C++ and Fortran > developers boost performance applications - including clusters. > http://p.sf.net/sfu/intel-dev2devmay > > -----Inline Attachment Follows----- > > _______________________________________________ > Simple-support mailing list > Sim...@li...<http://mc/compose?to=...@li...> > https://lists.sourceforge.net/lists/listinfo/simple-support > > |
|
From: Chakrapani M. <cha...@ya...> - 2011-05-20 19:20:46
|
Hi, I came across Simple after searching for a Simple API for Java-XML binding. I would like to try it out. All I have is a DTD to start with ? Is there a way I can generate java classes using Simple API for a given DTD or XML Schema ? Please let us know. Thanks in advance, Pani |
|
From: Niall G. <gal...@ya...> - 2011-05-20 08:55:24
|
Hi, These capabilities are all ready there, take a look at the Matcher/Transform for transforming custom types and attributes. Also, @Elementon an array produces a comma separated list, all read and written via the Transform objects resolve to the types. Niall --- On Thu, 19/5/11, Raphael Jolivet <rap...@gm...> wrote: From: Raphael Jolivet <rap...@gm...> Subject: [Simple-support] Support for almost-primitive types, Converters in attributes and Arrays in attributes To: sim...@li... Received: Thursday, 19 May, 2011, 6:10 AM Hello there, I am using the Simple XML framework extensively for all my XML parsing / generating tasks and I am very happy with it.However, I would like to propose some enhancements that would enable me to serialize / deserialize almost all my classes without the need of further work, except for some annotations. = Almost-primitive types First, I would like to ask for the support of "almost-primitive" types. In the Jersey REST Servlet (based on JAX-RS API), there is a convention that states : Any class providing a "public Constructor(String)" or a static method "static public fromString(String)" can be considered as a native type and is parsed, serialized without having to write a custom Converter / Mapper. The toString() method is using for serialization. This is very handy, as writing a single static method for a class is less work than writing a Converter and having to register it, or to annotate every occurrence of attributes of its type. = Only primitive types supported for attributes ? Also, I have experienced that custom converters (either registered in a strategy, or specified as annotations with the AnnotationStrategy) are not supported for attributes. It seems that attributes explicitly require the use of Java primitive types. Therefore, I had to write custom getters / setters with Strings to overcome this limitation. = Unique annotation to parse Lists and Arrays, and new annotation to parse arrays of attributes (with a separator) I think that the distinction between ElementArray and ElementList is not necessary, as it is semantically the same structure of objects ( a sequence of objects) : The framework should handle transparently Arrays and List without having to specify it in the annotation. let's have a unique "ElementSequence" annotation. Also, this is a very common situation to have several values wrapped into a unique attributes, as comma separated values.<task times="2 s, 3 h, 4m" > I would like to be able to write something like AttributeSequence(name="times", separator=",")Duration[] durations; Duration being a class that provides a static "fromString(String)" method, to parse Strings. With that, the framework should be able to serialize / parse this code without the need of any other information / code. What do you think about those requests ?Some of them may be already supported : Please tell me if I missed something. Thanks again for your great work,Best regards, Raphael JOLIVET -----Inline Attachment Follows----- ------------------------------------------------------------------------------ What Every C/C++ and Fortran developer Should Know! Read this article and learn how Intel has extended the reach of its next-generation tools to help Windows* and Linux* C/C++ and Fortran developers boost performance applications - including clusters. http://p.sf.net/sfu/intel-dev2devmay -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Raphael J. <rap...@gm...> - 2011-05-19 13:10:25
|
Hello there, I am using the Simple XML framework extensively for all my XML parsing / generating tasks and I am very happy with it. However, I would like to propose some enhancements that would enable me to serialize / deserialize almost all my classes without the need of further work, except for some annotations. = Almost-primitive types First, I would like to ask for the support of "almost-primitive" types. In the Jersey REST Servlet (based on JAX-RS API), there is a convention that states : Any class providing a "public Constructor(String)" or a static method "static public fromString(String)" can be considered as a native type and is parsed, serialized without having to write a custom Converter / Mapper. The toString() method is using for serialization. This is very handy, as writing a single static method for a class is less work than writing a Converter and having to register it, or to annotate every occurrence of attributes of its type. = Only primitive types supported for attributes ? Also, I have experienced that custom converters (either registered in a strategy, or specified as annotations with the AnnotationStrategy) are not supported for attributes. It seems that attributes explicitly require the use of Java primitive types. Therefore, I had to write custom getters / setters with Strings to overcome this limitation. = Unique annotation to parse Lists and Arrays, and new annotation to parse arrays of attributes (with a separator) I think that the distinction between ElementArray and ElementList is not necessary, as it is semantically the same structure of objects ( a sequence of objects) : The framework should handle transparently Arrays and List without having to specify it in the annotation. let's have a unique "ElementSequence" annotation. Also, this is a very common situation to have several values wrapped into a unique attributes, as comma separated values. <task times="2 s, 3 h, 4m" > I would like to be able to write something like AttributeSequence(name="times", separator=",") Duration[] durations; Duration being a class that provides a static "fromString(String)" method, to parse Strings. With that, the framework should be able to serialize / parse this code without the need of any other information / code. What do you think about those requests ? Some of them may be already supported : Please tell me if I missed something. Thanks again for your great work, Best regards, Raphael JOLIVET |
|
From: Niall G. <gal...@ya...> - 2011-05-14 08:43:30
|
This is why I developed UnionList, its not dynamic, but does allow for multiple entry types.
--- On Sat, 14/5/11, Azubuko Obele <buk...@gm...> wrote:
From: Azubuko Obele <buk...@gm...>
Subject: Re: [Simple-support] Providing Extra Type Information to the Serialization Engine
To: "Niall Gallagher" <gal...@ya...>
Cc: sim...@li...
Received: Saturday, 14 May, 2011, 12:53 AM
Yes, I suspected as much. The information is not completely lost at runtime (I believe it is possible to examine the subclass and recover the generic parameters using reflection) but there will be an issue of linking up the generic specialization to a given field. I wonder if it would make sense to allow subclasses to contribute such information somehow. For example, perhaps something like:
public abstract class ItemList<T> {
@ElementList(inline = true, required = false)
private List<T> items = new ArrayList<T>();
}
@ContributeType(name="items", class=B.class)
public class BList extends ItemList<B> {
}
I'm trying to get this working locally but I'm running into a bit of trouble. I've been looking through the Traverser class and trying to figure out where exactly the serialization engine is picking up the type associated with a collection so I can inject this information but it's not clear where exactly this happens. Could you perhaps point me in the right direction?
Thanks
On Sat, May 14, 2011 at 3:32 AM, Niall Gallagher <gal...@ya...> wrote:
This is a limitation of Java. In c# and other typed languages T would be available, however Java generics are not reified, so this type information is erased at compile time. It is impossible to know what T is at runtime I am afraid.
--- On Fri, 13/5/11, Azubuko Obele <buk...@gm...> wrote:
From: Azubuko Obele <buk...@gm...>
Subject: Re: [Simple-support] Providing Extra Type Information to the Serialization Engine
To: "Niall Gallagher" <gal...@ya...>
Cc: sim...@li...
Received: Friday, 13 May, 2011, 9:16 PM
Hey Niall,
UnionList looks cool but I'm not sure how it helps me. The problem is I have a base class with a generic collection (see below). Subclasses
specialize this generic parameter but SimpleXml complains that it doesn't know the type of the inherited collection being de/serialized.
--- On Fri, 13/5/11, Azubuko Obele <buk...@gm...> wrote:
From: Azubuko Obele <buk...@gm...>
Subject: [Simple-support] Providing Extra Type Information to the Serialization Engine
To: sim...@li...
Received: Friday, 13 May, 2011, 4:55 AM
Hello,
If I have a generic class like:
public class ItemList<T> {
@ElementList(inline = true, required = false)
private List<T> items = new ArrayList<T>();
}
And then I have subclasses of this like AList extends ItemList<A> and BList extends ItemList<B> ... Simple will fail to serialize such classes because it can't determine the type of the generic property. Is there perhaps a mechanism so that I might be able to provide this information to the engine somehow?
Thanks
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Azubuko O. <buk...@gm...> - 2011-05-14 07:53:21
|
Yes, I suspected as much. The information is not completely lost at runtime
(I believe it is possible to examine the subclass and recover the generic
parameters using reflection) but there will be an issue of linking up the
generic specialization to a given field. I wonder if it would make sense to
allow subclasses to contribute such information somehow. For example,
perhaps something like:
public abstract class ItemList<T> {
@ElementList(inline = true, required = false)
private List<T> items = new ArrayList<T>();
}
@ContributeType(name="items", class=B.class)
public class BList extends ItemList<B> {
}
I'm trying to get this working locally but I'm running into a bit of
trouble. I've been looking through the Traverser class and trying to figure
out where exactly the serialization engine is picking up the type associated
with a collection so I can inject this information but it's not clear where
exactly this happens. Could you perhaps point me in the right direction?
Thanks
On Sat, May 14, 2011 at 3:32 AM, Niall Gallagher
<gal...@ya...>wrote:
> This is a limitation of Java. In c# and other typed languages T would be
> available, however Java generics are not reified, so this type information
> is erased at compile time. It is impossible to know what T is at runtime I
> am afraid.
>
>
> --- On *Fri, 13/5/11, Azubuko Obele <buk...@gm...>* wrote:
>
>
> From: Azubuko Obele <buk...@gm...>
> Subject: Re: [Simple-support] Providing Extra Type Information to the
> Serialization Engine
> To: "Niall Gallagher" <gal...@ya...>
> Cc: sim...@li...
> Received: Friday, 13 May, 2011, 9:16 PM
>
>
> Hey Niall,
>
> UnionList looks cool but I'm not sure how it helps me. The problem is I
> have a base class with a generic collection (see below). Subclasses
> specialize this generic parameter but SimpleXml complains that it doesn't
> know the type of the inherited collection being de/serialized.
>
>
>
> --- On *Fri, 13/5/11, Azubuko Obele <buk...@gm...<http://au.mc331.mail.yahoo.com/mc/compose?to=...@gm...>
> >* wrote:
>
>
> From: Azubuko Obele <buk...@gm...<http://au.mc331.mail.yahoo.com/mc/compose?to=...@gm...>
> >
> Subject: [Simple-support] Providing Extra Type Information to the
> Serialization Engine
> To: sim...@li...<http://au.mc331.mail.yahoo.com/mc/compose?to=...@li...>
> Received: Friday, 13 May, 2011, 4:55 AM
>
>
> Hello,
>
> If I have a generic class like:
>
> public class ItemList<T> {
>
> @ElementList(inline = true, required = false)
> private List<T> items = new ArrayList<T>();
>
> }
>
> And then I have subclasses of this like AList extends ItemList<A> and BList
> extends ItemList<B> ... Simple will fail to serialize such classes because
> it can't determine the type of the generic property. Is there perhaps a
> mechanism so that I might be able to provide this information to the engine
> somehow?
>
>
> Thanks
>
> -----Inline Attachment Follows-----
>
>
> ------------------------------------------------------------------------------
> Achieve unprecedented app performance and reliability
> What every C/C++ and Fortran developer should know.
> Learn how Intel has extended the reach of its next-generation tools
> to help boost performance applications - inlcuding clusters.
> http://p.sf.net/sfu/intel-dev2devmay
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> Simple-support mailing list
> Sim...@li...<http://mc/compose?to=...@li...>
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
>
|