simple-support Mailing List for Simple (Page 36)
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-03-08 11:27:51
|
Hi,
If the root element contains a class= attribute it will be able to figure out the type to be deserialized.
Niall
--- On Mon, 7/3/11, hatchetman82 <hat...@gm...> wrote:
> From: hatchetman82 <hat...@gm...>
> Subject: [Simple-support] deserializing polymorphic classes
> To: sim...@li...
> Received: Monday, 7 March, 2011, 8:21 AM
> Hi.
>
> suppose i have an abstract root class with a @Root
> annotation, with a
> lot of concrete implementing classes.
> is it possible to read any child class of this root class
> without
> knowing its type in advance?
> ideally something like :
>
> @Root
> public abstract class AbstractParentClass {}
>
> @Root(name="concrete")
> public class ConcreteClass extends AbstractParentClass{}
>
> @Root(name="concrete2")
> public class ConcreteClass2 extends AbstractParentClass{}
>
>
> Serializer s = new Persister();
> ConcreteClass a = new ...
> String serializedForm = serialize(a);
>
> AbstractParentClass b = s.read(AbstractParentClass.class,
> serializedForm);
>
> ------------------------------------------------------------------------------
> What You Don't Know About Data Connectivity CAN Hurt You
> This paper provides an overview of data connectivity,
> details
> its effect on application quality, and explores various
> alternative
> solutions. http://p.sf.net/sfu/progress-d2d
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|
|
From: Dewitt, T. (317G) <Tyl...@jp...> - 2011-03-07 18:08:44
|
Hi all,
I'm working on a project that doesn't have an official schema and was wondering if there was a way that I could tell simpleXML to ignore any element contained in the XML that wasn't contained in my class definition (I'm using Java). Also, could I catch exceptions, particularly if I have defined an element in my Class structure that is then given to me as multiple elements in the XML (an inlined list)? I only need certain elements from the XML, and have those defined in my Java Classes.
For example:
I define:
Class Human{
@Element
Int age;
}
And am given:
<Human>
<age>30</age>
<height>70</height>
</Human>
Is there a way I can tell SimpleXML to grab the age element and ignore the height element? I know I can add in a required = false height element, but I don't know which elements the people generating the XML might throw at me.
Thanks!
Tyler
|
|
From: hatchetman82 <hat...@gm...> - 2011-03-07 16:22:08
|
Hi.
suppose i have an abstract root class with a @Root annotation, with a
lot of concrete implementing classes.
is it possible to read any child class of this root class without
knowing its type in advance?
ideally something like :
@Root
public abstract class AbstractParentClass {}
@Root(name="concrete")
public class ConcreteClass extends AbstractParentClass{}
@Root(name="concrete2")
public class ConcreteClass2 extends AbstractParentClass{}
Serializer s = new Persister();
ConcreteClass a = new ...
String serializedForm = serialize(a);
AbstractParentClass b = s.read(AbstractParentClass.class, serializedForm);
|
|
From: hatchetman82 <hat...@gm...> - 2011-03-07 06:30:12
|
this was asked on the list a couple of days back.
the response was that something along the lines of:
@VariantList({
@ElementList(entry="cleanDir", type=CleanDirCommand.class),
@ElementList(entry="copy", type=CopyCommand.class)
})
private List<Command> commands;
is coming to simple in the next couple of weeks.
On Sun, Mar 6, 2011 at 22:40, Philipp Feigl
<phi...@go...> wrote:
> Hi,
> I have an object of type List<object>. The list contains 3 known differnt
> types of classes. While I understand that List<object> is not ideal, I
> cannot change this, as it is auto-generated code (created with JAXB and than
> transformed into Simple readable code)
> Serializing it with the default rules would serialize it as <object
> class="...."> which is not what I want. I'd like to have it serialized with
> the respective class types name.
> JAXB does it the following way:
> @XmlElements({
> @XmlElement(name = "Layout", type =
> Order.LineItems.Layout.class),
> @XmlElement(name = "Fee", type = Order.LineItems.Fee.class),
> @XmlElement(name = "Print", type = Order.LineItems.Print.class)
> })
> protected List<Object> feeOrPrintOrLayout;
> The result should look something like
> <parent>
> <Layout ..>
> <Print ...>
> <Print ...>
> <Print ...>
> <Print ...>
> <Fee ....>
> </parent>
> Is there any way to achieve the same in Simple?
> Thanks for any suggestions,
> Philipp
> ------------------------------------------------------------------------------
> What You Don't Know About Data Connectivity CAN Hurt You
> This paper provides an overview of data connectivity, details
> its effect on application quality, and explores various alternative
> solutions. http://p.sf.net/sfu/progress-d2d
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
|
|
From: Philipp F. <phi...@go...> - 2011-03-06 20:40:34
|
Hi,
I have an object of type List<object>. The list contains 3 known differnt
types of classes. While I understand that List<object> is not ideal, I
cannot change this, as it is auto-generated code (created with JAXB and than
transformed into Simple readable code)
Serializing it with the default rules would serialize it as <object
class="...."> which is not what I want. I'd like to have it serialized with
the respective class types name.
JAXB does it the following way:
@XmlElements({
@XmlElement(name = "Layout", type =
Order.LineItems.Layout.class),
@XmlElement(name = "Fee", type = Order.LineItems.Fee.class),
@XmlElement(name = "Print", type = Order.LineItems.Print.class)
})
protected List<Object> feeOrPrintOrLayout;
The result should look something like
<parent>
<Layout ..>
<Print ...>
<Print ...>
<Print ...>
<Print ...>
<Fee ....>
</parent>
Is there any way to achieve the same in Simple?
Thanks for any suggestions,
Philipp
|
|
From: Raphael J. <rap...@gm...> - 2011-03-04 13:20:27
|
>
> Hi,
>
> Very shortly you will be able to do this, via something like this.
>
> @VariantList({
> @ElementList(entry="cleanDir", type=CleanDirCommand.class),
> @ElementList(entry="copy", type=CopyCommand.class)
> })
> private List<Command> commands;
>
> I have nearly completed this. It should be released in about a week or two.
> At the moment you would have to use the @Convert annotation and write a
> converter.
>
> Nial
Very nice !
I'm eager to have this feature.
Thanks for your work.
Raphael
|
|
From: Niall G. <gal...@ya...> - 2011-03-04 11:53:32
|
Do thos@Rootclass Node {@Textpublic int id;public Node(@Text int id){this.id = id;}}
@Defaultclass Edge {Node from;Node to;}
Niall--- On Wed, 2/3/11, gato chlr <da...@gm...> wrote:
From: gato chlr <da...@gm...>
Subject: [Simple-support] how to deserialize without setter and getters
To: sim...@li...
Received: Wednesday, 2 March, 2011, 9:37 AM
Hi list
I'm receiving the next xml:
<edge>
<to>10</to>
<from>20</from>
</edge>
the value for elements 'to' and 'from' is the Node class 'id'
the classes are the next:
class Edge{
Node from;
Node to;
//..setters and getters
}
and
Class Node{
int id;
public Node(int id){
this.id=id;
//no setters and getters
}
how can I perform the annotations in order to unmarshall (deserialize) from that xml??
I have read some of the tutorial but, there is some similar problem, but I have failed on the implementation, that's because I'm new using Simple.
Thanks a lot.
#yiv2031589334 #yiv2031589334avg_ls_inline_popup {padding:0px 0px;margin-left:0px;margin-top:0px;width:240px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:13px;}
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Niall G. <gal...@ya...> - 2011-03-04 11:49:59
|
Hi,
Very shortly you will be able to do this, via something like this.
@VariantList({
@ElementList(entry="cleanDir", type=CleanDirCommand.class),
@ElementList(entry="copy", type=CopyCommand.class)
})
private List<Command> commands;
I have nearly completed this. It should be released in about a week or two. At the moment you would have to use the @Convert annotation and write a converter.
Niall
> I have an XML file that looks like this :
>
> /------------------- sample-script.xml
> -------------------------\
>
> <script>
> <copy srcDir="src" destDir="dest"
> filePattern="*.dep" />
> <cleanDir dir="log" />
> <!-- Other commands ....
> -->
> </script>
>
> \-------------------------- END
> -------------------------------/
>
>
> I want to parse the sequence of commands, each type of
> command transforming
> into a different class.
> I would like to avoid the use of "class='foo.Bar'"
> attributes.
>
>
> Here are 3 classes :
>
> /------------------- Script.java
> ------------------------------\
>
> @Root(name="script")
> public class Script {
> @ElementList(inline=true)
> private List<ICommand> commands;
> }
>
> \-------------------------- END
> -----------------------------/
>
>
> /--------------- CommandCopy.java
> -------------------------\
>
> @Root(name="copy")
> public class CommandCopy implements ICommand {
>
> @Attribute
> private String srcDir;
>
> @Attribute
> private String destDir;
>
> @Attribute(required=false)
> private String fileFilter = "*.*";
> }
>
> \------------------------ END
> ---------------------------------/
>
>
> /-------------- CommandCleanDir.java
> -------------------------\
>
> @Root(name="cleanDir")
> public class CommandCleanDir implements ICommand {
>
> // -- Attributes
> @Attribute
> private String dir;
> }
>
> \------------------------ END
> ---------------------------------/
>
> All those classes are in the same package.
> When I try parse this, I get the following error :
> org.simpleframework.xml.core.ElementException: Element
> 'copy' does not have
> a match in class fr.whatever.Script at line -1
>
> I think that Simple-XML could guess the class I want to
> instantiate, based
> on the @Root(name="something") annotation of the class.
> Should I register
> all the possible classes somewhere ? Or does simùple-XML
> finds out all
> annotated classes on his own ?
>
> Is there some way to achieve what I want with Simple-XML ?
>
> Thanks in advance for your help.
> Raphael
>
>
> --
> View this message in context: http://old.nabble.com/How-to-deserialize-an-heterogeneous-sequence-of-elements-tp30985952p30985952.html
> Sent from the Simple XML Serialization mailing list archive
> at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs
> and other IT data in
> Real-Time with Splunk. Collect, index and harness all the
> fast moving IT data
> generated by your applications, servers and devices whether
> physical, virtual
> or in the cloud. Deliver compliance at lower cost and gain
> new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|
|
From: Alexander S. <ir...@gm...> - 2011-03-03 16:18:55
|
Or declare separate fields and override only getter
С уважением, Александр Щеголев.
03.03.2011, в 19:04, gato chlr <da...@gm...> написал(а):
> I have the next structure:
>
> class Element{
> @Attribute(required = false)
> int id;
> setId(int id){
> this.id=id;
> }
> public getId(){
> return id;
> }
> }
> class Edge extends Element{
> @Element
> Node to;
> @Element
> Node from;
>
> //setters and getters for "to" and "from" attributes
> }
>
> class Node extends Element{
>
> public Node(int id){
> this.id=id;
> }
>
> }
>
> How to annotate the attribute 'id' in order to get it as an @text element of Node class, and also as a @Attribute of Edge class
>
> What I need, is a way to unserialize the next xml, using the above structure.
>
> <Edge id="5"><to>214</to><from>235</from></edge>
>
> The only thing solution I see , is to have a double annotation of id attribute, one in the parent class and the other in child class. But I don't know how to implementa that.
>
> Any Suggestions are welcome.
>
> Thanks for the help!
>
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT data
> generated by your applications, servers and devices whether physical, virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Alexander S. <ir...@gm...> - 2011-03-03 16:18:03
|
Override it in both classes
С уважением, Александр Щеголев.
03.03.2011, в 19:04, gato chlr <da...@gm...> написал(а):
> I have the next structure:
>
> class Element{
> @Attribute(required = false)
> int id;
> setId(int id){
> this.id=id;
> }
> public getId(){
> return id;
> }
> }
> class Edge extends Element{
> @Element
> Node to;
> @Element
> Node from;
>
> //setters and getters for "to" and "from" attributes
> }
>
> class Node extends Element{
>
> public Node(int id){
> this.id=id;
> }
>
> }
>
> How to annotate the attribute 'id' in order to get it as an @text element of Node class, and also as a @Attribute of Edge class
>
> What I need, is a way to unserialize the next xml, using the above structure.
>
> <Edge id="5"><to>214</to><from>235</from></edge>
>
> The only thing solution I see , is to have a double annotation of id attribute, one in the parent class and the other in child class. But I don't know how to implementa that.
>
> Any Suggestions are welcome.
>
> Thanks for the help!
>
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT data
> generated by your applications, servers and devices whether physical, virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: gato c. <da...@gm...> - 2011-03-03 16:05:02
|
I have the next structure:
class Element{
@Attribute(required = false)
int id;
setId(int id){
this.id=id;
}
public getId(){
return id;
}
}
class Edge extends Element{
@Element
Node to;
@Element
Node from;
//setters and getters for "to" and "from" attributes
}
class Node extends Element{
public Node(int id){
this.id=id;
}
}
How to annotate the attribute 'id' in order to get it as an @text element of
Node class, and also as a @Attribute of Edge class
What I need, is a way to unserialize the next xml, using the above
structure.
<Edge id="5"><to>214</to><from>235</from></edge>
The only thing solution I see , is to have a double annotation of id
attribute, one in the parent class and the other in child class. But I don't
know how to implementa that.
Any Suggestions are welcome.
Thanks for the help!
|
|
From: Александр (R. Щ. <ir...@gm...> - 2011-03-02 21:43:32
|
Seems like you've missed @Text annotation for field id...
2011/3/3 gato chlr <da...@gm...>
> for example:
>
> <node>321</node>
>
> where 321 is the id of the node. node tag does not have attributes or
> elements. it just has the 'id' value inside.
>
> I tried with :
>
> @Root
> public class Node{
> //don't know how to annotate the id.
> private int id;
> public To(int id){
> this.id=id;
> }
> }
>
> thanks for the help.
>
>
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT
> data
> generated by your applications, servers and devices whether physical,
> virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
--
Fairly,
Alexander (Ryoka) Shchegolev
|
|
From: gato c. <da...@gm...> - 2011-03-02 21:36:29
|
for example:
<node>321</node>
where 321 is the id of the node. node tag does not have attributes or
elements. it just has the 'id' value inside.
I tried with :
@Root
public class Node{
//don't know how to annotate the id.
private int id;
public To(int id){
this.id=id;
}
}
thanks for the help.
|
|
From: gato c. <da...@gm...> - 2011-03-02 17:40:46
|
Hi list
I'm receiving the next xml:
<edge>
<to>10</to>
<from>20</from>
</edge>
the value for elements 'to' and 'from' is the Node class 'id'
the classes are the next:
class Edge{
Node from;
Node to;
//..setters and getters
}
and
Class Node{
int id;
public Node(int id){
this.id=id;
//no setters and getters
}
how can I perform the annotations in order to unmarshall (deserialize) from
that xml??
I have read some of the tutorial but, there is some similar problem, but I
have failed on the implementation, that's because I'm new using Simple.
Thanks a lot.
|
|
From: RaphaelJ <rap...@gm...> - 2011-03-02 12:05:06
|
Hello,
I have an XML file that looks like this :
/------------------- sample-script.xml -------------------------\
<script>
<copy srcDir="src" destDir="dest" filePattern="*.dep" />
<cleanDir dir="log" />
<!-- Other commands .... -->
</script>
\-------------------------- END -------------------------------/
I want to parse the sequence of commands, each type of command transforming
into a different class.
I would like to avoid the use of "class='foo.Bar'" attributes.
Here are 3 classes :
/------------------- Script.java ------------------------------\
@Root(name="script")
public class Script {
@ElementList(inline=true)
private List<ICommand> commands;
}
\-------------------------- END -----------------------------/
/--------------- CommandCopy.java -------------------------\
@Root(name="copy")
public class CommandCopy implements ICommand {
@Attribute
private String srcDir;
@Attribute
private String destDir;
@Attribute(required=false)
private String fileFilter = "*.*";
}
\------------------------ END ---------------------------------/
/-------------- CommandCleanDir.java -------------------------\
@Root(name="cleanDir")
public class CommandCleanDir implements ICommand {
// -- Attributes
@Attribute
private String dir;
}
\------------------------ END ---------------------------------/
All those classes are in the same package.
When I try parse this, I get the following error :
org.simpleframework.xml.core.ElementException: Element 'copy' does not have
a match in class fr.whatever.Script at line -1
I think that Simple-XML could guess the class I want to instantiate, based
on the @Root(name="something") annotation of the class. Should I register
all the possible classes somewhere ? Or does simùple-XML finds out all
annotated classes on his own ?
Is there some way to achieve what I want with Simple-XML ?
Thanks in advance for your help.
Raphael
--
View this message in context: http://old.nabble.com/How-to-deserialize-an-heterogeneous-sequence-of-elements-tp30985952p30985952.html
Sent from the Simple XML Serialization mailing list archive at Nabble.com.
|
|
From: Niall G. <gal...@ya...> - 2011-03-02 11:26:10
|
Cool, I will take a look at adding something like this in a future release. I am currently finishing of a new feature. So ill take a look after that. Thanks for the feed back.
--- On Tue, 1/3/11, hatchetman82 <hat...@gm...> wrote:
> From: hatchetman82 <hat...@gm...>
> Subject: Re: [Simple-support] stating the deserialization strategy on a class using annotation
> To: "Niall Gallagher" <gal...@ya...>
> Cc: sim...@li...
> Received: Tuesday, 1 March, 2011, 3:37 AM
> we will. i just thought this feature
> might be useful in a more general
> sense, so i brought the idea here.
>
> On Tue, Mar 1, 2011 at 13:31, Niall Gallagher <gal...@ya...>
> wrote:
> > Why not create this annotation yourself. It seems
> specific to what your doing so just created it in your own
> package. It will works just as well. Just wrap the Persister
> in a Serliaizer implementation that uses this annotation.
> >
> >
> > --- On Mon, 28/2/11, hatchetman82 <hat...@gm...>
> wrote:
> >
> >> From: hatchetman82 <hat...@gm...>
> >> Subject: Re: [Simple-support] stating the
> deserialization strategy on a class using annotation
> >> To: "Niall Gallagher" <gal...@ya...>
> >> Cc: sim...@li...
> >> Received: Monday, 28 February, 2011, 4:02 AM
> >> we have an enterprise system with a
> >> REST api. basically we're sending
> >> and receiving XML over HTTP.
> >> all of our methods send or receive
> Simple-xml-annotated
> >> classes that
> >> represent either requests or responses. RESTeasy
> (the
> >> framework we use
> >> to drive this API) provides a mechanism to
> derialize and
> >> deserialize
> >> Objects into their string representation (XML in
> our case)
> >> via its
> >> MessageBodyReader and MessageBodyWriter
> interfaces.
> >> our use case revolves around the reader component.
> this is
> >> the
> >> component that gets an input stream and a class
> type and
> >> is
> >> responsible for deserializing an instance of this
> class
> >> type from the
> >> input stream.
> >>
> >> some of our simple-annotated classes require a
> strategy to
> >> deserialize
> >> (this strategy needs to be provided as an argument
> to the
> >> Persister
> >> constructor). since we know what type we intend
> to
> >> deserialize, we can
> >> provide the appropriate strategy, but the
> resulting code is
> >> a giant
> >> switchboard of if-elses and it not very pretty,
> fast or
> >> maintainable
> >> as a result (this message body reader is a single
> point of
> >> entry to
> >> the entire application).
> >>
> >> since Persister receives the type to be serialized
> as the
> >> 1st argument
> >> to its read() method, i was thinking it would have
> been
> >> nice to be
> >> able to state the deserialization strategy on the
> >> simple-annotated
> >> class somehow.
> >>
> >> so, for instance, instead of doing this:
> >>
> >> Strategy s = getStrategy(type); //ugly code hidden
> here
> >> Persister p = new Persister(s);
> >> Object result = s.read(type,inputStream);
> >>
> >> i could have something like this on my class:
> >>
> >> @DeserializationStrategy(MyStrategy.class)
> >> @Root(name="myClass")
> >> public class MyClass {
> >> //code here
> >> }
> >>
> >> and then i could create a Persister using the
> no-arg
> >> constructor, and
> >> upon calling read() the persister could inspect
> the type
> >> (its getting
> >> it as the 1st arg anyway) for
> @DeserializationStrategy, and
> >> if found
> >> use that strategy to read the object from the
> input
> >> stream.
> >> that would save us the need to find the strategy
> ourselves,
> >> and would
> >> make the resulting code more elegant
> >>
> >> On Mon, Feb 28, 2011 at 13:09, Niall Gallagher
> >> <gal...@ya...>
> >> wrote:
> >> > Hi,
> >> >
> >> > If you could provide more details that would
> be great!
> >> Not sure what your trying to achieve here. Have
> you tried
> >> the @Convert annotation or even a visitor?
> >> >
> >> > Niall
> >> >
> >> >
> >> > --- On Sun, 27/2/11, hatchetman82 <hat...@gm...>
> >> wrote:
> >> >
> >> >> From: hatchetman82 <hat...@gm...>
> >> >> Subject: [Simple-support] stating the
> >> deserialization strategy on a class using
> annotation
> >> >> To: sim...@li...
> >> >> Received: Sunday, 27 February, 2011,
> 10:47 PM
> >> >> Hi.
> >> >>
> >> >> we use simple-xml to (de)serialize entity
> classes
> >> for out
> >> >> application's REST api (using resteasy).
> >> >> as part of the RESTeay api, there's an
> interface
> >> called
> >> >> MessageBodyReader responsible for
> deserializing
> >> XML into a
> >> >> java class
> >> >> with the following signature:
> >> >> public Object readFrom(Class type, /*
> stuff
> >> omitted */,
> >> >> InputStream
> >> >> inputStream);
> >> >> deserializing some of our classes
> requires custom
> >> Strategy
> >> >> implementations, which turns the
> implementation of
> >> the
> >> >> above method
> >> >> int a giant switchboard of if-elses
> according to
> >> the type
> >> >> variable. it
> >> >> would be very nice to be able to have
> some sort
> >> of
> >> >> @DeserializationStrategy(value=[some
> strategy
> >> class])
> >> >> annotation on
> >> >> simple-xml-annotated classes to prevent
> this
> >> scenario.
> >> >> is this possible?
> >> >> if so, is it on the roadmap anywhere?
> >> >>
> >> >> thanks in advance for any assistance,
> >> >> radai.
> >> >>
> >> >>
> >>
> ------------------------------------------------------------------------------
> >> >> Free Software Download: Index, Search
> &
> >> Analyze Logs
> >> >> and other IT data in
> >> >> Real-Time with Splunk. Collect, index and
> harness
> >> all the
> >> >> fast moving IT data
> >> >> generated by your applications, servers
> and
> >> devices whether
> >> >> physical, virtual
> >> >> or in the cloud. Deliver compliance at
> lower cost
> >> and gain
> >> >> new business
> >> >> insights. http://p.sf.net/sfu/splunk-dev2dev
> >> >>
> _______________________________________________
> >> >> Simple-support mailing list
> >> >> Sim...@li...
> >> >> https://lists.sourceforge.net/lists/listinfo/simple-support
> >> >>
> >> >
> >> >
> >> >
> >> >
> >>
> >
> >
> >
> >
>
|
|
From: hatchetman82 <hat...@gm...> - 2011-03-01 11:38:16
|
we will. i just thought this feature might be useful in a more general
sense, so i brought the idea here.
On Tue, Mar 1, 2011 at 13:31, Niall Gallagher <gal...@ya...> wrote:
> Why not create this annotation yourself. It seems specific to what your doing so just created it in your own package. It will works just as well. Just wrap the Persister in a Serliaizer implementation that uses this annotation.
>
>
> --- On Mon, 28/2/11, hatchetman82 <hat...@gm...> wrote:
>
>> From: hatchetman82 <hat...@gm...>
>> Subject: Re: [Simple-support] stating the deserialization strategy on a class using annotation
>> To: "Niall Gallagher" <gal...@ya...>
>> Cc: sim...@li...
>> Received: Monday, 28 February, 2011, 4:02 AM
>> we have an enterprise system with a
>> REST api. basically we're sending
>> and receiving XML over HTTP.
>> all of our methods send or receive Simple-xml-annotated
>> classes that
>> represent either requests or responses. RESTeasy (the
>> framework we use
>> to drive this API) provides a mechanism to derialize and
>> deserialize
>> Objects into their string representation (XML in our case)
>> via its
>> MessageBodyReader and MessageBodyWriter interfaces.
>> our use case revolves around the reader component. this is
>> the
>> component that gets an input stream and a class type and
>> is
>> responsible for deserializing an instance of this class
>> type from the
>> input stream.
>>
>> some of our simple-annotated classes require a strategy to
>> deserialize
>> (this strategy needs to be provided as an argument to the
>> Persister
>> constructor). since we know what type we intend to
>> deserialize, we can
>> provide the appropriate strategy, but the resulting code is
>> a giant
>> switchboard of if-elses and it not very pretty, fast or
>> maintainable
>> as a result (this message body reader is a single point of
>> entry to
>> the entire application).
>>
>> since Persister receives the type to be serialized as the
>> 1st argument
>> to its read() method, i was thinking it would have been
>> nice to be
>> able to state the deserialization strategy on the
>> simple-annotated
>> class somehow.
>>
>> so, for instance, instead of doing this:
>>
>> Strategy s = getStrategy(type); //ugly code hidden here
>> Persister p = new Persister(s);
>> Object result = s.read(type,inputStream);
>>
>> i could have something like this on my class:
>>
>> @DeserializationStrategy(MyStrategy.class)
>> @Root(name="myClass")
>> public class MyClass {
>> //code here
>> }
>>
>> and then i could create a Persister using the no-arg
>> constructor, and
>> upon calling read() the persister could inspect the type
>> (its getting
>> it as the 1st arg anyway) for @DeserializationStrategy, and
>> if found
>> use that strategy to read the object from the input
>> stream.
>> that would save us the need to find the strategy ourselves,
>> and would
>> make the resulting code more elegant
>>
>> On Mon, Feb 28, 2011 at 13:09, Niall Gallagher
>> <gal...@ya...>
>> wrote:
>> > Hi,
>> >
>> > If you could provide more details that would be great!
>> Not sure what your trying to achieve here. Have you tried
>> the @Convert annotation or even a visitor?
>> >
>> > Niall
>> >
>> >
>> > --- On Sun, 27/2/11, hatchetman82 <hat...@gm...>
>> wrote:
>> >
>> >> From: hatchetman82 <hat...@gm...>
>> >> Subject: [Simple-support] stating the
>> deserialization strategy on a class using annotation
>> >> To: sim...@li...
>> >> Received: Sunday, 27 February, 2011, 10:47 PM
>> >> Hi.
>> >>
>> >> we use simple-xml to (de)serialize entity classes
>> for out
>> >> application's REST api (using resteasy).
>> >> as part of the RESTeay api, there's an interface
>> called
>> >> MessageBodyReader responsible for deserializing
>> XML into a
>> >> java class
>> >> with the following signature:
>> >> public Object readFrom(Class type, /* stuff
>> omitted */,
>> >> InputStream
>> >> inputStream);
>> >> deserializing some of our classes requires custom
>> Strategy
>> >> implementations, which turns the implementation of
>> the
>> >> above method
>> >> int a giant switchboard of if-elses according to
>> the type
>> >> variable. it
>> >> would be very nice to be able to have some sort
>> of
>> >> @DeserializationStrategy(value=[some strategy
>> class])
>> >> annotation on
>> >> simple-xml-annotated classes to prevent this
>> scenario.
>> >> is this possible?
>> >> if so, is it on the roadmap anywhere?
>> >>
>> >> thanks in advance for any assistance,
>> >> radai.
>> >>
>> >>
>> ------------------------------------------------------------------------------
>> >> Free Software Download: Index, Search &
>> Analyze Logs
>> >> and other IT data in
>> >> Real-Time with Splunk. Collect, index and harness
>> all the
>> >> fast moving IT data
>> >> generated by your applications, servers and
>> devices whether
>> >> physical, virtual
>> >> or in the cloud. Deliver compliance at lower cost
>> and gain
>> >> new business
>> >> insights. http://p.sf.net/sfu/splunk-dev2dev
>> >> _______________________________________________
>> >> Simple-support mailing list
>> >> Sim...@li...
>> >> https://lists.sourceforge.net/lists/listinfo/simple-support
>> >>
>> >
>> >
>> >
>> >
>>
>
>
>
>
|
|
From: Niall G. <gal...@ya...> - 2011-03-01 11:31:27
|
Why not create this annotation yourself. It seems specific to what your doing so just created it in your own package. It will works just as well. Just wrap the Persister in a Serliaizer implementation that uses this annotation.
--- On Mon, 28/2/11, hatchetman82 <hat...@gm...> wrote:
> From: hatchetman82 <hat...@gm...>
> Subject: Re: [Simple-support] stating the deserialization strategy on a class using annotation
> To: "Niall Gallagher" <gal...@ya...>
> Cc: sim...@li...
> Received: Monday, 28 February, 2011, 4:02 AM
> we have an enterprise system with a
> REST api. basically we're sending
> and receiving XML over HTTP.
> all of our methods send or receive Simple-xml-annotated
> classes that
> represent either requests or responses. RESTeasy (the
> framework we use
> to drive this API) provides a mechanism to derialize and
> deserialize
> Objects into their string representation (XML in our case)
> via its
> MessageBodyReader and MessageBodyWriter interfaces.
> our use case revolves around the reader component. this is
> the
> component that gets an input stream and a class type and
> is
> responsible for deserializing an instance of this class
> type from the
> input stream.
>
> some of our simple-annotated classes require a strategy to
> deserialize
> (this strategy needs to be provided as an argument to the
> Persister
> constructor). since we know what type we intend to
> deserialize, we can
> provide the appropriate strategy, but the resulting code is
> a giant
> switchboard of if-elses and it not very pretty, fast or
> maintainable
> as a result (this message body reader is a single point of
> entry to
> the entire application).
>
> since Persister receives the type to be serialized as the
> 1st argument
> to its read() method, i was thinking it would have been
> nice to be
> able to state the deserialization strategy on the
> simple-annotated
> class somehow.
>
> so, for instance, instead of doing this:
>
> Strategy s = getStrategy(type); //ugly code hidden here
> Persister p = new Persister(s);
> Object result = s.read(type,inputStream);
>
> i could have something like this on my class:
>
> @DeserializationStrategy(MyStrategy.class)
> @Root(name="myClass")
> public class MyClass {
> //code here
> }
>
> and then i could create a Persister using the no-arg
> constructor, and
> upon calling read() the persister could inspect the type
> (its getting
> it as the 1st arg anyway) for @DeserializationStrategy, and
> if found
> use that strategy to read the object from the input
> stream.
> that would save us the need to find the strategy ourselves,
> and would
> make the resulting code more elegant
>
> On Mon, Feb 28, 2011 at 13:09, Niall Gallagher
> <gal...@ya...>
> wrote:
> > Hi,
> >
> > If you could provide more details that would be great!
> Not sure what your trying to achieve here. Have you tried
> the @Convert annotation or even a visitor?
> >
> > Niall
> >
> >
> > --- On Sun, 27/2/11, hatchetman82 <hat...@gm...>
> wrote:
> >
> >> From: hatchetman82 <hat...@gm...>
> >> Subject: [Simple-support] stating the
> deserialization strategy on a class using annotation
> >> To: sim...@li...
> >> Received: Sunday, 27 February, 2011, 10:47 PM
> >> Hi.
> >>
> >> we use simple-xml to (de)serialize entity classes
> for out
> >> application's REST api (using resteasy).
> >> as part of the RESTeay api, there's an interface
> called
> >> MessageBodyReader responsible for deserializing
> XML into a
> >> java class
> >> with the following signature:
> >> public Object readFrom(Class type, /* stuff
> omitted */,
> >> InputStream
> >> inputStream);
> >> deserializing some of our classes requires custom
> Strategy
> >> implementations, which turns the implementation of
> the
> >> above method
> >> int a giant switchboard of if-elses according to
> the type
> >> variable. it
> >> would be very nice to be able to have some sort
> of
> >> @DeserializationStrategy(value=[some strategy
> class])
> >> annotation on
> >> simple-xml-annotated classes to prevent this
> scenario.
> >> is this possible?
> >> if so, is it on the roadmap anywhere?
> >>
> >> thanks in advance for any assistance,
> >> radai.
> >>
> >>
> ------------------------------------------------------------------------------
> >> Free Software Download: Index, Search &
> Analyze Logs
> >> and other IT data in
> >> Real-Time with Splunk. Collect, index and harness
> all the
> >> fast moving IT data
> >> generated by your applications, servers and
> devices whether
> >> physical, virtual
> >> or in the cloud. Deliver compliance at lower cost
> and gain
> >> new business
> >> insights. http://p.sf.net/sfu/splunk-dev2dev
> >> _______________________________________________
> >> Simple-support mailing list
> >> Sim...@li...
> >> https://lists.sourceforge.net/lists/listinfo/simple-support
> >>
> >
> >
> >
> >
>
|
|
From: Александр (R. Щ. <ir...@gm...> - 2011-02-28 19:07:50
|
the easiest way: @Root(name="mt:MyClass") class MyClas {...}
2011/2/28 gato chlr <da...@gm...>
> Hi ,
>
> I have just started with Simple, well my question is simple ;)
>
> how can I put a prefix in the root element, in order to get something like
> this
>
> class MyTree{
> .....
> }
>
> <mt:MyTree>
>
> ........
> ........
>
>
> </mt:MyTree>
>
> Thanks
>
>
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT
> data
> generated by your applications, servers and devices whether physical,
> virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
--
Fairly,
Alexander (Ryoka) Shchegolev
|
|
From: gato c. <da...@gm...> - 2011-02-28 18:58:25
|
Hi ,
I have just started with Simple, well my question is simple ;)
how can I put a prefix in the root element, in order to get something like
this
class MyTree{
.....
}
<mt:MyTree>
........
........
</mt:MyTree>
Thanks
|
|
From: hatchetman82 <hat...@gm...> - 2011-02-28 12:03:26
|
we have an enterprise system with a REST api. basically we're sending
and receiving XML over HTTP.
all of our methods send or receive Simple-xml-annotated classes that
represent either requests or responses. RESTeasy (the framework we use
to drive this API) provides a mechanism to derialize and deserialize
Objects into their string representation (XML in our case) via its
MessageBodyReader and MessageBodyWriter interfaces.
our use case revolves around the reader component. this is the
component that gets an input stream and a class type and is
responsible for deserializing an instance of this class type from the
input stream.
some of our simple-annotated classes require a strategy to deserialize
(this strategy needs to be provided as an argument to the Persister
constructor). since we know what type we intend to deserialize, we can
provide the appropriate strategy, but the resulting code is a giant
switchboard of if-elses and it not very pretty, fast or maintainable
as a result (this message body reader is a single point of entry to
the entire application).
since Persister receives the type to be serialized as the 1st argument
to its read() method, i was thinking it would have been nice to be
able to state the deserialization strategy on the simple-annotated
class somehow.
so, for instance, instead of doing this:
Strategy s = getStrategy(type); //ugly code hidden here
Persister p = new Persister(s);
Object result = s.read(type,inputStream);
i could have something like this on my class:
@DeserializationStrategy(MyStrategy.class)
@Root(name="myClass")
public class MyClass {
//code here
}
and then i could create a Persister using the no-arg constructor, and
upon calling read() the persister could inspect the type (its getting
it as the 1st arg anyway) for @DeserializationStrategy, and if found
use that strategy to read the object from the input stream.
that would save us the need to find the strategy ourselves, and would
make the resulting code more elegant
On Mon, Feb 28, 2011 at 13:09, Niall Gallagher
<gal...@ya...> wrote:
> Hi,
>
> If you could provide more details that would be great! Not sure what your trying to achieve here. Have you tried the @Convert annotation or even a visitor?
>
> Niall
>
>
> --- On Sun, 27/2/11, hatchetman82 <hat...@gm...> wrote:
>
>> From: hatchetman82 <hat...@gm...>
>> Subject: [Simple-support] stating the deserialization strategy on a class using annotation
>> To: sim...@li...
>> Received: Sunday, 27 February, 2011, 10:47 PM
>> Hi.
>>
>> we use simple-xml to (de)serialize entity classes for out
>> application's REST api (using resteasy).
>> as part of the RESTeay api, there's an interface called
>> MessageBodyReader responsible for deserializing XML into a
>> java class
>> with the following signature:
>> public Object readFrom(Class type, /* stuff omitted */,
>> InputStream
>> inputStream);
>> deserializing some of our classes requires custom Strategy
>> implementations, which turns the implementation of the
>> above method
>> int a giant switchboard of if-elses according to the type
>> variable. it
>> would be very nice to be able to have some sort of
>> @DeserializationStrategy(value=[some strategy class])
>> annotation on
>> simple-xml-annotated classes to prevent this scenario.
>> is this possible?
>> if so, is it on the roadmap anywhere?
>>
>> thanks in advance for any assistance,
>> radai.
>>
>> ------------------------------------------------------------------------------
>> Free Software Download: Index, Search & Analyze Logs
>> and other IT data in
>> Real-Time with Splunk. Collect, index and harness all the
>> fast moving IT data
>> generated by your applications, servers and devices whether
>> physical, virtual
>> or in the cloud. Deliver compliance at lower cost and gain
>> new business
>> insights. http://p.sf.net/sfu/splunk-dev2dev
>> _______________________________________________
>> Simple-support mailing list
>> Sim...@li...
>> https://lists.sourceforge.net/lists/listinfo/simple-support
>>
>
>
>
>
|
|
From: Niall G. <gal...@ya...> - 2011-02-28 11:09:11
|
Hi, If you could provide more details that would be great! Not sure what your trying to achieve here. Have you tried the @Convert annotation or even a visitor? Niall --- On Sun, 27/2/11, hatchetman82 <hat...@gm...> wrote: > From: hatchetman82 <hat...@gm...> > Subject: [Simple-support] stating the deserialization strategy on a class using annotation > To: sim...@li... > Received: Sunday, 27 February, 2011, 10:47 PM > Hi. > > we use simple-xml to (de)serialize entity classes for out > application's REST api (using resteasy). > as part of the RESTeay api, there's an interface called > MessageBodyReader responsible for deserializing XML into a > java class > with the following signature: > public Object readFrom(Class type, /* stuff omitted */, > InputStream > inputStream); > deserializing some of our classes requires custom Strategy > implementations, which turns the implementation of the > above method > int a giant switchboard of if-elses according to the type > variable. it > would be very nice to be able to have some sort of > @DeserializationStrategy(value=[some strategy class]) > annotation on > simple-xml-annotated classes to prevent this scenario. > is this possible? > if so, is it on the roadmap anywhere? > > thanks in advance for any assistance, > radai. > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs > and other IT data in > Real-Time with Splunk. Collect, index and harness all the > fast moving IT data > generated by your applications, servers and devices whether > physical, virtual > or in the cloud. Deliver compliance at lower cost and gain > new business > insights. http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > |
|
From: hatchetman82 <hat...@gm...> - 2011-02-28 06:47:44
|
Hi. we use simple-xml to (de)serialize entity classes for out application's REST api (using resteasy). as part of the RESTeay api, there's an interface called MessageBodyReader responsible for deserializing XML into a java class with the following signature: public Object readFrom(Class type, /* stuff omitted */, InputStream inputStream); deserializing some of our classes requires custom Strategy implementations, which turns the implementation of the above method int a giant switchboard of if-elses according to the type variable. it would be very nice to be able to have some sort of @DeserializationStrategy(value=[some strategy class]) annotation on simple-xml-annotated classes to prevent this scenario. is this possible? if so, is it on the roadmap anywhere? thanks in advance for any assistance, radai. |
|
From: Niall G. <gal...@ya...> - 2011-02-26 01:31:52
|
Hi, 1) No there is no such tool 2) Not sure what your asing here 3) Namespaces only need to be declared once, there is very little repetition Niall --- On Fri, 25/2/11, Eduardo Martins <emm...@gm...> wrote: > From: Eduardo Martins <emmartins@gmail .com> > Subject: Re: [Simple-support] Information about Simple Framework and Tools > To: sim...@li... > Received: Friday, 25 February, 2011, 5:13 AM > Hi, is there someone kind to reply? > > -- Eduardo > .............................................. > http://emmartins.blogspot.com > http://redhat.com/solutions/telco > > > > On Thu, Feb 17, 2011 at 12:02 PM, Eduardo Martins <emm...@gm...> > wrote: > > Hi, I'm currently evaluating the replacement of JAXB > with Simple, and > > need some information, which I couldn't find in the > website: > > > > 1) Is there a tool similar to xjc, which takes xsd as > input and > > produces the pojos? > > > > 2) Is Simple able to mix different set of pojos, bound > to different > > namespaces? For instance consider a schema which has > an element that > > can be extended with another qualified element, such > as > > > > <xs:any namespace="##other" processContents="lax" > minOccurs="0" > > maxOccurs="unbounded"/> > > > > Now we throw some xml to Simple for deserialization, > and in that "any" > > position comes an element bound to another set of > Simple pojos, with > > different namespace(s), will the framework deserialize > that element > > too into its own pojos? > > > > 3) Regarding serialization, and this is the major > reason why I'm > > considering to leave JAXB, when there is a JAXBContext > bound to > > multiple namespaces, the serialized xml root element > will be "bloated" > > with all possible namespaces, even if there are no > children elements > > with these namespaces. How does Simple handles such > cases, same > > procedure as jaxb? Includes in root element only the > uses namespaces? > > Declares "children" namespaces in all children > elements, thus > > introducing multiplies declarations of same > namespaces? > > > > Thanks in advance. > > > > -- Eduardo > > .............................................. > > http://emmartins.blogspot.com > > http://redhat.com/solutions/telco > > > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs > and other IT data in > Real-Time with Splunk. Collect, index and harness all the > fast moving IT data > generated by your applications, servers and devices whether > physical, virtual > or in the cloud. Deliver compliance at lower cost and gain > new business > insights. http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > |
|
From: jimmy Z. <jz...@xi...> - 2011-02-25 22:12:53
|
VTD-XML 2.10 is now released. It can be downloaded at https://sourceforge.net/projects/vtd-xml/files/vtd-xml/ximpleware_2.10/. This release includes a number of new features and enhancement. * The core API of VTD-XML has been expanded. Users can now perform cut/paste/insert on an empty element. * This release also adds the support of deeper location cache support for parsing and indexing. This feature is useful for application performance tuning for processing various XML documents. * The java version also added support for processing zip and gzip files. Direct processing of httpURL based XML is enhanced. * Extended Java version now support Iso-8859-10~16 encoding. * A full featured C++ port is released. * C version of VTD-XML now make use of thread local storage to achieve thread safety for multi-threaded application. * There are also a number of bugs fixed. Special thanks to Jozef Aerts, John Sillers, Chris Tornau and a number of other users for input and suggestions |