simple-support Mailing List for Simple (Page 6)
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...> - 2013-06-11 13:53:57
|
If you use @Attribute then you can use a Transform to parse the string in the attribute, for instance take a look at the transform for String[], it parses a comma separated list fo strings. This will work for you.
--- On Tue, 11/6/13, Arnaud bourree <arn...@gm...> wrote:
From: Arnaud bourree <arn...@gm...>
Subject: Re: [Simple-support] [simple-xml] deserialize spaced attibutes list
To: sim...@li...
Received: Tuesday, 11 June, 2013, 6:26 AM
I try:@root
class Element {
@Attibute
@Convert(WeeksConverter.class)
List<String> weeks
}
But I get:
org.simpleframework.xml.transform.TransformException: Transform of interface java.util.List not supported
at org.simpleframework.xml.transform.Transformer.read(Transformer.java:104)
at org.simpleframework.xml.core.Support.read(Support.java:372)
at org.simpleframework.xml.core.PrimitiveFactory.getInstance(PrimitiveFactory.java:105)
at org.simpleframework.xml.core.Primitive.readTemplate(Primitive.java:231)
at org.simpleframework.xml.core.Primitive.read(Primitive.java:171)
at org.simpleframework.xml.core.Primitive.read(Primitive.java:126)
at org.simpleframework.xml.core.Composite.readVariable(Composite.java:623)
at org.simpleframework.xml.core.Composite.readInstance(Composite.java:573)
at org.simpleframework.xml.core.Composite.readAttribute(Composite.java:497)
at org.simpleframework.xml.core.Composite.readAttributes(Composite.java:413)
at org.simpleframework.xml.core.Composite.access$300(Composite.java:59)
at org.simpleframework.xml.core.Composite$Builder.read(Composite.java:1382)
at org.simpleframework.xml.core.Composite.read(Composite.java:201)
at org.simpleframework.xml.core.Composite.read(Composite.java:148)
at org.simpleframework.xml.core.Traverser.read(Traverser.java:92)
at org.simpleframework.xml.core.Persister.read(Persister.java:625)
at org.simpleframework.xml.core.Persister.read(Persister.java:606)
at org.simpleframework.xml.core.Persister.read(Persister.java:584)
at org.simpleframework.xml.core.Persister.read(Persister.java:543)
at org.simpleframework.xml.core.Persister.read(Persister.java:444)
2013/6/11 Arnaud bourree <arn...@gm...>
Hello,
I've document with element like: <element weeks="W01 W03 W52"/>
I'd like to do something like:
@root
class Element {
@AttibuteList
List<String> weeks
}
But AttibuteList annotation doesn't exist (and ElementList exists)
How do you suggest to proceed with simple-xml ?
Regards,
Arnaud.
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Arnaud b. <arn...@gm...> - 2013-06-11 13:26:20
|
I try:
@root
class Element {
@Attibute
@Convert(WeeksConverter.class)
List<String> weeks
}
But I get:
org.simpleframework.xml.transform.TransformException: Transform of
interface java.util.List not supported
at
org.simpleframework.xml.transform.Transformer.read(Transformer.java:104)
at org.simpleframework.xml.core.Support.read(Support.java:372)
at
org.simpleframework.xml.core.PrimitiveFactory.getInstance(PrimitiveFactory.java:105)
at
org.simpleframework.xml.core.Primitive.readTemplate(Primitive.java:231)
at org.simpleframework.xml.core.Primitive.read(Primitive.java:171)
at org.simpleframework.xml.core.Primitive.read(Primitive.java:126)
at
org.simpleframework.xml.core.Composite.readVariable(Composite.java:623)
at
org.simpleframework.xml.core.Composite.readInstance(Composite.java:573)
at
org.simpleframework.xml.core.Composite.readAttribute(Composite.java:497)
at
org.simpleframework.xml.core.Composite.readAttributes(Composite.java:413)
at org.simpleframework.xml.core.Composite.access$300(Composite.java:59)
at
org.simpleframework.xml.core.Composite$Builder.read(Composite.java:1382)
at org.simpleframework.xml.core.Composite.read(Composite.java:201)
at org.simpleframework.xml.core.Composite.read(Composite.java:148)
at org.simpleframework.xml.core.Traverser.read(Traverser.java:92)
at org.simpleframework.xml.core.Persister.read(Persister.java:625)
at org.simpleframework.xml.core.Persister.read(Persister.java:606)
at org.simpleframework.xml.core.Persister.read(Persister.java:584)
at org.simpleframework.xml.core.Persister.read(Persister.java:543)
at org.simpleframework.xml.core.Persister.read(Persister.java:444)
2013/6/11 Arnaud bourree <arn...@gm...>
> Hello,
>
> I've document with element like: <element weeks="W01 W03 W52"/>
>
> I'd like to do something like:
>
> @root
> class Element {
>
> @AttibuteList
> List<String> weeks
>
> }
>
> But AttibuteList annotation doesn't exist (and ElementList exists)
>
> How do you suggest to proceed with simple-xml ?
>
> Regards,
>
> Arnaud.
>
|
|
From: Arnaud b. <arn...@gm...> - 2013-06-11 12:58:32
|
Hello,
I've document with element like: <element weeks="W01 W03 W52"/>
I'd like to do something like:
@root
class Element {
@AttibuteList
List<String> weeks
}
But AttibuteList annotation doesn't exist (and ElementList exists)
How do you suggest to proceed with simple-xml ?
Regards,
Arnaud.
|
|
From: Niall G. <gal...@ya...> - 2013-05-18 00:58:37
|
You would have to write a converter (see org.simpleframework.xml.convert.Converter). StAX, DOM and XmlPull (the XML parsers that can be used by simple) can not tell the difference between <DROP/> and <DROP></DROP> so it has to be null rather than an empty string.
--- On Fri, 17/5/13, Joël Craenhals <jo...@cr...> wrote:
From: Joël Craenhals <jo...@cr...>
Subject: [Simple-support] Check for empty element
To: sim...@li...
Received: Friday, 17 May, 2013, 11:57 AM
Hello,
I'm trying to deserialize an IPTables XML configuration file. In the file there is a part like this:
<rule > <actions> <DROP /> </actions>
</rule>
The empty element inside the actions element can be one of these four: <DROP /> or <ACCEPT /> or <RETURN /> or <QUEUE />
When reading in the XML file, I have a Java class Rule.java like this:
package model;
import java.io.Serializable;
import org.simpleframework.xml.Element;import org.simpleframework.xml.Root;
@Root(name = "rule")public class Rule implements Serializable { private static final long serialVersionUID = 1L;
@Element(name = "actions", required = true) private Actions action;
}
The actions class looks like this:
package model;
import org.simpleframework.xml.Element;import org.simpleframework.xml.Root;import org.simpleframework.xml.convert.Convert;
@Root(name = "actions", strict = false)public class Actions { @Element(name = "DROP", required = false) private String aDrop;
@Element(name = "ACCEPT", required = false) private String aAccept;
@Element(name = "QUEUE", required = false) private String aQueue;
@Element(name = "RETURN", required = false) private String aReturn;
public String toString() { if (aDrop != null) { return "DROP"; } else if (aAccept != null) { return "ACCEPT"; } else if (aQueue != null) { return "QUEUE"; } else if (aReturn != null) { return "RETURN"; } else { return "NOTHING"; } }}
I want to check which element was present inside the actions element.However all the attributes of the Actions class stay NULL.
What am I doing wrong?
Thanks in advance.
Joël Craenhals
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Joël C. <jo...@cr...> - 2013-05-17 19:40:16
|
Hello,
I'm trying to deserialize an IPTables XML configuration file. In the file there is a part like this:
<rule >
<actions>
<DROP />
</actions>
</rule>
The empty element inside the actions element can be one of these four: <DROP /> or <ACCEPT /> or <RETURN /> or <QUEUE />
When reading in the XML file, I have a Java class Rule.java like this:
package model;
import java.io.Serializable;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
@Root(name = "rule")
public class Rule implements Serializable {
private static final long serialVersionUID = 1L;
@Element(name = "actions", required = true)
private Actions action;
}
The actions class looks like this:
package model;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.convert.Convert;
@Root(name = "actions", strict = false)
public class Actions {
@Element(name = "DROP", required = false)
private String aDrop;
@Element(name = "ACCEPT", required = false)
private String aAccept;
@Element(name = "QUEUE", required = false)
private String aQueue;
@Element(name = "RETURN", required = false)
private String aReturn;
public String toString() {
if (aDrop != null) {
return "DROP";
} else if (aAccept != null) {
return "ACCEPT";
} else if (aQueue != null) {
return "QUEUE";
} else if (aReturn != null) {
return "RETURN";
} else {
return "NOTHING";
}
}
}
I want to check which element was present inside the actions element.
However all the attributes of the Actions class stay NULL.
What am I doing wrong?
Thanks in advance.
Joël Craenhals
|
|
From: Niall G. - Y. <Nia...@yi...> - 2013-05-08 23:27:24
|
Take a look at the @Persist and @Commit annotations. If this is not suitable then you can always write a Converter.
From: Anton Hornacek [mailto:ant...@gm...]
Sent: Wednesday, 8 May 2013 11:05 PM
To: sim...@li...
Subject: [Simple-support] Serialize with object validation
Hello,
I have question about validation serialization process.
I've declared :
@ElementList
private List<BaseObject> list;
list is queue of BaseObjects, where BaseObject is defined this way :
@Root
class BaseObject
{
public boolean canBeSaved;
...
}
Some objects in queue have field canBeSaved set to true, some to false.
Now, I don't want to save objects with canBeSave==false (they are only temporary).
And I don't want to split them into two Lists(temporary and permanent).
Please, is there any way how to do this?
I have found that something similar is possible with deserialization, but I'm stuck with backward process
Thank you
Anton Hornacek
|
|
From: Anton H. <ant...@gm...> - 2013-05-08 13:05:31
|
Hello,
I have question about validation serialization process.
I've declared :
@ElementList
private List<BaseObject> list;
list is queue of BaseObjects, where BaseObject is defined this way :
@Root
class BaseObject
{
public boolean canBeSaved;
...
}
Some objects in queue have field canBeSaved set to true, some to false.
Now, I don't want to save objects with canBeSave==false (they are only
temporary).
And I don't want to split them into two Lists(temporary and permanent).
Please, is there any way how to do this?
I have found that something similar is possible with deserialization, but
I'm stuck with backward process
Thank you
Anton Hornacek
|
|
From: <cw...@cs...> - 2013-04-29 16:49:12
|
All-
I have an acyclic tree of custom objects that I need to serialize in a
custom manner ('custom' for data access patterns -- I don't need or want
to reconstruct the entire object, just certain aspects of each).
These objects form an logical boolean expression to be evaluated later --
non-leaf nodes define the logical operator, while leaf-nodes provide the
particular operands.
I'm amenable to two serialization models --
a) Enumerate (and uniquely identify) all leaves of the object tree, and
build a section in the XML file that represents this library. The
expression can be stored, with operators, as an element of another XML
node.
b) Traverse the tree, building a hierarchy that more closely represents
the objects' relationships.
I've found RegistryStrategy allows me to hook into the marshalling stream
with useful Converters. This pattern gets me "access" to the root of the
tree, but it's not clear from the tutorial ([1]) how to then traverse into
the tree, and allows other objects in my dataset to be marshalled
effectively.
The TreeStrategy, would, at first blush, seem to be more appropriate as I
have a tree of objects... lacking a brief example, it's tough to know this
with certainty. I assume I'd need to subclass this to be more contextual?
Can strategies be combined? I see that some of the defined Strategy
classes accept nesting of Strategies via constructor parameter, but not
all. Specifically, the TreeStrategy does not.
Thoughts on how to achieve a custom serialization?
Thanks!
CH
[1] http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php
|
|
From: Richard K. <rk...@gm...> - 2013-04-25 22:06:16
|
I love Simple XML, but I have one requirement that it doesn't seem to
easily support. Buried deep in som XML that Simple XML parses just fine, I
have arbitrarily-deep XML containing <p>s, text, <img> tags and MathML (see
example below). I can't depend on what order any of it will show up in. I
don't need to parse these trees into objects, I just need to get the entire
mess as an intact string and pass it on to a browser. How would I do that?
Thanks,
Rick
--------------------------------------------------------
<p>
Some text
<img src="xxx"/>
some more text
<m:math>
<m:mrow>
<m:mn>4</m:mn>
<m:mfrac>
<m:mn>1</m:mn>
<m:mn>2</m:mn>
</m:mfrac>
</m:mrow>
</m:math>
yet more text
</p>
|
|
From: Timo R. <tim...@di...> - 2013-04-23 16:41:05
|
Hi everyone, I found the answer myself, I need to use the "@Text" annotation on the "success" property. Best Regards, Timo -----Ursprüngliche Nachricht----- Von: Timo Rumland [mailto:tim...@di...] Gesendet: Dienstag, 23. April 2013 18:32 An: sim...@li... Betreff: [Simple-support] How to serialize an object to this very simple XML (single inline element)? Hello everyone, my goal is to serialize an object to this very simple XML: -------------------- <abc:response xmlns:abc="http://mynamespace.com/abc">true</abc:response> -------------------- I used this class: -------------------- @Root @Default @Namespace( prefix = "abc", reference = "http://mynamespace.com/abc" ) public static class Response { private Boolean success = true; // Property accessor here [...] } -------------------- With this serializer: -------------------- Format format = new Format( 0, null ); // 'null' to avoid the XML header Serializer serializer = new Persister( format ); -------------------- And I get this (wrong) result: -------------------- <abc:response xmlns:r2mds=" http://mynamespace.com/abc"> <success>true</success> </abc:response> -------------------- So the only difference (that matters) is, that the "true" is wrapped by the "<success>" element. Is it in any way possible to avoid the "<success>" element and put the "true" value inline, to get the desired result (see first example)? Thanks a lot for your help! Best Regards, Timo ---------------------------------------------------------------------------- -- Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Timo R. <tim...@di...> - 2013-04-23 16:32:27
|
Hello everyone, my goal is to serialize an object to this very simple XML: -------------------- <abc:response xmlns:abc="http://mynamespace.com/abc">true</abc:response> -------------------- I used this class: -------------------- @Root @Default @Namespace( prefix = "abc", reference = "http://mynamespace.com/abc" ) public static class Response { private Boolean success = true; // Property accessor here [...] } -------------------- With this serializer: -------------------- Format format = new Format( 0, null ); // 'null' to avoid the XML header Serializer serializer = new Persister( format ); -------------------- And I get this (wrong) result: -------------------- <abc:response xmlns:r2mds=" http://mynamespace.com/abc"> <success>true</success> </abc:response> -------------------- So the only difference (that matters) is, that the "true" is wrapped by the "<success>" element. Is it in any way possible to avoid the "<success>" element and put the "true" value inline, to get the desired result (see first example)? Thanks a lot for your help! Best Regards, Timo |
|
From: Mike Q. <mik...@ju...> - 2013-04-18 08:41:03
|
Thanks Niall. From: Niall Gallagher [mailto:gal...@ya...] Sent: 17 April 2013 10:37 To: sim...@li...; Mike Quilleash Subject: Re: [Simple-support] Error handling/capture in Transform I think a re-throw makes sense here ill take a look. --- On Wed, 17/4/13, Mike Quilleash <mik...@ju...<mailto:mik...@ju...>> wrote: From: Mike Quilleash <mik...@ju...<mailto:mik...@ju...>> Subject: [Simple-support] Error handling/capture in Transform To: "sim...@li...<mailto:sim...@li...>" <sim...@li...<mailto:sim...@li...>> Received: Wednesday, 17 April, 2013, 2:03 AM Hi all, Using version 2.7 When binding to a BigDecimal object and the content of the relevant XML attribute is not parsable to a BigDecimal then the BigDecimalTransfrom throws a NumberFormatException. However this exception alone is not very useful for locating the problem because there is no location information, such as the attribute name, line number etc available anywhere to trace the problem. Is it possible to trap this exception somewhere and re-throw the exception with more information appended? Or some other approach to improve the error message in this case? Thanks. -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li...</mc/compose?to=...@li...> https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Niall G. <gal...@ya...> - 2013-04-17 09:36:49
|
I think a re-throw makes sense here ill take a look. --- On Wed, 17/4/13, Mike Quilleash <mik...@ju...> wrote: From: Mike Quilleash <mik...@ju...> Subject: [Simple-support] Error handling/capture in Transform To: "sim...@li..." <sim...@li...> Received: Wednesday, 17 April, 2013, 2:03 AM Hi all, Using version 2.7 When binding to a BigDecimal object and the content of the relevant XML attribute is not parsable to a BigDecimal then the BigDecimalTransfrom throws a NumberFormatException. However this exception alone is not very useful for locating the problem because there is no location information, such as the attribute name, line number etc available anywhere to trace the problem. Is it possible to trap this exception somewhere and re-throw the exception with more information appended? Or some other approach to improve the error message in this case? Thanks. -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Mike Q. <mik...@ju...> - 2013-04-17 09:21:47
|
Hi all, Using version 2.7 When binding to a BigDecimal object and the content of the relevant XML attribute is not parsable to a BigDecimal then the BigDecimalTransfrom throws a NumberFormatException. However this exception alone is not very useful for locating the problem because there is no location information, such as the attribute name, line number etc available anywhere to trace the problem. Is it possible to trap this exception somewhere and re-throw the exception with more information appended? Or some other approach to improve the error message in this case? Thanks. |
|
From: Niall G. - Y. <Nia...@yi...> - 2013-04-16 05:55:56
|
Try to serialize an instance and take a look at the structure. This should match the input. For below, you can only use inline with primitive types. For an object the value will be a child element.
From: Dzmitry Kavaliou [mailto:dzm...@gm...]
Sent: Tuesday, 16 April 2013 1:20 AM
To: sim...@li...
Subject: [Simple-support] Deserializing Map<String, NotPrimitiveType> with "Simple XML"
Hi,
Is it possible to deserialize Map<String, MyType> with Simple xml? How can I do that?
I checked examples section but it contains example only for Map<String, SomePrimitiveType>.
I tried to do it myself:
Java classes:
@Root
public class Content {
@ElementMap(entry="page", key="id", attribute=true, inline=true)
//@ElementMap(entry="page", key="id", attribute=true, inline=true, valueType=net.edyoucare.krisenkompass.Page.class)
public HashMap<String, Page> pages;
}
@Root
public class Page {
@Attribute
private String id;
@Attribute
private String layout;
}
Xml:
<?xml version="1.0" ?>
<content>
<page id="root" layout="text_with_pdf_link">test</page>
<page id="root2" layout="text_with_pdf_link">test</page>
</content>
Deserializing code:
Serializer serializer = new Persister();
Content result = serializer.read(Content.class, br);
The code above runs without any exceptions. It produces Content instance with a map which has two entries with correct keys. But these keys are map to the null values :(
So the map in Content.pages field looks like {root=null, root2=null}.
I don't have any ideas how to force it to create Page object, and map the keys with that object.
Thanks,
Dzmitry
|
|
From: Dzmitry K. <dzm...@gm...> - 2013-04-15 15:19:54
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi, <br>
<br>
Is it possible to deserialize Map<String, MyType> with <b>Simple
xml</b>? How can I do that?<br>
<br>
I checked examples section but it contains example only for
Map<String, SomePrimitiveType>.<br>
<br>
I tried to do it myself:<br>
<br>
Java classes:<br>
<br>
@Root<br>
public class Content {<br>
<br>
@ElementMap(entry="page", key="id", attribute=true, inline=true)<br>
//@ElementMap(entry="page", key="id", attribute=true, inline=true,
valueType=net.edyoucare.krisenkompass.Page.class)<br>
public HashMap<String, Page> pages;<br>
<br>
}<br>
<br>
@Root<br>
public class Page {<br>
<br>
@Attribute<br>
private String id;<br>
<br>
@Attribute<br>
private String layout;<br>
<br>
}<br>
<br>
Xml:<br>
<br>
<?xml version="1.0" ?> <br>
<content> <br>
<br>
<page id="root" layout="text_with_pdf_link">test</page><br>
<page id="root2" layout="text_with_pdf_link">test</page><br>
<br>
</content><br>
<br>
Deserializing code:<br>
<br>
Serializer serializer = new Persister();<br>
Content result = serializer.read(Content.class, br);<br>
<br>
The code above runs without any exceptions. It produces Content
instance with a map which has two entries with correct keys. But these
keys are map to the null values :(<br>
So the map in Content.pages field looks like {root=null, root2=null}.<br>
<br>
I don't have any ideas how to force it to create Page object, and map
the keys with that object.<br>
<br>
Thanks,<br>
Dzmitry<br>
<br>
<br>
<br>
<br>
</body>
</html>
|
|
From: Niall G. <gal...@ya...> - 2013-03-29 23:51:44
|
Thats fine, thats how it works. If the classloader can't load stax it defaults to XmlPull for android. Just ignore the class load error. --- On Fri, 29/3/13, Sebastien Astie <seb...@gm...> wrote: From: Sebastien Astie <seb...@gm...> Subject: Re: [Simple-support] Android Artifact Build To: "Niall Gallagher" <gal...@ya...> Cc: sim...@li... Received: Friday, 29 March, 2013, 4:38 PM When removing the references to xpp3 and stax the compilation goes through however the classloader complains at runtime that javax.xml.stream.* classes are missing. On Fri, Mar 29, 2013 at 7:29 PM, Sebastien Astie <seb...@gm...> wrote: Unfortunately this is not an error that can be ignored as it aborts the compilation; this is the error provided in the android build console: trouble processing "javax/xml/stream/events/StartElement.class": Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library. This is often due to inadvertently including a core library file in your application's project, when using an IDE (such asEclipse). If you are sure you're not intentionally defining a core class, then this is the most likely explanation of what'sgoing on. However, you might actually be trying to define a class in a corenamespace, the source of which you may have taken, for example, from a non-Android virtual machine project. This will mostassuredly not work. At a minimum, it jeopardizes the compatibility of your app with future versions of the platform.It is also often of questionable legality. If you really intend to build a core library -- which is only appropriate as part of creating a full virtual machinedistribution, as opposed to compiling an application -- then use the "--core-library" option to suppress this error message. If you go ahead and use "--core-library" but are in fact building an application, then be forewarned that your applicationwill still fail to build or run, at some point. Please be prepared for angry customers who find, for example, that yourapplication ceases to function once they upgrade their operating system. You will be to blame for this problem. If you are legitimately using some code that happens to be in acore package, then the easiest safe alternative you have is to repackage that code. That is, move the classes in question intoyour own package namespace. This means that they will never be in conflict with core system classes. JarJar is a tool that may helpyou in this endeavor. If you find that you cannot do this, then that is an indication that the path you are on will ultimatelylead to pain, suffering, grief, and lamentation. [2013-03-27 20:54:19 - Proj] Dx 1 error; aborting[2013-03-27 20:54:19 - Proj] Conversion to Dalvik format failed with error 1 On Fri, Mar 29, 2013 at 7:15 PM, Niall Gallagher <gal...@ya...> wrote: Why is it failing, just ignore the javax.xml.stream references. It is implemented in such a way that it will fallback on XmlPull when it cant find StAX. --- On Fri, 29/3/13, Sebastien Astie <seb...@gm...> wrote: From: Sebastien Astie <seb...@gm...> Subject: [Simple-support] Android Artifact Build To: sim...@li... Received: Friday, 29 March, 2013, 11:27 AM Hi,This is more geared towards the owner of this project. After having some issues with an android project failing the dx building step (javax.xml.stream.* references), I grabbed the sources for simplexml 2.7 and made a 2.7 jar that does not include these references. I would like to create a maven artifact for it and make it available for public consumption. Is there something we could do to maybe create a branch and build this artifact or would you prefer I do this separately from this project? Thanks -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Sebastien A. <seb...@gm...> - 2013-03-29 23:38:10
|
When removing the references to xpp3 and stax the compilation goes through however the classloader complains at runtime that javax.xml.stream.* classes are missing. On Fri, Mar 29, 2013 at 7:29 PM, Sebastien Astie <seb...@gm...>wrote: > Unfortunately this is not an error that can be ignored as it aborts the > compilation; this is the error provided in the android build console: > > trouble processing "javax/xml/stream/events/StartElement.class": > > Ill-advised or mistaken usage of a core class (java.* or javax.*) > when not building a core library. > > This is often due to inadvertently including a core library file > in your application's project, when using an IDE (such as > Eclipse). If you are sure you're not intentionally defining a > core class, then this is the most likely explanation of what's > going on. > > However, you might actually be trying to define a class in a core > namespace, the source of which you may have taken, for example, > from a non-Android virtual machine project. This will most > assuredly not work. At a minimum, it jeopardizes the > compatibility of your app with future versions of the platform. > It is also often of questionable legality. > > If you really intend to build a core library -- which is only > appropriate as part of creating a full virtual machine > distribution, as opposed to compiling an application -- then use > the "--core-library" option to suppress this error message. > > If you go ahead and use "--core-library" but are in fact > building an application, then be forewarned that your application > will still fail to build or run, at some point. Please be > prepared for angry customers who find, for example, that your > application ceases to function once they upgrade their operating > system. You will be to blame for this problem. > > If you are legitimately using some code that happens to be in a > core package, then the easiest safe alternative you have is to > repackage that code. That is, move the classes in question into > your own package namespace. This means that they will never be in > conflict with core system classes. JarJar is a tool that may help > you in this endeavor. If you find that you cannot do this, then > that is an indication that the path you are on will ultimately > lead to pain, suffering, grief, and lamentation. > > [2013-03-27 20:54:19 - Proj] Dx 1 error; aborting > [2013-03-27 20:54:19 - Proj] Conversion to Dalvik format failed with error > 1 > > > > On Fri, Mar 29, 2013 at 7:15 PM, Niall Gallagher < > gal...@ya...> wrote: > >> Why is it failing, just ignore the javax.xml.stream references. It is >> implemented in such a way that it will fallback on XmlPull when it cant >> find StAX. >> >> --- On *Fri, 29/3/13, Sebastien Astie <seb...@gm...>* wrote: >> >> >> From: Sebastien Astie <seb...@gm...> >> Subject: [Simple-support] Android Artifact Build >> To: sim...@li... >> Received: Friday, 29 March, 2013, 11:27 AM >> >> >> Hi, >> This is more geared towards the owner of this project. >> After having some issues with an android project failing the dx building >> step (javax.xml.stream.* references), I grabbed the sources for simplexml >> 2.7 and made a 2.7 jar that does not include these references. I would like >> to create a maven artifact for it and make it available for public >> consumption. Is there something we could do to maybe create a branch and >> build this artifact or would you prefer I do this separately from this >> project? >> >> Thanks >> >> -----Inline Attachment Follows----- >> >> >> >> ------------------------------------------------------------------------------ >> Own the Future-Intel(R) Level Up Game Demo Contest 2013 >> Rise to greatness in Intel's independent game demo contest. Compete >> for recognition, cash, and the chance to get your game on Steam. >> $5K grand prize plus 10 genre and skill prizes. Submit your demo >> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 >> >> -----Inline Attachment Follows----- >> >> >> _______________________________________________ >> Simple-support mailing list >> Sim...@li...<http://mc/compose?to=...@li...> >> https://lists.sourceforge.net/lists/listinfo/simple-support >> >> > |
|
From: Sebastien A. <seb...@gm...> - 2013-03-29 23:29:14
|
Unfortunately this is not an error that can be ignored as it aborts the compilation; this is the error provided in the android build console: trouble processing "javax/xml/stream/events/StartElement.class": Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library. This is often due to inadvertently including a core library file in your application's project, when using an IDE (such as Eclipse). If you are sure you're not intentionally defining a core class, then this is the most likely explanation of what's going on. However, you might actually be trying to define a class in a core namespace, the source of which you may have taken, for example, from a non-Android virtual machine project. This will most assuredly not work. At a minimum, it jeopardizes the compatibility of your app with future versions of the platform. It is also often of questionable legality. If you really intend to build a core library -- which is only appropriate as part of creating a full virtual machine distribution, as opposed to compiling an application -- then use the "--core-library" option to suppress this error message. If you go ahead and use "--core-library" but are in fact building an application, then be forewarned that your application will still fail to build or run, at some point. Please be prepared for angry customers who find, for example, that your application ceases to function once they upgrade their operating system. You will be to blame for this problem. If you are legitimately using some code that happens to be in a core package, then the easiest safe alternative you have is to repackage that code. That is, move the classes in question into your own package namespace. This means that they will never be in conflict with core system classes. JarJar is a tool that may help you in this endeavor. If you find that you cannot do this, then that is an indication that the path you are on will ultimately lead to pain, suffering, grief, and lamentation. [2013-03-27 20:54:19 - Proj] Dx 1 error; aborting [2013-03-27 20:54:19 - Proj] Conversion to Dalvik format failed with error 1 On Fri, Mar 29, 2013 at 7:15 PM, Niall Gallagher <gal...@ya...>wrote: > Why is it failing, just ignore the javax.xml.stream references. It is > implemented in such a way that it will fallback on XmlPull when it cant > find StAX. > > --- On *Fri, 29/3/13, Sebastien Astie <seb...@gm...>* wrote: > > > From: Sebastien Astie <seb...@gm...> > Subject: [Simple-support] Android Artifact Build > To: sim...@li... > Received: Friday, 29 March, 2013, 11:27 AM > > > Hi, > This is more geared towards the owner of this project. > After having some issues with an android project failing the dx building > step (javax.xml.stream.* references), I grabbed the sources for simplexml > 2.7 and made a 2.7 jar that does not include these references. I would like > to create a maven artifact for it and make it available for public > consumption. Is there something we could do to maybe create a branch and > build this artifact or would you prefer I do this separately from this > project? > > Thanks > > -----Inline Attachment Follows----- > > > > ------------------------------------------------------------------------------ > Own the Future-Intel(R) Level Up Game Demo Contest 2013 > Rise to greatness in Intel's independent game demo contest. Compete > for recognition, cash, and the chance to get your game on Steam. > $5K grand prize plus 10 genre and skill prizes. Submit your demo > by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 > > -----Inline Attachment Follows----- > > > _______________________________________________ > Simple-support mailing list > Sim...@li...<http://mc/compose?to=...@li...> > https://lists.sourceforge.net/lists/listinfo/simple-support > > |
|
From: Niall G. <gal...@ya...> - 2013-03-29 23:16:07
|
Why is it failing, just ignore the javax.xml.stream references. It is implemented in such a way that it will fallback on XmlPull when it cant find StAX. --- On Fri, 29/3/13, Sebastien Astie <seb...@gm...> wrote: From: Sebastien Astie <seb...@gm...> Subject: [Simple-support] Android Artifact Build To: sim...@li... Received: Friday, 29 March, 2013, 11:27 AM Hi,This is more geared towards the owner of this project. After having some issues with an android project failing the dx building step (javax.xml.stream.* references), I grabbed the sources for simplexml 2.7 and made a 2.7 jar that does not include these references. I would like to create a maven artifact for it and make it available for public consumption. Is there something we could do to maybe create a branch and build this artifact or would you prefer I do this separately from this project? Thanks -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Jeffrey B. <jef...@gm...> - 2013-03-29 19:50:01
|
perhaps you could give some more detail about what you are doing. i'm sure there are a lot of us using simple across a wide variety of android versions without trouble. On Fri, Mar 29, 2013 at 11:27 AM, Sebastien Astie <seb...@gm... > wrote: > Hi, > This is more geared towards the owner of this project. > After having some issues with an android project failing the dx building > step (javax.xml.stream.* references), I grabbed the sources for simplexml > 2.7 and made a 2.7 jar that does not include these references. I would like > to create a maven artifact for it and make it available for public > consumption. Is there something we could do to maybe create a branch and > build this artifact or would you prefer I do this separately from this > project? > > Thanks > > > ------------------------------------------------------------------------------ > Own the Future-Intel(R) Level Up Game Demo Contest 2013 > Rise to greatness in Intel's independent game demo contest. Compete > for recognition, cash, and the chance to get your game on Steam. > $5K grand prize plus 10 genre and skill prizes. Submit your demo > by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > > |
|
From: Sebastien A. <seb...@gm...> - 2013-03-29 18:27:38
|
Hi, This is more geared towards the owner of this project. After having some issues with an android project failing the dx building step (javax.xml.stream.* references), I grabbed the sources for simplexml 2.7 and made a 2.7 jar that does not include these references. I would like to create a maven artifact for it and make it available for public consumption. Is there something we could do to maybe create a branch and build this artifact or would you prefer I do this separately from this project? Thanks |
|
From: Niall G. - Y. <Nia...@yi...> - 2013-03-25 22:41:58
|
You can use @Element(required=false) on the values, or you can use a Converter, which can be used to add custom logic for deserialization.. From: Shyam Sankaran [mailto:sh...@ou...] Sent: Tuesday, 26 March 2013 4:29 AM To: Simple Support Subject: [Simple-support] jaxb's xmlseealso equivalent Hi, I am consuming a web service which uses jaxb for serializing the response java objects into xml. So, I get a response like this : <things xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="thing"> <val>185</val> </things> <things xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="anotherThing"> <anotherVal>162</anotherVal> </things> The server code uses jaxb's @xmlseealso for dynamic mapping of generic list objects. My question is how am I to unmarshall this response using Simple annotations. Is there an xmlseealso equivalent in Simple. If not, what is the solution ? Should I be using an attribute 'type' for every generic collection ? Regards, Shyam |
|
From: Shyam S. <sh...@ou...> - 2013-03-25 17:29:26
|
Hi, I am consuming a web service which uses jaxb for serializing the response java objects into xml. So, I get a response like this : <things xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="thing"> <val>185</val> </things> <things xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="anotherThing"> <anotherVal>162</anotherVal> </things>The server code uses jaxb's @xmlseealso for dynamic mapping of generic list objects. My question is how am I to unmarshall this response using Simple annotations. Is there an xmlseealso equivalent in Simple. If not, what is the solution ? Should I be using an attribute 'type' for every generic collection ? Regards, Shyam |
|
From: Shyam S. <sh...@ou...> - 2013-03-25 17:06:23
|
You mean , I should create two ElementLists , one for Thing.class and one for AnotherThing.class with the same name ?
Shyam S
From: Nia...@yi...
To: sh...@ou...; sim...@li...
Subject: RE: [Simple-support] ElementListUnion - Duplicate annotation exception .
Date: Sun, 24 Mar 2013 22:50:10 +0000
Hi,
If the tags have the same name then you should not use @ElementListUnion, use @ElementList instead.
Niall
From: Shyam Sankaran [mailto:sh...@ou...]
Sent: Saturday, 23 March 2013 6:01 PM
To: sim...@li...
Subject: [Simple-support] ElementListUnion - Duplicate annotation exception .
Hi,
I tried deseiarilizing a list object. Since I will know the type of the list only at run time , I declared it using ElementListUnion as :
Customer.java
@ElementListUnion({ @ElementList(inline = false, type = Thing.class),
@ElementList(inline = false, type = AnotherThing.class) })
List<Object> things ;
My Response xml is :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customer>
<address>
<no>122</no>
<street>chennai</street>
</address>
<id>122</id>
<name>James Bond</name>
<things>
<thing>
<val>185</val>
</thing>
<thing>
<val>162</val>
</thing>
</things>
</customer>
But Iam getting the following
exception.
03-21 18:56:31.940: E/AndroidRuntime(2289): Caused by:
org.simpleframework.xml.core.PersistenceException: Duplicate annotation
of name 'things' on
@org.simpleframework.xml.ElementListUnion(value=[@org.simpleframework.xml.ElementList(data=false,
empty=true, entry=, inline=false, name=, required=true, type=class
com.data.Thing), @org.simpleframework.xml.ElementList(data=false,
empty=true, entry=, inline=false, name=, required=true, type=class
com.data.AnotherThing)]) on field 'things' java.util.List
com.data.Customer.things
When I remove one ElementList it works fine .
eg. :
@ElementListUnion({ @ElementList(inline = false, type = Thing.class),
})
List<Object> things ;
is working fine.
Am I missing something here. Please Help. I have been on this for more than 3 days now.
Regards,
Shyam S
|