simple-support Mailing List for Simple (Page 29)
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: Niall G. <gal...@ya...> - 2011-08-10 12:02:57
|
Hi, If you still have an issue can you demonstrate the problem in a JUnit TestCase. If there is an issue I will make sure to include the fix in the next release. Thanks, Niall --- On Tue, 9/8/11, Courtney, Phil <Phi...@sr...> wrote: From: Courtney, Phil <Phi...@sr...> Subject: RE: [Simple-support] Persister write exception To: "Niall Gallagher" <gal...@ya...>, sim...@li... Received: Tuesday, 9 August, 2011, 8:48 AM I suppose it could be a case issue. I am not really sure how the annotations work with Simple for reading and writing the xml document. An excerpt from the original xml document that was parsed correctly by Simple is below. ProviderInformation is camel case starting with a upper case letter. <spd:SolutionPackageDeployment name="A" … > … <spd:ProviderInformation> <spd:Manufacturer name="token" uuid="34d00b70-ba29-11e0-962b-0800200c9a66" /> </spd:ProviderInformation> …</spd:SolutionPackageDeployment> When parsed, Simple created an instance of a SolutionPackageDeploymentType which contains a ProviderInformation element as defined below: @Element(name = "ProviderInformation", required = true) protected ProviderInformationType providerInformation; As you can see, the name is defined in the annotation to match the case in the document, but the field name begins with a lower case letter. This is a naming convention that is used by JAXB. Since Simple does not have a compiler that will generate annotated classes from a schema, I used JAXB to generate the annotated class bindings (which we have used on our workstation and server applications), then wrote a Perl script to translate the JAXB annotations into Simple annotations for our new Android application. The naming works fine for parsing, but I get the exception when I attempt to create a document from the classes that were created by parsing the document. As a test case, I was just attempting to read a document into the annotated classes then write those classes back into a document and compare the output document with the original document. The exception seems to indicate that Element 'providerInformation' not defined in class com.sra.rtapp.spdd.SolutionPackageDeploymentType, but as you can see from the code excerpt above, it is a field in the SolutionPackageDeploymentType class. And it is parsed correctly from the original document. I tried changing the ProviderInformation element field name in the SolutionPackageDeploymentType to begin with an upper case letter as shown below: @Element(name = "ProviderInformation", required = true) protected ProviderInformationType ProviderInformation; The document still parsed correctly, and using a debugger the field name in the SolutionPackageDeploymentType instance was ProviderInformation as expected. However, I still got exactly the same error: Element 'providerInformation' not defined in class … Note the lower case beginning letter. As a final test case I tried changing the element name in the document and in the SolutionPackageDeploymentType to begin with a lower case letter – i.e. @Element(name = "providerInformation", required = true) protected ProviderInformationType providerInformation; Again, the document parsed correctly. But this time Simple was able to write the element. So it appears that Simple can correctly parse elements that begin with either case (as specified in the annotation), but can only write elements that begin with a lower case letter. Sorry for the lengthy email, but I hope this adequately describes the symptoms. Phil From: Niall Gallagher [mailto:gal...@ya...] Sent: Tuesday, August 09, 2011 3:52 AM To: sim...@li...; Courtney, Phil Subject: RE: [Simple-support] Persister write exception Are you sure this is not a case sensitivity error? Does the case of the element match? XML is case sensitive. --- On Mon, 8/8/11, Courtney, Phil <Phi...@sr...> wrote: From: Courtney, Phil <Phi...@sr...> Subject: RE: [Simple-support] Persister write exception To: "Niall Gallagher" <gal...@ya...>, sim...@li... Received: Monday, 8 August, 2011, 12:52 PMI have removed the previous email content to avoid exceeding the maximum email length. The stack trace is below: org.simpleframework.xml.core.ElementException: Element 'providerInformation' not defined in class com.sra.rtapp.spdd.SolutionPackageDeploymentType at org.simpleframework.xml.core.Composite.writeElements(Composite.java:1146) at org.simpleframework.xml.core.Composite.writeSection(Composite.java:1056) at org.simpleframework.xml.core.Composite.write(Composite.java:1026) at org.simpleframework.xml.core.Composite.write(Composite.java:1003) at org.simpleframework.xml.core.Traverser.write(Traverser.java:236) at org.simpleframework.xml.core.Traverser.write(Traverser.java:208) at org.simpleframework.xml.core.Traverser.write(Traverser.java:186) at org.simpleframework.xml.core.Persister.write(Persister.java:1187) at org.simpleframework.xml.core.Persister.write(Persister.java:1169) at org.simpleframework.xml.core.Persister.write(Persister.java:1147) at org.simpleframework.xml.core.Persister.write(Persister.java:1266) at com.sra.rtapp.spdd.SolutionPackageDeploymentDescriptor.toString(SolutionPackageDeploymentDescriptor.java:78) at com.sra.rtapp.solutionpackage.SolutionPackageDeploymentActivity.onCreate(SolutionPackageDeploymentActivity.java:34) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) at android.app.ActivityThread.access$1500(ActivityThread.java:117) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:3683) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(Native Method) I am running on Android 2.3.3. Phil |
|
From: Courtney, P. <Phi...@sr...> - 2011-08-09 15:49:02
|
I suppose it could be a case issue. I am not really sure how the
annotations work with Simple for reading and writing the xml document.
An excerpt from the original xml document that was parsed correctly by
Simple is below. ProviderInformation is camel case starting with a upper
case letter.
<spd:SolutionPackageDeployment name="A" ... >
...
<spd:ProviderInformation>
<spd:Manufacturer name="token"
uuid="34d00b70-ba29-11e0-962b-0800200c9a66" />
</spd:ProviderInformation>
...
</spd:SolutionPackageDeployment>
When parsed, Simple created an instance of a
SolutionPackageDeploymentType which contains a ProviderInformation
element as defined below:
@Element(name = "ProviderInformation", required = true)
protected ProviderInformationType providerInformation;
As you can see, the name is defined in the annotation to match the case
in the document, but the field name begins with a lower case letter.
This is a naming convention that is used by JAXB. Since Simple does not
have a compiler that will generate annotated classes from a schema, I
used JAXB to generate the annotated class bindings (which we have used
on our workstation and server applications), then wrote a Perl script to
translate the JAXB annotations into Simple annotations for our new
Android application. The naming works fine for parsing, but I get the
exception when I attempt to create a document from the classes that were
created by parsing the document. As a test case, I was just attempting
to read a document into the annotated classes then write those classes
back into a document and compare the output document with the original
document.
The exception seems to indicate that Element 'providerInformation' not
defined in class com.sra.rtapp.spdd.SolutionPackageDeploymentType, but
as you can see from the code excerpt above, it is a field in the
SolutionPackageDeploymentType class. And it is parsed correctly from the
original document.
I tried changing the ProviderInformation element field name in the
SolutionPackageDeploymentType to begin with an upper case letter as
shown below:
@Element(name = "ProviderInformation", required = true)
protected ProviderInformationType ProviderInformation;
The document still parsed correctly, and using a debugger the field name
in the SolutionPackageDeploymentType instance was ProviderInformation as
expected. However, I still got exactly the same error: Element
'providerInformation' not defined in class ... Note the lower case
beginning letter.
As a final test case I tried changing the element name in the document
and in the SolutionPackageDeploymentType to begin with a lower case
letter - i.e.
@Element(name = "providerInformation", required = true)
protected ProviderInformationType providerInformation;
Again, the document parsed correctly. But this time Simple was able to
write the element. So it appears that Simple can correctly parse
elements that begin with either case (as specified in the annotation),
but can only write elements that begin with a lower case letter.
Sorry for the lengthy email, but I hope this adequately describes the
symptoms.
Phil
From: Niall Gallagher [mailto:gal...@ya...]
Sent: Tuesday, August 09, 2011 3:52 AM
To: sim...@li...; Courtney, Phil
Subject: RE: [Simple-support] Persister write exception
Are you sure this is not a case sensitivity error? Does the case of the
element match? XML is case sensitive.
--- On Mon, 8/8/11, Courtney, Phil <Phi...@sr...> wrote:
From: Courtney, Phil <Phi...@sr...>
Subject: RE: [Simple-support] Persister write exception
To: "Niall Gallagher" <gal...@ya...>,
sim...@li...
Received: Monday, 8 August, 2011, 12:52 PM
I have removed the previous email content to avoid exceeding the maximum
email length. The stack trace is below:
org.simpleframework.xml.core.ElementException: Element
'providerInformation' not defined in class
com.sra.rtapp.spdd.SolutionPackageDeploymentType
at
org.simpleframework.xml.core.Composite.writeElements(Composite.java:1146
)
at
org.simpleframework.xml.core.Composite.writeSection(Composite.java:1056)
at org.simpleframework.xml.core.Composite.write(Composite.java:1026)
at org.simpleframework.xml.core.Composite.write(Composite.java:1003)
at org.simpleframework.xml.core.Traverser.write(Traverser.java:236)
at org.simpleframework.xml.core.Traverser.write(Traverser.java:208)
at org.simpleframework.xml.core.Traverser.write(Traverser.java:186)
at org.simpleframework.xml.core.Persister.write(Persister.java:1187)
at org.simpleframework.xml.core.Persister.write(Persister.java:1169)
at org.simpleframework.xml.core.Persister.write(Persister.java:1147)
at org.simpleframework.xml.core.Persister.write(Persister.java:1266)
at
com.sra.rtapp.spdd.SolutionPackageDeploymentDescriptor.toString(Solution
PackageDeploymentDescriptor.java:78)
at
com.sra.rtapp.solutionpackage.SolutionPackageDeploymentActivity.onCreate
(SolutionPackageDeploymentActivity.java:34)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:10
47)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:161
1)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663
)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.ja
va:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
I am running on Android 2.3.3.
Phil
|
|
From: Niall G. <gal...@ya...> - 2011-08-09 10:05:40
|
Are you sure this is not a case sensitivity error? Does the case of the element match? XML is case sensitive. --- On Mon, 8/8/11, Courtney, Phil <Phi...@sr...> wrote: From: Courtney, Phil <Phi...@sr...> Subject: RE: [Simple-support] Persister write exception To: "Niall Gallagher" <gal...@ya...>, sim...@li... Received: Monday, 8 August, 2011, 12:52 PM I have removed the previous email content to avoid exceeding the maximum email length. The stack trace is below: org.simpleframework.xml.core.ElementException: Element 'providerInformation' not defined in class com.sra.rtapp.spdd.SolutionPackageDeploymentType at org.simpleframework.xml.core.Composite.writeElements(Composite.java:1146) at org.simpleframework.xml.core.Composite.writeSection(Composite.java:1056) at org.simpleframework.xml.core.Composite.write(Composite.java:1026) at org.simpleframework.xml.core.Composite.write(Composite.java:1003) at org.simpleframework.xml.core.Traverser.write(Traverser.java:236) at org.simpleframework.xml.core.Traverser.write(Traverser.java:208) at org.simpleframework.xml.core.Traverser.write(Traverser.java:186) at org.simpleframework.xml.core.Persister.write(Persister.java:1187) at org.simpleframework.xml.core.Persister.write(Persister.java:1169) at org.simpleframework.xml.core.Persister.write(Persister.java:1147) at org.simpleframework.xml.core.Persister.write(Persister.java:1266) at com.sra.rtapp.spdd.SolutionPackageDeploymentDescriptor.toString(SolutionPackageDeploymentDescriptor.java:78) at com.sra.rtapp.solutionpackage.SolutionPackageDeploymentActivity.onCreate(SolutionPackageDeploymentActivity.java:34) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) at android.app.ActivityThread.access$1500(ActivityThread.java:117) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:3683) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(Native Method) I am running on Android 2.3.3. Phil |
|
From: Courtney, P. <Phi...@sr...> - 2011-08-08 19:52:25
|
I have removed the previous email content to avoid exceeding the maximum email length. The stack trace is below:
org.simpleframework.xml.core.ElementException: Element 'providerInformation' not defined in class com.sra.rtapp.spdd.SolutionPackageDeploymentType
at org.simpleframework.xml.core.Composite.writeElements(Composite.java:1146)
at org.simpleframework.xml.core.Composite.writeSection(Composite.java:1056)
at org.simpleframework.xml.core.Composite.write(Composite.java:1026)
at org.simpleframework.xml.core.Composite.write(Composite.java:1003)
at org.simpleframework.xml.core.Traverser.write(Traverser.java:236)
at org.simpleframework.xml.core.Traverser.write(Traverser.java:208)
at org.simpleframework.xml.core.Traverser.write(Traverser.java:186)
at org.simpleframework.xml.core.Persister.write(Persister.java:1187)
at org.simpleframework.xml.core.Persister.write(Persister.java:1169)
at org.simpleframework.xml.core.Persister.write(Persister.java:1147)
at org.simpleframework.xml.core.Persister.write(Persister.java:1266)
at com.sra.rtapp.spdd.SolutionPackageDeploymentDescriptor.toString(SolutionPackageDeploymentDescriptor.java:78)
at com.sra.rtapp.solutionpackage.SolutionPackageDeploymentActivity.onCreate(SolutionPackageDeploymentActivity.java:34)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
I am running on Android 2.3.3.
Phil
|
|
From: Bram V. <br...@br...> - 2011-08-08 18:58:29
|
Hey all, I'm guessing there is a way of doing this, but I just can't figure out how. The question, and all of the information, can be viewed at stackoverflow: http://stackoverflow.com/questions/6932250/how-to-avoid-serializing-zero-values-with-simple-xml Any response is appreciated. kind regards, Bram Vandenbussche // www.bramensofie.be // +32 497 21 33 04 |
|
From: Niall G. <gal...@ya...> - 2011-08-06 00:41:03
|
I ant tell, I need the full stack trace.
--- On Fri, 5/8/11, Courtney, Phil <Phi...@sr...> wrote:
From: Courtney, Phil <Philip_Courtney@sra.c>
Subject: [Simple-support] Persister write exception
To: sim...@li...
Received: Friday, 5 August, 2011, 10:03 AM
I am getting the following error when I attempt to write an XML document: ERROR/SolutionPackageDeploymentDescriptor(335): serializer.write exception Element 'providerInformation' not defined in class com.sra.rtapp.spdd.SolutionPackageDeploymentType My test scenario is to read an xml document into a set of classes using Simple framework annotations. The document parses successfully and the classes created are correct. I then attempt to write that set of classes and get the exception. Code excerpts from the SolutionPackageDeploymentDescriptor classes are shown below: public class SolutionPackageDeploymentDescriptor{ … private SolutionPackageDeploymentType itsSolutionPackageDeployment; // the root element public SolutionPackageDeploymentDescriptor( InputStream aInputStream ) throws Exception { Serializer serializer = new Persister(); try {
itsSolutionPackageDeployment = serializer.read( SolutionPackageDeploymentType.class, aInputStream, false ); } catch (Exception exception) { Log.e( TAG, exception.getMessage() ); throw( exception ); } } … public String toString() { Serializer serializer = new Persister(); StringWriter xmlWriter = new StringWriter(); try { serializer.write( itsSolutionPackageDeployment, xmlWriter ); } catch (Exception exception) { Log.e( TAG, "serializer.write exception " + exception.getMessage() ); xmlWriter.append( "serializer.write exception " + exception.getMessage() ); } return xmlWriter.toString(); }} Code excerpts from the SolutionPackageDeploymentType are included below: public class
SolutionPackageDeploymentType extends UniversallyIdentifiedType{ @Element(name = "ProviderInformation", required = true) protected ProviderInformationType providerInformation; … /** * Gets the value of the providerInformation property. * * @return * possible object is * {@link ProviderInformationType } * */ public ProviderInformationType getProviderInformation() { return providerInformation; } /** * Sets the value of the providerInformation property. * * @param value * allowed object is * {@link ProviderInformationType } * */ public void setProviderInformation(ProviderInformationType value) { this.providerInformation = value; } …} Inspecting the variables with a debugger I confirmed that
itsSolutionPackageDeployment providerInformation does contain an instance of ProviderInformationType and its contents are correct. What is causing the write exception? Why can’t the Persister write method recognize providerInformation? Your help is appreciated,Phil
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Courtney, P. <Phi...@sr...> - 2011-08-05 17:03:09
|
I am getting the following error when I attempt to write an XML
document:
ERROR/SolutionPackageDeploymentDescriptor(335): serializer.write
exception Element 'providerInformation' not defined in class
com.sra.rtapp.spdd.SolutionPackageDeploymentType
My test scenario is to read an xml document into a set of classes using
Simple framework annotations. The document parses successfully and the
classes created are correct. I then attempt to write that set of classes
and get the exception.
Code excerpts from the SolutionPackageDeploymentDescriptor classes are
shown below:
public class SolutionPackageDeploymentDescriptor
{
...
private SolutionPackageDeploymentType itsSolutionPackageDeployment;
// the root element
public SolutionPackageDeploymentDescriptor( InputStream aInputStream
)
throws Exception
{
Serializer serializer = new Persister();
try
{
itsSolutionPackageDeployment =
serializer.read( SolutionPackageDeploymentType.class,
aInputStream, false );
}
catch (Exception exception)
{
Log.e( TAG, exception.getMessage() );
throw( exception );
}
}
...
public String toString()
{
Serializer serializer = new Persister();
StringWriter xmlWriter = new StringWriter();
try
{
serializer.write( itsSolutionPackageDeployment, xmlWriter );
}
catch (Exception exception)
{
Log.e( TAG, "serializer.write exception " +
exception.getMessage() );
xmlWriter.append( "serializer.write exception " +
exception.getMessage() );
}
return xmlWriter.toString();
}
}
Code excerpts from the SolutionPackageDeploymentType are included below:
public class SolutionPackageDeploymentType
extends UniversallyIdentifiedType
{
@Element(name = "ProviderInformation", required = true)
protected ProviderInformationType providerInformation;
...
/**
* Gets the value of the providerInformation property.
*
* @return
* possible object is
* {@link ProviderInformationType }
*
*/
public ProviderInformationType getProviderInformation() {
return providerInformation;
}
/**
* Sets the value of the providerInformation property.
*
* @param value
* allowed object is
* {@link ProviderInformationType }
*
*/
public void setProviderInformation(ProviderInformationType value) {
this.providerInformation = value;
}
...
}
Inspecting the variables with a debugger I confirmed that
itsSolutionPackageDeployment providerInformation does contain an
instance of ProviderInformationType and its contents are correct.
What is causing the write exception? Why can't the Persister write
method recognize providerInformation?
Your help is appreciated,
Phil
|
|
From: Niall G. <gal...@ya...> - 2011-08-05 08:29:24
|
Remove @Path("/") it will work then
--- On Thu, 4/8/11, Rosczak, Jan <Jan...@hl...> wrote:
> From: Rosczak, Jan <Jan...@hl...>
> Subject: [Simple-support] Dupliate attributes, but different xpaths
> To: "sim...@li..." <sim...@li...>
> Received: Thursday, 4 August, 2011, 11:03 PM
> Hello,
>
> I would like to map the following XML
>
>
> <application name='SpecialApplication'>
> <system value='SPECIAL_SYSTEM' />
> <tranCode value='X3320' />
> </application>
>
> to the Java class
>
> @Root(name = "application")
> public class Application {
> @Attribute()
> @Path("/")
> private String name;
>
> @Path("system")
> @Attribute(name = "value")
> private String system;
>
> @Path("tranCode")
> @Attribute(name = "value")
> private String transactionCode;
>
> But, that does not work.
>
> First of all is the root path in the @Path annotation not
> supported, maybe there is another way to reference the root
> element?
>
> Then the framework complaints about the duplicate attribute
> "value" although I would think that the attributes reference
> different elements as denoted by the @Path annotation.
>
> Can this XML be mapped at all?
>
> Thanks and kind regards
>
> Jan Rosczak
> IT Architect
> Development Methods, Frameworks & Tools
> __________________________________
>
> Hapag-Lloyd AG
> Ballindamm 25
> D-20095 Hamburg
>
> Phone +49 (40) 3001- 2983
> Fax +49 (40) 3001- 2942
> Mail jan...@hl...
>
>
> http://www.hapag-lloyd.com
>
> Vorsitzender des Aufsichtsrats: Dr. Michael Frenzel
> Vorstand: Michael Behrendt (Vorsitzender), Peter Ganz,
> Ulrich Kranich, Jesper Praestensgaard
> Sitz: Hamburg, Handelsregister: Amtsgericht Hamburg HRB
> 97937
>
> Chairman of the Supervisory Board: Dr. Michael Frenzel
> Executive Board: Michael Behrendt (Chairman), Peter Ganz,
> Ulrich Kranich, Jesper Praestensgaard
> Registered Seat: Hamburg, Company Register: Amtsgericht
> Hamburg HRB 97937
>
>
> ------------------------------------------------------------------------------
> BlackBerry® DevCon Americas, Oct. 18-20, San
> Francisco, CA
> The must-attend event for mobile developers. Connect with
> experts.
> Get tools for creating Super Apps. See the latest
> technologies.
> Sessions, hands-on labs, demos & much more. Register
> early & save!
> http://p.sf.net/sfu/rim-blackberry-1
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|
|
From: Rosczak, J. <Jan...@hl...> - 2011-08-05 06:04:18
|
Hello,
I would like to map the following XML
<application name='SpecialApplication'>
<system value='SPECIAL_SYSTEM' />
<tranCode value='X3320' />
</application>
to the Java class
@Root(name = "application")
public class Application {
@Attribute()
@Path("/")
private String name;
@Path("system")
@Attribute(name = "value")
private String system;
@Path("tranCode")
@Attribute(name = "value")
private String transactionCode;
But, that does not work.
First of all is the root path in the @Path annotation not supported, maybe there is another way to reference the root element?
Then the framework complaints about the duplicate attribute "value" although I would think that the attributes reference different elements as denoted by the @Path annotation.
Can this XML be mapped at all?
Thanks and kind regards
Jan Rosczak
IT Architect
Development Methods, Frameworks & Tools
__________________________________
Hapag-Lloyd AG
Ballindamm 25
D-20095 Hamburg
Phone +49 (40) 3001- 2983
Fax +49 (40) 3001- 2942
Mail jan...@hl...
http://www.hapag-lloyd.com
Vorsitzender des Aufsichtsrats: Dr. Michael Frenzel
Vorstand: Michael Behrendt (Vorsitzender), Peter Ganz, Ulrich Kranich, Jesper Praestensgaard
Sitz: Hamburg, Handelsregister: Amtsgericht Hamburg HRB 97937
Chairman of the Supervisory Board: Dr. Michael Frenzel
Executive Board: Michael Behrendt (Chairman), Peter Ganz, Ulrich Kranich, Jesper Praestensgaard
Registered Seat: Hamburg, Company Register: Amtsgericht Hamburg HRB 97937
|
|
From: <sen...@gm...> - 2011-08-02 22:37:08
|
Hello! I use Simple to serialize Java code to XML. How can I create this typical first-line of an XML document, where it says version x and encoding y? Like this: <?xml version="1.0" encoding="UTF-8"?> Is there any special annotation or argument for that? I work with the code from the website's tutorial section. Tnx & cu Bernd -- NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie! Jetzt informieren: http://www.gmx.net/de/go/freephone |
|
From: Rosczak, J. <Jan...@hl...> - 2011-08-02 12:40:43
|
Hi,
thanks a lot.
Would it be possible to have an equivalent to the "attribute" property of the ElementMap annotation on the ElementList annotation?
This would enable parsing an XML such as the following without the need of a helper class:
<specificationTable title="Field Descriptions" autoNumber="true">
<heading name="Label Name"/>
<heading name="Label Name 2"/>
<heading name="Label Name 3"/>
</specificationTable>
// Jan
P.S.: I could provide a patch if needed and desired
-----Original Message-----
From: Niall Gallagher [mailto:gal...@ya...]
Sent: Tuesday, August 02, 2011 1:33 PM
To: sim...@li...; Rosczak, Jan
Subject: Re: [Simple-support] How to reference attributes with path expression?
Hi,
Do this
@Path("heading")
@Attribute
private String name;
This will work.
Niall
--- On Tue, 2/8/11, Rosczak, Jan <Jan...@hl...> wrote:
> From: Rosczak, Jan <Jan...@hl...>
> Subject: [Simple-support] How to reference attributes with path expression?
> To: "sim...@li..." <sim...@li...>
> Received: Tuesday, 2 August, 2011, 3:33 AM
> Hello,
>
> I am just starting to work with the Simple framework and
> have a problem understanding the @Path annotation.
>
> My xml looks like:
>
> <specificationTable title="Field Descriptions"
> autoNumber="true">
> <heading name="Label Name"/>
> </specificationTable>
>
> Is this possible somehow:
> public class SpecificationTable {
> @Path(value = "heading/@name")
> private String heading;
> }
>
> If yes, would this work for more than one heading element,
> so could I annotate a list with it?
>
> Thanks in advance.
>
> Kind regards
>
>
> Jan Rosczak
> IT Architect
> Development Methods, Frameworks & Tools
> __________________________________
>
> Hapag-Lloyd AG
> Ballindamm 25
> D-20095 Hamburg
>
> Phone +49 (40) 3001- 2983
> Fax +49 (40)
> 3001- 2942
> Mail jan...@hl...
>
>
> http://www.hapag-lloyd.com
>
> Vorsitzender des Aufsichtsrats: Dr. Michael Frenzel
> Vorstand: Michael Behrendt (Vorsitzender), Peter Ganz,
> Ulrich Kranich, Jesper Praestensgaard
> Sitz: Hamburg, Handelsregister: Amtsgericht Hamburg HRB
> 97937
>
> Chairman of the Supervisory Board: Dr. Michael Frenzel
> Executive Board: Michael Behrendt (Chairman), Peter Ganz,
> Ulrich Kranich, Jesper Praestensgaard Registered Seat:
> Hamburg, Company Register: Amtsgericht Hamburg HRB 97937
>
>
> ------------------------------------------------------------------------------
> BlackBerry® DevCon Americas, Oct. 18-20, San
> Francisco, CA
> The must-attend event for mobile developers. Connect with
> experts.
> Get tools for creating Super Apps. See the latest
> technologies.
> Sessions, hands-on labs, demos & much more. Register
> early & save!
> http://p.sf.net/sfu/rim-blackberry-1
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|
|
From: Niall G. <gal...@ya...> - 2011-08-02 11:32:47
|
Hi,
Do this
@Path("heading")
@Attribute
private String name;
This will work.
Niall
--- On Tue, 2/8/11, Rosczak, Jan <Jan...@hl...> wrote:
> From: Rosczak, Jan <Jan...@hl...>
> Subject: [Simple-support] How to reference attributes with path expression?
> To: "sim...@li..." <sim...@li...>
> Received: Tuesday, 2 August, 2011, 3:33 AM
> Hello,
>
> I am just starting to work with the Simple framework and
> have a problem understanding the @Path annotation.
>
> My xml looks like:
>
> <specificationTable title="Field Descriptions"
> autoNumber="true">
> <heading name="Label Name"/>
> </specificationTable>
>
> Is this possible somehow:
> public class SpecificationTable {
> @Path(value = "heading/@name")
> private String heading;
> }
>
> If yes, would this work for more than one heading element,
> so could I annotate a list with it?
>
> Thanks in advance.
>
> Kind regards
>
>
> Jan Rosczak
> IT Architect
> Development Methods, Frameworks & Tools
> __________________________________
>
> Hapag-Lloyd AG
> Ballindamm 25
> D-20095 Hamburg
>
> Phone +49 (40) 3001- 2983
> Fax +49 (40)
> 3001- 2942
> Mail jan...@hl...
>
>
> http://www.hapag-lloyd.com
>
> Vorsitzender des Aufsichtsrats: Dr. Michael Frenzel
> Vorstand: Michael Behrendt (Vorsitzender), Peter Ganz,
> Ulrich Kranich, Jesper Praestensgaard
> Sitz: Hamburg, Handelsregister: Amtsgericht Hamburg HRB
> 97937
>
> Chairman of the Supervisory Board: Dr. Michael Frenzel
> Executive Board: Michael Behrendt (Chairman), Peter Ganz,
> Ulrich Kranich, Jesper Praestensgaard Registered Seat:
> Hamburg, Company Register: Amtsgericht Hamburg HRB 97937
>
>
> ------------------------------------------------------------------------------
> BlackBerry® DevCon Americas, Oct. 18-20, San
> Francisco, CA
> The must-attend event for mobile developers. Connect with
> experts.
> Get tools for creating Super Apps. See the latest
> technologies.
> Sessions, hands-on labs, demos & much more. Register
> early & save!
> http://p.sf.net/sfu/rim-blackberry-1
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|
|
From: Rosczak, J. <Jan...@hl...> - 2011-08-02 11:24:19
|
Hello,
I am just starting to work with the Simple framework and have a problem understanding the @Path annotation.
My xml looks like:
<specificationTable title="Field Descriptions" autoNumber="true">
<heading name="Label Name"/>
</specificationTable>
Is this possible somehow:
public class SpecificationTable {
@Path(value = "heading/@name")
private String heading;
}
If yes, would this work for more than one heading element, so could I annotate a list with it?
Thanks in advance.
Kind regards
Jan Rosczak
IT Architect
Development Methods, Frameworks & Tools
__________________________________
Hapag-Lloyd AG
Ballindamm 25
D-20095 Hamburg
Phone +49 (40) 3001- 2983
Fax +49 (40) 3001- 2942
Mail jan...@hl...
http://www.hapag-lloyd.com
Vorsitzender des Aufsichtsrats: Dr. Michael Frenzel
Vorstand: Michael Behrendt (Vorsitzender), Peter Ganz, Ulrich Kranich, Jesper Praestensgaard
Sitz: Hamburg, Handelsregister: Amtsgericht Hamburg HRB 97937
Chairman of the Supervisory Board: Dr. Michael Frenzel Executive Board: Michael Behrendt (Chairman), Peter Ganz, Ulrich Kranich, Jesper Praestensgaard Registered Seat: Hamburg, Company Register: Amtsgericht Hamburg HRB 97937
|
|
From: Niall G. <gal...@ya...> - 2011-08-02 09:52:12
|
I will try to recreate this in a test case, if there is a bug it will be fixed in the next release.
--- On Sat, 23/7/11, Mogens Hvidtfeldt <mo...@hv...> wrote:
> From: Mogens Hvidtfeldt <mo...@hv...>
> Subject: [Simple-support] Exception when using @version on derived class (on Android)
> To: sim...@li...
> Received: Saturday, 23 July, 2011, 11:38 AM
>
> I have a base class that is serialized (but has no version
> attribute):
>
> @Root
> public abstract class BaseLayerType implements ILayerType
> {
>
> @Element
> private Plate plate;
> .....
>
>
> And a derived class that where I have added an version
> member with the
> @Version attribute
>
> @Root
> public class PrimCollLayerType extends BaseLayerType {
>
> @Version(revision=1.1)
> private double version;
>
> @Element
> int primType =
> PrimCollLayerData.PRIMITIVE_TAG;
> ....
>
>
> This will cause following exception when I deserialize:
>
> 07-23 20:26:55.240: ERROR/ColonyCount(23073):
> java.lang.NullPointerException
> 07-23 20:26:55.240: ERROR/ColonyCount(23073):
> at
> org.simpleframework.xml.core.Composite.readVersion(Composite.java:417)
> 07-23 20:26:55.240: ERROR/ColonyCount(23073):
> at
> org.simpleframework.xml.core.Composite.read(Composite.java:366)
> 07-23 20:26:55.240: ERROR/ColonyCount(23073):
> at
> org.simpleframework.xml.core.Composite.readDefault(Composite.java:262)
>
> --
> View this message in context: http://old.nabble.com/Exception-when-using-%40version-on-derived-class-%28on-Android%29-tp32122791p32122791.html
> Sent from the Simple XML Serialization mailing list archive
> at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> BlackBerry® DevCon Americas, Oct. 18-20, San
> Francisco, CA
> The must-attend event for mobile developers. Connect with
> experts.
> Get tools for creating Super Apps. See the latest
> technologies.
> Sessions, hands-on labs, demos & much more. Register
> early & save!
> http://p.sf.net/sfu/rim-blackberry-1
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|
|
From: Niall G. <gal...@ya...> - 2011-08-02 09:49:59
|
See the @Default annotation, there is some examples in the test cases. --- On Sun, 17/7/11, "Jan Leßner" <jle...@gm...> wrote: > From: "Jan Leßner" <jle...@gm...> > Subject: [Simple-support] Changing default interpretation > To: sim...@li... > Received: Sunday, 17 July, 2011, 8:24 AM > Hi everybody > We would like to use Simple to map XML structures from a > BPM tool to Java beans. The BPM tool passes all attributes > within XML elements, so I'd like to know if there is a way > to change Simple's defaults for mapping class members to > XML. The default is - of course - attribute rather than > element, so we had to annotate every single Java class > member with @Element. Is there a way to make this the > default? > > Regards, > Jan Lessner > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San > Francisco, CA > The must-attend event for mobile developers. Connect with > experts. > Get tools for creating Super Apps. See the latest > technologies. > Sessions, hands-on labs, demos & much more. Register > early & save! > http://p.sf.net/sfu/rim-blackberry-1 > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > |
|
From: Niall G. <gal...@ya...> - 2011-08-02 09:46:28
|
@ElementList(name = "Content", required = true, inline = true) will work, the inline attribute is needed.
--- On Mon, 1/8/11, Courtney, Phil <Phi...@sr...> wrote:
From: Courtney, Phil <Phi...@sr...>
Subject: [Simple-support] Reading a list of elements
To: sim...@li...
Received: Monday, 1 August, 2011, 11:14 AM
I am in the process of converting from JAXB generated classes (which we have used on workstations and servers) to Simple for use in an Android application (since JAXB is not supported on Android). I have tried to follow the tutorial for Reading a list of elements. An excerpt of the document’s root element is below: @Root@Order( elements = { "providerInformation", "contents", "constraints", "dependencies", "installableComponents", "configurationInformation", "maintenanceInformation", "modificationInformation", "uninstallInformation"})public class SolutionPackageDeploymentType extends UniversallyIdentifiedType{ … @Element(name = "Contents", required = true) protected ContentsType contents; …} The ContentsType class with an ElementList is below: @Rootpublic class ContentsType { @ElementList(name = "Content", required = true) protected
List<ContentType> content; public List<ContentType> getContent() { if (content == null) { content = new ArrayList<ContentType>(); } return this.content; }} An excerpt of the Content class for the element contained in the list is below: @Rootpublic class ContentType { @Attribute(required = true) protected String uuid; @Attribute(required = true) protected String pathName; @Attribute(required = true) protected String purpose; @Attribute(required = false) protected BigInteger length; @Attribute(required = false) protected String digestMethod; @Attribute(required = false) protected String digestValue; …} An excerpt of the example XML is below: <spd:SolutionPackageDeployment … xsi:schemaLocation="http://www.sra.com/rtapp/spdd SolutionPackageDeploymentV0.xsd"
xmlns:spd="http://www.sra.com/rtapp/spdd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> … <spd:Contents> <spd:Content uuid="34d00b71-ba29-11e0-962b-0800200c9a66" purpose="DATA_FILE" pathName="F1"/> <spd:Content uuid="34d00b72-ba29-11e0-962b-0800200c9a66" purpose="DATA_FILE" pathName="F2"/> </spd:Contents> …</spd:SolutionPackageDeployment> When I attempt to read the XML document, I get the following error message: Element 'Content' declared twice at line 10 Any suggestions on how to resolve the error would be greatly appreciated.Phil
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Niall G. <gal...@ya...> - 2011-08-02 09:44:15
|
You need to write a Transformer to handle this as an attribute. There are examples in the tutorial and in the test cases. --- On Mon, 1/8/11, Courtney, Phil <Phi...@sr...> wrote: From: Courtney, Phil <Phi...@sr...> Subject: [Simple-support] Transforming XML schema xs:dateTime type To: sim...@li... Received: Monday, 1 August, 2011, 10:25 AM We have been using JAXB on workstations and servers to read and write XML documents. We are now trying to use the Simple Framework to read the same XML documents from an Android application (since JAXB is not supported on Android). In JAXB, a XML xs: dateTime type attribute is transformed with a XMLGregorianCalendar class. When I try to use the XMLGregorianCalendar class with the Simple Framework as shown below: @Attribute(required = true) protected XMLGregorianCalendar lastModified; I get the following error: Cannot use @org.simpleframework.xml.Attribute(empty=, name=, required=true) to represent field ‘lastModified’ protected javax.xml.datatype.XMLGregorianCalendar. How can I use the Simple Framework to work with a xs:dateTime attribute? Since this is one of the built-in types, it seems like it should be straightforward. I tried using GregorianCalendar, but that class could not parse the time part. Thanks,Phil -----Inline Attachment Follows----- ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Courtney, P. <Phi...@sr...> - 2011-08-01 18:14:13
|
I am in the process of converting from JAXB generated classes (which we
have used on workstations and servers) to Simple for use in an Android
application (since JAXB is not supported on Android).
I have tried to follow the tutorial for Reading a list of elements. An
excerpt of the document's root element is below:
@Root
@Order( elements = {
"providerInformation",
"contents",
"constraints",
"dependencies",
"installableComponents",
"configurationInformation",
"maintenanceInformation",
"modificationInformation",
"uninstallInformation"
})
public class SolutionPackageDeploymentType
extends UniversallyIdentifiedType
{
...
@Element(name = "Contents", required = true)
protected ContentsType contents;
...
}
The ContentsType class with an ElementList is below:
@Root
public class ContentsType {
@ElementList(name = "Content", required = true)
protected List<ContentType> content;
public List<ContentType> getContent() {
if (content == null) {
content = new ArrayList<ContentType>();
}
return this.content;
}
}
An excerpt of the Content class for the element contained in the list is
below:
@Root
public class ContentType {
@Attribute(required = true)
protected String uuid;
@Attribute(required = true)
protected String pathName;
@Attribute(required = true)
protected String purpose;
@Attribute(required = false)
protected BigInteger length;
@Attribute(required = false)
protected String digestMethod;
@Attribute(required = false)
protected String digestValue;
...
}
An excerpt of the example XML is below:
<spd:SolutionPackageDeployment ...
xsi:schemaLocation="http://www.sra.com/rtapp/spdd
SolutionPackageDeploymentV0.xsd"
xmlns:spd="http://www.sra.com/rtapp/spdd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
<spd:Contents>
<spd:Content
uuid="34d00b71-ba29-11e0-962b-0800200c9a66" purpose="DATA_FILE"
pathName="F1"/>
<spd:Content
uuid="34d00b72-ba29-11e0-962b-0800200c9a66" purpose="DATA_FILE"
pathName="F2"/>
</spd:Contents>
...
</spd:SolutionPackageDeployment>
When I attempt to read the XML document, I get the following error
message:
Element 'Content' declared twice at line 10
Any suggestions on how to resolve the error would be greatly
appreciated.
Phil
|
|
From: Courtney, P. <Phi...@sr...> - 2011-08-01 17:26:03
|
We have been using JAXB on workstations and servers to read and write
XML documents. We are now trying to use the Simple Framework to read the
same XML documents from an Android application (since JAXB is not
supported on Android).
In JAXB, a XML xs: dateTime type attribute is transformed with a
XMLGregorianCalendar class. When I try to use the XMLGregorianCalendar
class with the Simple Framework as shown below:
@Attribute(required = true)
protected XMLGregorianCalendar lastModified;
I get the following error:
Cannot use @org.simpleframework.xml.Attribute(empty=, name=,
required=true) to represent field 'lastModified' protected
javax.xml.datatype.XMLGregorianCalendar.
How can I use the Simple Framework to work with a xs:dateTime attribute?
Since this is one of the built-in types, it seems like it should be
straightforward. I tried using GregorianCalendar, but that class could
not parse the time part.
Thanks,
Phil
|
|
From: Courtney, P. <Phi...@sr...> - 2011-07-30 00:37:00
|
In JAXB, a XML xs: dateTime type attribute is transformed with a
XMLGregorianCalendar class. When I try to use the XMLGregorianCalendar
class with the Simple Framework as shown below:
@Attribute(required = true)
protected XMLGregorianCalendar lastModified;
I get the following error:
Cannot use @org.simpleframework.xml.Attriture(empty=, name=,
required=true) to represent field 'lastModified' protected
javax.xml.datatype.XMLGregorianCalendar.
How can I use the Simple Framework to work with a xs:dateTime attribute?
Since this is one of the built-in types, it seems like it should be
straightforward. I tried using GregorianCalendar, but that class could
not parse the time part.
Thanks,
Phil
|
|
From: Crundy 12 <cru...@gm...> - 2011-07-27 15:22:13
|
On Fri, Jul 22, 2011 at 10:03 AM, Crundy 12 <cru...@gm...> wrote: > On Thu, Jul 21, 2011 at 10:50 AM, Niall Gallagher > <gal...@ya...> wrote: >> >> Hi, >> >> Your annotations look wrong, @Element does not work with classes, it works only with fields and methods. Instead use @Root for classes. Also, the @ElementList needs to have the name of "enemies" not "enemy". Take a look at the tutorial http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php. >> >> Regards, >> Niall > > Thanks, I did try changing Enemy to use root instead and changed the > ElementList annotation to "enemies" but now I get: > > 07-22 09:04:49.882: WARN/System.err(395): > org.simpleframework.xml.core.ElementException: Element 'enemy' does > not have a match in class my.package.name.Enemies at line 3 > > New code: > > @Root > public class Enemies { > @ElementList(name="enemies") > private List<Enemy> enemyList; > public List<Enemy> getEnemies(){return this.enemyList;} > } > > @Root(name="enemy") > public class Enemy { > @Attribute(name="type") > private int type; > public int getType(){return this.type;} > --etc-- > > Tried naming the enemies class as well: > @Root(name="enemies") > Same error. Anyone? |
|
From: Mogens H. <mo...@hv...> - 2011-07-23 18:38:46
|
I have a base class that is serialized (but has no version attribute):
@Root
public abstract class BaseLayerType implements ILayerType {
@Element
private Plate plate;
.....
And a derived class that where I have added an version member with the
@Version attribute
@Root
public class PrimCollLayerType extends BaseLayerType {
@Version(revision=1.1)
private double version;
@Element
int primType = PrimCollLayerData.PRIMITIVE_TAG;
....
This will cause following exception when I deserialize:
07-23 20:26:55.240: ERROR/ColonyCount(23073): java.lang.NullPointerException
07-23 20:26:55.240: ERROR/ColonyCount(23073): at
org.simpleframework.xml.core.Composite.readVersion(Composite.java:417)
07-23 20:26:55.240: ERROR/ColonyCount(23073): at
org.simpleframework.xml.core.Composite.read(Composite.java:366)
07-23 20:26:55.240: ERROR/ColonyCount(23073): at
org.simpleframework.xml.core.Composite.readDefault(Composite.java:262)
--
View this message in context: http://old.nabble.com/Exception-when-using-%40version-on-derived-class-%28on-Android%29-tp32122791p32122791.html
Sent from the Simple XML Serialization mailing list archive at Nabble.com.
|
|
From: Mogens H. <mo...@hv...> - 2011-07-23 18:15:43
|
Thanks - This was exactly the problem. Default constructors fixed the issue.
mogens
Niall Gallagher-2 wrote:
>
> Does the type have a no argument constructor? If it does and it still does
> not work can you send me the problem as observed in a JUnit test. I will
> investigate and fix then.
>
> Thanks,
> Niall
>
> --- On Mon, 11/7/11, Mogens Hvidtfeldt <mo...@hv...> wrote:
>
>> From: Mogens Hvidtfeldt <mo...@hv...>
>> Subject: [Simple-support] CycleException: Invalid reference exception
>> that i dont understand
>> To: sim...@li...
>> Received: Monday, 11 July, 2011, 2:01 PM
>>
>> I am hitting the invalid reference exception when i read an
>> xml. The xml was
>> created by Simple framework using the CycleStrategy but is
>> fails when I try
>> to deserialize file.
>>
>> // This is how I read the file
>> Strategy cycleStrategry = new CycleStrategy("id", "ref");
>> Strategy annotationStrategy = new
>> AnnotationStrategy(cycleStrategry);
>> Serializer s = new Persister(annotationStrategy);
>> s.read(Project.class, file, false);
>>
>> // This is the xml I am trying to read
>> <project id="0">
>> <uuid
>> id="1">09611242-348c-4224-bdeb-008d4499c09e</uuid>
>> <createdDate id="2">2011-07-11
>> 22:34:41.326 GMT+02:00</createdDate>
>> <name
>> id="3">undefined</name>
>> <plates class="java.util.ArrayList"
>> id="4">
>> <plate id="5">
>> <project
>> ref="0"/>
>> <images
>> class="java.util.ArrayList" id="6">
>> <image
>> id="7">
>>
>> <createdDate id="8">2011-07-11
>> 22:34:46.502
>> GMT+02:00</createdDate>
>>
>> <id
>> id="9">d56bfad7-ed89-4c65-ba7f-35bfce7e115f</id>
>>
>> <plate ref="5"/>
>> </image>
>> </images>
>> <name
>> id="10">Plate A</name>
>> <id
>> id="11">-1</id>
>>
>> <referenceLayerIndex
>> id="12">0</referenceLayerIndex>
>> </plate>
>> </plates>
>> <results class="java.util.ArrayList"
>> id="13">
>> <result
>> class="com.ToolboxFactory.ColonyCount.Result.SampleConcentrationResult"
>> id="14">
>> <transfers
>> class="java.util.ArrayList" id="15"/>
>> </result>
>> <result
>> class="com.ToolboxFactory.ColonyCount.Result.TagRatioResult"
>> id="16">
>> <project
>> ref="0"/>
>> </result>
>> </results>
>> <autoSave
>> id="17">false</autoSave>
>> </project>
>>
>> // This is the exception i get
>> org.simpleframework.xml.strategy.CycleException: Invalid
>> reference '5' found
>>
>> But reference 5 should be valid and the type of the
>> <plate id="5"> class is
>> the same as the one defined in the property <plate
>> ref="5"/> (otherwise the
>> serialization would not have defined the reference).
>>
>> Any ideas would be appreciated
>>
>> --
>> View this message in context:
>> http://old.nabble.com/CycleException%3A-Invalid-reference-exception-that-i-dont-understand-tp32041293p32041293.html
>> Sent from the Simple XML Serialization mailing list archive
>> at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> AppSumo Presents a FREE Video for the SourceForge Community
>> by Eric
>> Ries, the creator of the Lean Startup Methodology on "Lean
>> Startup
>> Secrets Revealed." This video shows you how to validate
>> your ideas,
>> optimize your ideas and identify your business strategy.
>> http://p.sf.net/sfu/appsumosfdev2dev
>> _______________________________________________
>> Simple-support mailing list
>> Sim...@li...
>> https://lists.sourceforge.net/lists/listinfo/simple-support
>>
>
> ------------------------------------------------------------------------------
> AppSumo Presents a FREE Video for the SourceForge Community by Eric
> Ries, the creator of the Lean Startup Methodology on "Lean Startup
> Secrets Revealed." This video shows you how to validate your ideas,
> optimize your ideas and identify your business strategy.
> http://p.sf.net/sfu/appsumosfdev2dev
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
--
View this message in context: http://old.nabble.com/CycleException%3A-Invalid-reference-exception-that-i-dont-understand-tp32041293p32122685.html
Sent from the Simple XML Serialization mailing list archive at Nabble.com.
|
|
From: Stefanato F. (K. 2) <fed...@cr...> - 2011-07-22 15:34:29
|
Yes, sure.
As far as I could figured out, enums are not currently supporting
versioning.
public MyClass {
@Version(revision=1.1)
private double version;
@Attribute
MyEnum myEnum;
//...
}
When MyEnum change one of its values from A_VALUE to ANOTHER_VALUE (i.e.
A_VALUE doesn't exist anymore), I got a serialization exception (it
obviously could not fit A_VALUE anymore in the enum), regardless the
fact that MyClass changed its version.
Hence, I suppose that @Version with target TYPE, should solve this issue
by annotating the enum.
@Version(revision=1.3)
MyEnum {
//...
}
Moreover, an enum can implement a @Version annotated empty interface and
easily be version-aware itself, I guess.
@Version(revision=2.0)
public interface XmlSerializable {}
MyEnum implements XmlSerializable {
//...
}
Please, let me know if I need to be more clear or I misunderstood
something.
Thanks.
Regards,
federico
-----Original Message-----
From: Niall Gallagher [mailto:gal...@ya...]
Sent: Friday, July 22, 2011 4:57 PM
To: sim...@li...; Stefanato Federico (KGRQ 2)
Subject: RE: [Simple-support] Extended @Version
Hi,
I am not sure I understand the question, could you elaborate?
Thanks,
Niall
--- On Thu, 21/7/11, Stefanato Federico (KGRQ 2)
<fed...@cr...> wrote:
> From: Stefanato Federico (KGRQ 2)
<fed...@cr...>
> Subject: RE: [Simple-support] Extended @Version
> To: "Niall Gallagher" <gal...@ya...>,
sim...@li...
> Received: Thursday, 21 July, 2011, 3:11 AM
> Niall,
>
> good to know that some enhancements on such topic are here
> to come!
>
> Sorry if I go back on versioning issues...
>
> I'm also facing a problem regarding enums versioning:
> switching to
> future @Version target type would also solve the
> mismatching of enum
> values over different version?
>
> Thanks again.
>
> Regards,
>
> federico
>
> -----Original Message-----
> From: Niall Gallagher [mailto:gal...@ya...]
>
> Sent: Thursday, July 21, 2011 11:45 AM
> To: sim...@li...;
> Stefanato Federico (KGRQ 2)
> Subject: Re: [Simple-support] Extended @Version
>
> Hi,
>
> Yes, this should be a very easy thing to do. I am planning
> a release
> soon for 2.6.1, I will take a look at addressing the
> @Version annotation
> in such a way.
>
> Thanks for the feedback.
> Niall
>
> --- On Tue, 19/7/11, Stefanato Federico (KGRQ 2)
> <fed...@cr...>
> wrote:
>
> > From: Stefanato Federico (KGRQ 2)
> <fed...@cr...>
> > Subject: [Simple-support] Extended @Version
> > To: sim...@li...
> > Received: Tuesday, 19 July, 2011, 4:40 AM
> > Hi Niall,
> >
> > the usage of @Version annotation is very powerful
> where -
> > as in my case
> > - the overall structure changes quite often.
> >
> > Unfortunately, the annotation works only at field
> level and
> > I need a
> > class - either concrete or abstract - to provide such
> field
> > (in
> > interfaces it doesn't work).
> >
> > It would be of great advantage if I could annotate a
> super
> > interface in
> > order to centralize the versioning management.
> > Something as:
> >
> > @Version(name="xml-version", revision="1.7")
> > public interface XmlSerializable{}
> >
> > Do you foresee any kind of extension in versioning
> > capabilities?
> > Otherwise, could you suggest me an equivalent
> strategy?
> >
> > Thanks in advance.
> >
> > Regards,
> >
> > federico
> >
> >
>
------------------------------------------------------------------------
> ------
> > Magic Quadrant for Content-Aware Data Loss Prevention
> > Research study explores the data loss prevention
> market.
> > Includes in-depth
> > analysis on the changes within the DLP market, and
> the
> > criteria used to
> > evaluate the strengths and weaknesses of these DLP
> > solutions.
> > http://www.accelacomm.com/jaw/sfnl/114/51385063/
> > _______________________________________________
> > Simple-support mailing list
> > Sim...@li...
> > https://lists.sourceforge.net/lists/listinfo/simple-support
> >
>
|
|
From: Niall G. <gal...@ya...> - 2011-07-22 14:57:35
|
Hi,
I am not sure I understand the question, could you elaborate?
Thanks,
Niall
--- On Thu, 21/7/11, Stefanato Federico (KGRQ 2) <fed...@cr...> wrote:
> From: Stefanato Federico (KGRQ 2) <fed...@cr...>
> Subject: RE: [Simple-support] Extended @Version
> To: "Niall Gallagher" <gal...@ya...>, sim...@li...
> Received: Thursday, 21 July, 2011, 3:11 AM
> Niall,
>
> good to know that some enhancements on such topic are here
> to come!
>
> Sorry if I go back on versioning issues...
>
> I'm also facing a problem regarding enums versioning:
> switching to
> future @Version target type would also solve the
> mismatching of enum
> values over different version?
>
> Thanks again.
>
> Regards,
>
> federico
>
> -----Original Message-----
> From: Niall Gallagher [mailto:gal...@ya...]
>
> Sent: Thursday, July 21, 2011 11:45 AM
> To: sim...@li...;
> Stefanato Federico (KGRQ 2)
> Subject: Re: [Simple-support] Extended @Version
>
> Hi,
>
> Yes, this should be a very easy thing to do. I am planning
> a release
> soon for 2.6.1, I will take a look at addressing the
> @Version annotation
> in such a way.
>
> Thanks for the feedback.
> Niall
>
> --- On Tue, 19/7/11, Stefanato Federico (KGRQ 2)
> <fed...@cr...>
> wrote:
>
> > From: Stefanato Federico (KGRQ 2)
> <fed...@cr...>
> > Subject: [Simple-support] Extended @Version
> > To: sim...@li...
> > Received: Tuesday, 19 July, 2011, 4:40 AM
> > Hi Niall,
> >
> > the usage of @Version annotation is very powerful
> where -
> > as in my case
> > - the overall structure changes quite often.
> >
> > Unfortunately, the annotation works only at field
> level and
> > I need a
> > class - either concrete or abstract - to provide such
> field
> > (in
> > interfaces it doesn't work).
> >
> > It would be of great advantage if I could annotate a
> super
> > interface in
> > order to centralize the versioning management.
> > Something as:
> >
> > @Version(name="xml-version", revision="1.7")
> > public interface XmlSerializable{}
> >
> > Do you foresee any kind of extension in versioning
> > capabilities?
> > Otherwise, could you suggest me an equivalent
> strategy?
> >
> > Thanks in advance.
> >
> > Regards,
> >
> > federico
> >
> >
> ------------------------------------------------------------------------
> ------
> > Magic Quadrant for Content-Aware Data Loss Prevention
> > Research study explores the data loss prevention
> market.
> > Includes in-depth
> > analysis on the changes within the DLP market, and
> the
> > criteria used to
> > evaluate the strengths and weaknesses of these DLP
> > solutions.
> > http://www.accelacomm.com/jaw/sfnl/114/51385063/
> > _______________________________________________
> > Simple-support mailing list
> > Sim...@li...
> > https://lists.sourceforge.net/lists/listinfo/simple-support
> >
>
|