simple-support Mailing List for Simple (Page 2)
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: adev d. <and...@gm...> - 2015-02-17 11:26:20
|
Great! One more question. How to modify this InputNode in order to apply
this new name "y". I assume after changing node I have to call
super.read(). Thank you!
On 17 February 2015 at 07:57, Niall Gallagher - Yieldbroker <
Nia...@yi...> wrote:
> It would look something like this, check out the test cases I have done
> this very thing several times there.
>
>
>
> class MyStrategy extends AnnotationStrategy{
>
>
>
> @Override
>
> read(InputNode n, …) {
>
> String className = n.getAttribute(“class”).getValue();
>
>
>
> if(className.equals(“x”)) {
>
> className = “y”;
>
> }
>
> // etc…
>
> }
>
> }
>
>
>
>
>
> *From:* adev dev [mailto:and...@gm...]
> *Sent:* 17 February 2015 17:52
> *To:* Niall Gallagher
> *Cc:* sim...@li...
> *Subject:* Re: [Simple-support] Deserializing polymorphic types.
>
>
>
> Niall, thank you for response. To be more specific, I create serializer
> with AnnotationStrategy:
>
>
>
> Strategy strategy = new AnnotationStrategy();
>
> mSerializer = new Persister(strategy);
>
>
>
> Than, I am using it to read slide:
>
> mSerializer.read(Slide.class, bis);
>
>
>
> Class Slide has list of elements of polimorphic type:
>
> @ElementList(name = "mList")
>
> private PrsArrayList<Element> mElementList = null;
>
> "Element" is base class of the things which are serialized.
>
>
>
> Could you please provide some pseudo code how to achieve the goal?? How to
> do this mapping? Thank you!
>
>
>
> On 16 February 2015 at 23:12, Niall Gallagher <gal...@ya...>
> wrote:
>
> Ya, you can use a Strategy or a Visitor to do this. Another alternative is
> to open a text editor and do a search an replace on the XML.
>
> --------------------------------------------
> On Tue, 17/2/15, adev dev <and...@gm...> wrote:
>
> Subject: [Simple-support] Deserializing polymorphic types.
> To: sim...@li...
> Received: Tuesday, 17 February, 2015, 2:03 AM
>
>
> I am using SimpleXML
> to serialize classes. I am serializing polymorphic types as
> well.
> Due to this I came across a problem. I would like
> to do code refactoring and move some classes between
> packages. After I did it old XML files created before
> refactoring cannot be read. Simple framwork is throwing
> exception that class is not found. In XML full path to class
> is stored so after I changed class package class cannot not
> be found. What is the solution to this problem? Is there any
> way to apply kind of mapping between old and new class
> location???
> Thank you,
> BR, M
>
> -----Inline Attachment Follows-----
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT
> Server
> from Actuate! Instantly Supercharge Your Business Reports
> and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App
> Integration & more
> Get technology previously reserved for billion-dollar
> corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
> -----Inline Attachment Follows-----
>
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
>
|
|
From: Niall G. - Y. <Nia...@yi...> - 2015-02-17 06:57:42
|
It would look something like this, check out the test cases I have done this very thing several times there.
class MyStrategy extends AnnotationStrategy{
@Override
read(InputNode n, …) {
String className = n.getAttribute(“class”).getValue();
if(className.equals(“x”)) {
className = “y”;
}
// etc…
}
}
From: adev dev [mailto:and...@gm...]
Sent: 17 February 2015 17:52
To: Niall Gallagher
Cc: sim...@li...
Subject: Re: [Simple-support] Deserializing polymorphic types.
Niall, thank you for response. To be more specific, I create serializer with AnnotationStrategy:
Strategy strategy = new AnnotationStrategy();
mSerializer = new Persister(strategy);
Than, I am using it to read slide:
mSerializer.read(Slide.class, bis);
Class Slide has list of elements of polimorphic type:
@ElementList(name = "mList")
private PrsArrayList<Element> mElementList = null;
"Element" is base class of the things which are serialized.
Could you please provide some pseudo code how to achieve the goal?? How to do this mapping? Thank you!
On 16 February 2015 at 23:12, Niall Gallagher <gal...@ya...<mailto:gal...@ya...>> wrote:
Ya, you can use a Strategy or a Visitor to do this. Another alternative is to open a text editor and do a search an replace on the XML.
--------------------------------------------
On Tue, 17/2/15, adev dev <and...@gm...<mailto:and...@gm...>> wrote:
Subject: [Simple-support] Deserializing polymorphic types.
To: sim...@li...<mailto:sim...@li...>
Received: Tuesday, 17 February, 2015, 2:03 AM
I am using SimpleXML
to serialize classes. I am serializing polymorphic types as
well.
Due to this I came across a problem. I would like
to do code refactoring and move some classes between
packages. After I did it old XML files created before
refactoring cannot be read. Simple framwork is throwing
exception that class is not found. In XML full path to class
is stored so after I changed class package class cannot not
be found. What is the solution to this problem? Is there any
way to apply kind of mapping between old and new class
location???
Thank you,
BR, M
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT
Server
from Actuate! Instantly Supercharge Your Business Reports
and Dashboards
with Interactivity, Sharing, Native Excel Exports, App
Integration & more
Get technology previously reserved for billion-dollar
corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...<mailto:Sim...@li...>
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: adev d. <and...@gm...> - 2015-02-17 06:51:42
|
Niall, thank you for response. To be more specific, I create serializer with AnnotationStrategy: Strategy strategy = new AnnotationStrategy(); mSerializer = new Persister(strategy); Than, I am using it to read slide: mSerializer.read(Slide.class, bis); Class Slide has list of elements of polimorphic type: @ElementList(name = "mList") private PrsArrayList<Element> mElementList = null; "Element" is base class of the things which are serialized. Could you please provide some pseudo code how to achieve the goal?? How to do this mapping? Thank you! On 16 February 2015 at 23:12, Niall Gallagher <gal...@ya...> wrote: > Ya, you can use a Strategy or a Visitor to do this. Another alternative is > to open a text editor and do a search an replace on the XML. > > -------------------------------------------- > On Tue, 17/2/15, adev dev <and...@gm...> wrote: > > Subject: [Simple-support] Deserializing polymorphic types. > To: sim...@li... > Received: Tuesday, 17 February, 2015, 2:03 AM > > I am using SimpleXML > to serialize classes. I am serializing polymorphic types as > well. > Due to this I came across a problem. I would like > to do code refactoring and move some classes between > packages. After I did it old XML files created before > refactoring cannot be read. Simple framwork is throwing > exception that class is not found. In XML full path to class > is stored so after I changed class package class cannot not > be found. What is the solution to this problem? Is there any > way to apply kind of mapping between old and new class > location??? > Thank you, > BR, M > -----Inline Attachment Follows----- > > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT > Server > from Actuate! Instantly Supercharge Your Business Reports > and Dashboards > with Interactivity, Sharing, Native Excel Exports, App > Integration & more > Get technology previously reserved for billion-dollar > corporations, FREE > > http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk > -----Inline Attachment Follows----- > > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > > |
|
From: Niall G. <gal...@ya...> - 2015-02-16 22:13:05
|
Ya, you can use a Strategy or a Visitor to do this. Another alternative is to open a text editor and do a search an replace on the XML. -------------------------------------------- On Tue, 17/2/15, adev dev <and...@gm...> wrote: Subject: [Simple-support] Deserializing polymorphic types. To: sim...@li... Received: Tuesday, 17 February, 2015, 2:03 AM I am using SimpleXML to serialize classes. I am serializing polymorphic types as well. Due to this I came across a problem. I would like to do code refactoring and move some classes between packages. After I did it old XML files created before refactoring cannot be read. Simple framwork is throwing exception that class is not found. In XML full path to class is stored so after I changed class package class cannot not be found. What is the solution to this problem? Is there any way to apply kind of mapping between old and new class location??? Thank you, BR, M -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: adev d. <and...@gm...> - 2015-02-16 15:03:38
|
I am using SimpleXML to serialize classes. I am serializing polymorphic types as well. Due to this I came across a problem. I would like to do code refactoring and move some classes between packages. After I did it old XML files created before refactoring cannot be read. Simple framwork is throwing exception that class is not found. In XML full path to class is stored so after I changed class package class cannot not be found. What is the solution to this problem? Is there any way to apply kind of mapping between old and new class location??? Thank you, BR, M |
|
From: Niall G. <gal...@ya...> - 2015-02-14 07:38:00
|
Support for what you want is not great, check out the InputSource.getSource (at least I think this is the method). This will give you access to the underlying XML parser, be it DOM or StAX, or on Android KXML. This will give you what you want for now.
--------------------------------------------
On Fri, 13/2/15, Kiran Rao <tec...@gm...> wrote:
Subject: Re: [Simple-support] Interpret a sub-element as String
To: "Niall Gallagher - Yieldbroker" <Nia...@yi...>, "Niall Gallagher" <gal...@ya...>, "simple-support" <sim...@li...>
Received: Friday, 13 February, 2015, 9:39 PM
@Niall,
Appreciate the time you are
taking to support this (and also thanks for all the hard
work in creating this wonderful library)!
I did give a try to using
Converters, however I could not figure out the exact way to
use them. I have gone through the examples but it is still
not clear to me.
For
my use case, I expect that the Converter#read method gives
me a partially parsed object - i.e, I have a RootElement
object with the description field already set. All I have to
do is extract the sub-element substring from the input
string and set it to the subElement field.
Similarly, during serialization, I
expect that the StringBuilder contains the description
serialized. I only need to fill in the sub-element
String.
However, I
found out that this is not how the Converter works. It looks
like if I intercept the parsing, I need to perform _all_
parsing manually. Is this understanding correct? How do I
deal with finding child elements in this
case?
On Fri Feb 13 2015 at
11:16:17 AM Niall Gallagher - Yieldbroker <Nia...@yi...>
wrote:
I was intending to add an @Literal
annotation, however I have not yet done it. For now you will
have to use a Converter, which can be used to intercept the
XML parsing and compose your own
result.
From: Kiran Rao [mailto:tec...@gm...]
Sent: 13 February 2015 15:25
To: Niall Gallagher;
simple-support
Subject: Re: [Simple-support] Interpret a sub-element
as String
Hi
Niall,
My requirement is after
parsing, subElement should contain the string that
represents sub-element in its entirety.
i.e.,
assert subElement ==
"<sub-element
id=\"1\"><name>Hello
World</name></sub-element>";
I admit this is not a
typical use case.
@Path("sub-element")
@Element(name="name")
public String
name;
This succeeds - but then
this is not what I want.
@Path("sub-element")
@Element
public String
name;
This results in a
ValueRequiredException.
On Fri Feb 13 2015 at
8:37:29 AM Niall Gallagher <gal...@ya...>
wrote:
Did you try
@Path("sub-element")
@Element(name="name")
public String subElement;
or
@Path("sub-element")
@Element
public String name;
--------------------------------------------
On Thu, 12/2/15, Kiran Rao <tec...@gm...>
wrote:
Subject: Re: [Simple-support] Interpret a sub-element as
String
To: "simple-support" <sim...@li...>
Received: Thursday, 12 February, 2015, 8:31 PM
Tried the
@Path annotation as well. The problem I found there is
that
ultimately, I need to also annotate the field that has
the
Path annotation with another annotation that states
whether
it is an element, attribute or Text.
Since my aim is to extract the value
as a String, I tried the @Text annotation:
@Rootpublic class
RootElement { @Element
public String description;
@Path("sub-element")
@Text public String
subElement;
public RootElement() {
}}
I also
tried @Element. However none of this works. I get a
ValueRequiredException for subElement. I can of course add
a
required=false, but that does not serve my
purpose.
It looks like
I'm missing some fundamental point about how Path
expressions are supposed to work!
Also, the docs for Path state that a
subset of XPath expressions are supported and goes on
to
list a few examples. Is this an exhaustive list of
supported
expressions?
I tried
something like @Path("sub-element/text()") and
it
threw a PathException.
On Thu Feb 12 2015 at
6:52:44 AM Niall Gallagher - Yieldbroker <Nia...@yi...>
wrote:
Take a look at the @Path
annotation
From: Kiran Rao [mailto:tec...@gm...]
Sent: 11 February 2015 20:19
To: simple-support
Subject: [Simple-support] Interpret a sub-element as
String
Hi,
Here's an XML I
have:
<root-element>
<description>lorem-ipsum</description>
<sub-element
id="1"><name>Hello
World</name></sub-element>
</root-element>
Now, for whatever reason,
I want to read the <sub-element> part as a String
rather than as an object - i.e.,
@Root(name="root-element",
strict=false)
class RootElement
{
@Element(name="description")
String
description
//No @Element
annotation here.
String
subElement;
}
RootElement root = new
Persister().read(RootElement.class,
INPUT);
RootElement EXPECTED = new
RootElement("lorem-ipsum",
"<sub-element
id=\"1\"><name>Hello
World</name></sub-element>");
assertEquals(EXPECTED,
root);
Similarly, when I
serialize this RootElement object, I want the string to
appear as a sub-element.
Any idea on how to go
about doing this? It looks like I am looking for some
sort
of interceptor - I get the partially parsed object and
then
I can fill in the missing fields.
I tried using a Converter
and the @Convert annotation; I tried implementing a
Visitor
- in both cases I got stuck trying to figure out what
portion has been parsed already.
I have temporarily written
code to first parse the object with all fields except
subElement; and then set this field using sub-string
operations. However, this is not really scalable -
especially when I use sub-element inside a list, inside
other parent elements, or when root-element itself has
other parent elements etc.
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Dive into the World of Parallel Programming.
The Go Parallel Website,
sponsored by Intel
and developed in partnership with Slashdot Media, is
your
hub for all things parallel software
development, from weekly thought
leadership
blogs to news, videos, case studies, tutorials and
more.
Take a
look and join the conversation now.
http://goparallel.sourceforge.net/
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Kiran R. <tec...@gm...> - 2015-02-13 10:39:29
|
@Niall,
Appreciate the time you are taking to support this (and also thanks for all
the hard work in creating this wonderful library)!
I did give a try to using Converters, however I could not figure out the
exact way to use them. I have gone through the examples but it is still not
clear to me.
For my use case, I expect that the Converter#read method gives me a
partially parsed object - i.e, I have a RootElement object with the
description field already set. All I have to do is extract the sub-element
substring from the input string and set it to the subElement field.
Similarly, during serialization, I expect that the StringBuilder contains
the description serialized. I only need to fill in the sub-element String.
However, I found out that this is not how the Converter works. It looks
like if I intercept the parsing, I need to perform _all_ parsing manually.
Is this understanding correct? How do I deal with finding child elements in
this case?
On Fri Feb 13 2015 at 11:16:17 AM Niall Gallagher - Yieldbroker <
Nia...@yi...> wrote:
> I was intending to add an @Literal annotation, however I have not yet
> done it. For now you will have to use a Converter, which can be used to
> intercept the XML parsing and compose your own result.
>
>
>
> *From:* Kiran Rao [mailto:tec...@gm...]
> *Sent:* 13 February 2015 15:25
> *To:* Niall Gallagher; simple-support
>
>
> *Subject:* Re: [Simple-support] Interpret a sub-element as String
>
>
>
> Hi Niall,
>
>
>
> My requirement is after parsing, subElement should contain the string that
> represents sub-element in its entirety. i.e.,
>
> assert subElement == "<sub-element id=\"1\"><name>Hello
> World</name></sub-element>";
>
>
>
> I admit this is not a typical use case.
>
>
>
>
>
>
>
> @Path("sub-element")
>
> @Element(name="name")
>
> public String name;
>
>
>
> This succeeds - but then this is not what I want.
>
>
>
>
>
> @Path("sub-element")
>
> @Element
>
> public String name;
>
>
>
> This results in a ValueRequiredException.
>
>
>
>
>
> On Fri Feb 13 2015 at 8:37:29 AM Niall Gallagher <
> gal...@ya...> wrote:
>
> Did you try
>
> @Path("sub-element")
> @Element(name="name")
> public String subElement;
>
> or
>
> @Path("sub-element")
> @Element
> public String name;
>
> --------------------------------------------
> On Thu, 12/2/15, Kiran Rao <tec...@gm...> wrote:
>
> Subject: Re: [Simple-support] Interpret a sub-element as String
> To: "simple-support" <sim...@li...>
> Received: Thursday, 12 February, 2015, 8:31 PM
>
> Tried the
> @Path annotation as well. The problem I found there is that
> ultimately, I need to also annotate the field that has the
> Path annotation with another annotation that states whether
> it is an element, attribute or Text.
> Since my aim is to extract the value
> as a String, I tried the @Text annotation:
> @Rootpublic class
> RootElement { @Element
> public String description;
>
> @Path("sub-element")
> @Text public String
> subElement;
>
> public RootElement() {
> }}
> I also
> tried @Element. However none of this works. I get a
> ValueRequiredException for subElement. I can of course add a
> required=false, but that does not serve my
> purpose.
> It looks like
> I'm missing some fundamental point about how Path
> expressions are supposed to work!
> Also, the docs for Path state that a
> subset of XPath expressions are supported and goes on to
> list a few examples. Is this an exhaustive list of supported
> expressions?
> I tried
> something like @Path("sub-element/text()") and it
> threw a PathException.
> On Thu Feb 12 2015 at
> 6:52:44 AM Niall Gallagher - Yieldbroker <Nia...@yi...
> >
> wrote:
>
>
>
>
>
>
>
>
> Take a look at the @Path
> annotation
>
> From: Kiran Rao [mailto:tec...@gm...]
>
>
> Sent: 11 February 2015 20:19
>
> To: simple-support
>
> Subject: [Simple-support] Interpret a sub-element as
> String
>
>
>
> Hi,
>
>
>
>
>
> Here's an XML I
> have:
>
>
>
>
>
> <root-element>
>
>
>
> <description>lorem-ipsum</description>
>
>
> <sub-element
> id="1"><name>Hello
> World</name></sub-element>
>
>
> </root-element>
>
>
>
>
>
> Now, for whatever reason,
> I want to read the <sub-element> part as a String
> rather than as an object - i.e.,
>
>
>
>
>
> @Root(name="root-element",
> strict=false)
>
>
> class RootElement
> {
>
>
>
> @Element(name="description")
>
>
> String
> description
>
>
>
>
>
> //No @Element
> annotation here.
>
>
> String
> subElement;
>
>
> }
>
>
>
>
>
>
>
>
> RootElement root = new
> Persister().read(RootElement.class,
> INPUT);
>
>
>
>
>
> RootElement EXPECTED = new
> RootElement("lorem-ipsum", "<sub-element
> id=\"1\"><name>Hello
> World</name></sub-element>");
>
>
> assertEquals(EXPECTED,
> root);
>
>
>
>
>
> Similarly, when I
> serialize this RootElement object, I want the string to
> appear as a sub-element.
>
>
>
>
>
>
>
>
> Any idea on how to go
> about doing this? It looks like I am looking for some sort
> of interceptor - I get the partially parsed object and then
> I can fill in the missing fields.
>
>
>
>
>
> I tried using a Converter
> and the @Convert annotation; I tried implementing a Visitor
> - in both cases I got stuck trying to figure out what
> portion has been parsed already.
>
>
>
>
>
> I have temporarily written
> code to first parse the object with all fields except
> subElement; and then set this field using sub-string
> operations. However, this is not really scalable -
> especially when I use sub-element inside a list, inside
> other parent elements, or when root-element itself has
> other parent elements etc.
>
>
>
>
>
>
>
>
>
>
>
>
> -----Inline Attachment Follows-----
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming.
> The Go Parallel Website,
> sponsored by Intel
> and developed in partnership with Slashdot Media, is your
> hub for all things parallel software
> development, from weekly thought
> leadership
> blogs to news, videos, case studies, tutorials and more.
> Take a
> look and join the conversation now.
> http://goparallel.sourceforge.net/
> -----Inline Attachment Follows-----
>
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
|
|
From: Niall G. - Y. <Nia...@yi...> - 2015-02-13 05:46:24
|
I was intending to add an @Literal annotation, however I have not yet done it. For now you will have to use a Converter, which can be used to intercept the XML parsing and compose your own result.
From: Kiran Rao [mailto:tec...@gm...]
Sent: 13 February 2015 15:25
To: Niall Gallagher; simple-support
Subject: Re: [Simple-support] Interpret a sub-element as String
Hi Niall,
My requirement is after parsing, subElement should contain the string that represents sub-element in its entirety. i.e.,
assert subElement == "<sub-element id=\"1\"><name>Hello World</name></sub-element>";
I admit this is not a typical use case.
@Path("sub-element")
@Element(name="name")
public String name;
This succeeds - but then this is not what I want.
@Path("sub-element")
@Element
public String name;
This results in a ValueRequiredException.
On Fri Feb 13 2015 at 8:37:29 AM Niall Gallagher <gal...@ya...<mailto:gal...@ya...>> wrote:
Did you try
@Path("sub-element")
@Element(name="name")
public String subElement;
or
@Path("sub-element")
@Element
public String name;
--------------------------------------------
On Thu, 12/2/15, Kiran Rao <tec...@gm...<mailto:tec...@gm...>> wrote:
Subject: Re: [Simple-support] Interpret a sub-element as String
To: "simple-support" <sim...@li...<mailto:sim...@li...>>
Received: Thursday, 12 February, 2015, 8:31 PM
Tried the
@Path annotation as well. The problem I found there is that
ultimately, I need to also annotate the field that has the
Path annotation with another annotation that states whether
it is an element, attribute or Text.
Since my aim is to extract the value
as a String, I tried the @Text annotation:
@Rootpublic class
RootElement { @Element
public String description;
@Path("sub-element")
@Text public String
subElement;
public RootElement() {
}}
I also
tried @Element. However none of this works. I get a
ValueRequiredException for subElement. I can of course add a
required=false, but that does not serve my
purpose.
It looks like
I'm missing some fundamental point about how Path
expressions are supposed to work!
Also, the docs for Path state that a
subset of XPath expressions are supported and goes on to
list a few examples. Is this an exhaustive list of supported
expressions?
I tried
something like @Path("sub-element/text()") and it
threw a PathException.
On Thu Feb 12 2015 at
6:52:44 AM Niall Gallagher - Yieldbroker <Nia...@yi...<mailto:Nia...@yi...>>
wrote:
Take a look at the @Path
annotation
From: Kiran Rao [mailto:tec...@gm...<mailto:tec...@gm...>]
Sent: 11 February 2015 20:19
To: simple-support
Subject: [Simple-support] Interpret a sub-element as
String
Hi,
Here's an XML I
have:
<root-element>
<description>lorem-ipsum</description>
<sub-element
id="1"><name>Hello
World</name></sub-element>
</root-element>
Now, for whatever reason,
I want to read the <sub-element> part as a String
rather than as an object - i.e.,
@Root(name="root-element",
strict=false)
class RootElement
{
@Element(name="description")
String
description
//No @Element
annotation here.
String
subElement;
}
RootElement root = new
Persister().read(RootElement.class,
INPUT);
RootElement EXPECTED = new
RootElement("lorem-ipsum", "<sub-element
id=\"1\"><name>Hello
World</name></sub-element>");
assertEquals(EXPECTED,
root);
Similarly, when I
serialize this RootElement object, I want the string to
appear as a sub-element.
Any idea on how to go
about doing this? It looks like I am looking for some sort
of interceptor - I get the partially parsed object and then
I can fill in the missing fields.
I tried using a Converter
and the @Convert annotation; I tried implementing a Visitor
- in both cases I got stuck trying to figure out what
portion has been parsed already.
I have temporarily written
code to first parse the object with all fields except
subElement; and then set this field using sub-string
operations. However, this is not really scalable -
especially when I use sub-element inside a list, inside
other parent elements, or when root-element itself has
other parent elements etc.
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Dive into the World of Parallel Programming.
The Go Parallel Website,
sponsored by Intel
and developed in partnership with Slashdot Media, is your
hub for all things parallel software
development, from weekly thought
leadership
blogs to news, videos, case studies, tutorials and more.
Take a
look and join the conversation now.
http://goparallel.sourceforge.net/
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...<mailto:Sim...@li...>
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Kiran R. <tec...@gm...> - 2015-02-13 04:25:18
|
Hi Niall,
My requirement is after parsing, subElement should contain the string that
represents sub-element in its entirety. i.e.,
assert subElement == "<sub-element id=\"1\"><name>Hello
World</name></sub-element>";
I admit this is not a typical use case.
@Path("sub-element")
@Element(name="name")
public String name;
This succeeds - but then this is not what I want.
@Path("sub-element")
@Element
public String name;
This results in a ValueRequiredException.
On Fri Feb 13 2015 at 8:37:29 AM Niall Gallagher <gal...@ya...>
wrote:
> Did you try
>
> @Path("sub-element")
> @Element(name="name")
> public String subElement;
>
> or
>
> @Path("sub-element")
> @Element
> public String name;
>
> --------------------------------------------
> On Thu, 12/2/15, Kiran Rao <tec...@gm...> wrote:
>
> Subject: Re: [Simple-support] Interpret a sub-element as String
> To: "simple-support" <sim...@li...>
> Received: Thursday, 12 February, 2015, 8:31 PM
>
> Tried the
> @Path annotation as well. The problem I found there is that
> ultimately, I need to also annotate the field that has the
> Path annotation with another annotation that states whether
> it is an element, attribute or Text.
> Since my aim is to extract the value
> as a String, I tried the @Text annotation:
> @Rootpublic class
> RootElement { @Element
> public String description;
>
> @Path("sub-element")
> @Text public String
> subElement;
>
> public RootElement() {
> }}
> I also
> tried @Element. However none of this works. I get a
> ValueRequiredException for subElement. I can of course add a
> required=false, but that does not serve my
> purpose.
> It looks like
> I'm missing some fundamental point about how Path
> expressions are supposed to work!
> Also, the docs for Path state that a
> subset of XPath expressions are supported and goes on to
> list a few examples. Is this an exhaustive list of supported
> expressions?
> I tried
> something like @Path("sub-element/text()") and it
> threw a PathException.
> On Thu Feb 12 2015 at
> 6:52:44 AM Niall Gallagher - Yieldbroker <Nia...@yi...
> >
> wrote:
>
>
>
>
>
>
>
>
> Take a look at the @Path
> annotation
>
> From: Kiran Rao [mailto:tec...@gm...]
>
>
> Sent: 11 February 2015 20:19
>
> To: simple-support
>
> Subject: [Simple-support] Interpret a sub-element as
> String
>
>
>
> Hi,
>
>
>
>
>
> Here's an XML I
> have:
>
>
>
>
>
> <root-element>
>
>
>
> <description>lorem-ipsum</description>
>
>
> <sub-element
> id="1"><name>Hello
> World</name></sub-element>
>
>
> </root-element>
>
>
>
>
>
> Now, for whatever reason,
> I want to read the <sub-element> part as a String
> rather than as an object - i.e.,
>
>
>
>
>
> @Root(name="root-element",
> strict=false)
>
>
> class RootElement
> {
>
>
>
> @Element(name="description")
>
>
> String
> description
>
>
>
>
>
> //No @Element
> annotation here.
>
>
> String
> subElement;
>
>
> }
>
>
>
>
>
>
>
>
> RootElement root = new
> Persister().read(RootElement.class,
> INPUT);
>
>
>
>
>
> RootElement EXPECTED = new
> RootElement("lorem-ipsum", "<sub-element
> id=\"1\"><name>Hello
> World</name></sub-element>");
>
>
> assertEquals(EXPECTED,
> root);
>
>
>
>
>
> Similarly, when I
> serialize this RootElement object, I want the string to
> appear as a sub-element.
>
>
>
>
>
>
>
>
> Any idea on how to go
> about doing this? It looks like I am looking for some sort
> of interceptor - I get the partially parsed object and then
> I can fill in the missing fields.
>
>
>
>
>
> I tried using a Converter
> and the @Convert annotation; I tried implementing a Visitor
> - in both cases I got stuck trying to figure out what
> portion has been parsed already.
>
>
>
>
>
> I have temporarily written
> code to first parse the object with all fields except
> subElement; and then set this field using sub-string
> operations. However, this is not really scalable -
> especially when I use sub-element inside a list, inside
> other parent elements, or when root-element itself has
> other parent elements etc.
>
>
>
>
>
>
>
>
>
>
>
>
> -----Inline Attachment Follows-----
>
> ------------------------------------------------------------
> ------------------
> Dive into the World of Parallel Programming.
> The Go Parallel Website,
> sponsored by Intel
> and developed in partnership with Slashdot Media, is your
> hub for all things parallel software
> development, from weekly thought
> leadership
> blogs to news, videos, case studies, tutorials and more.
> Take a
> look and join the conversation now.
> http://goparallel.sourceforge.net/
> -----Inline Attachment Follows-----
>
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
|
|
From: Niall G. <gal...@ya...> - 2015-02-13 03:07:39
|
Did you try
@Path("sub-element")
@Element(name="name")
public String subElement;
or
@Path("sub-element")
@Element
public String name;
--------------------------------------------
On Thu, 12/2/15, Kiran Rao <tec...@gm...> wrote:
Subject: Re: [Simple-support] Interpret a sub-element as String
To: "simple-support" <sim...@li...>
Received: Thursday, 12 February, 2015, 8:31 PM
Tried the
@Path annotation as well. The problem I found there is that
ultimately, I need to also annotate the field that has the
Path annotation with another annotation that states whether
it is an element, attribute or Text.
Since my aim is to extract the value
as a String, I tried the @Text annotation:
@Rootpublic class
RootElement { @Element
public String description;
@Path("sub-element")
@Text public String
subElement;
public RootElement() {
}}
I also
tried @Element. However none of this works. I get a
ValueRequiredException for subElement. I can of course add a
required=false, but that does not serve my
purpose.
It looks like
I'm missing some fundamental point about how Path
expressions are supposed to work!
Also, the docs for Path state that a
subset of XPath expressions are supported and goes on to
list a few examples. Is this an exhaustive list of supported
expressions?
I tried
something like @Path("sub-element/text()") and it
threw a PathException.
On Thu Feb 12 2015 at
6:52:44 AM Niall Gallagher - Yieldbroker <Nia...@yi...>
wrote:
Take a look at the @Path
annotation
From: Kiran Rao [mailto:tec...@gm...]
Sent: 11 February 2015 20:19
To: simple-support
Subject: [Simple-support] Interpret a sub-element as
String
Hi,
Here's an XML I
have:
<root-element>
<description>lorem-ipsum</description>
<sub-element
id="1"><name>Hello
World</name></sub-element>
</root-element>
Now, for whatever reason,
I want to read the <sub-element> part as a String
rather than as an object - i.e.,
@Root(name="root-element",
strict=false)
class RootElement
{
@Element(name="description")
String
description
//No @Element
annotation here.
String
subElement;
}
RootElement root = new
Persister().read(RootElement.class,
INPUT);
RootElement EXPECTED = new
RootElement("lorem-ipsum", "<sub-element
id=\"1\"><name>Hello
World</name></sub-element>");
assertEquals(EXPECTED,
root);
Similarly, when I
serialize this RootElement object, I want the string to
appear as a sub-element.
Any idea on how to go
about doing this? It looks like I am looking for some sort
of interceptor - I get the partially parsed object and then
I can fill in the missing fields.
I tried using a Converter
and the @Convert annotation; I tried implementing a Visitor
- in both cases I got stuck trying to figure out what
portion has been parsed already.
I have temporarily written
code to first parse the object with all fields except
subElement; and then set this field using sub-string
operations. However, this is not really scalable -
especially when I use sub-element inside a list, inside
other parent elements, or when root-element itself has
other parent elements etc.
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Dive into the World of Parallel Programming.
The Go Parallel Website,
sponsored by Intel
and developed in partnership with Slashdot Media, is your
hub for all things parallel software
development, from weekly thought
leadership
blogs to news, videos, case studies, tutorials and more.
Take a
look and join the conversation now.
http://goparallel.sourceforge.net/
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Kiran R. <tec...@gm...> - 2015-02-12 09:31:21
|
Tried the @Path annotation as well. The problem I found there is that
ultimately, I need to also annotate the field that has the Path annotation
with another annotation that states whether it is an element, attribute or
Text.
Since my aim is to extract the value as a String, I tried the @Text
annotation:
@Root
public class RootElement {
@Element
public String description;
@Path("sub-element")
@Text
public String subElement;
public RootElement() {
}
}
I also tried @Element. However none of this works. I get a
ValueRequiredException for subElement. I can of course add a
required=false, but that does not serve my purpose.
It looks like I'm missing some fundamental point about how Path expressions
are supposed to work!
Also, the docs for Path state that a subset of XPath expressions are
supported and goes on to list a few examples. Is this an exhaustive list of
supported expressions?
I tried something like @Path("sub-element/text()") and it threw a
PathException.
On Thu Feb 12 2015 at 6:52:44 AM Niall Gallagher - Yieldbroker <
Nia...@yi...> wrote:
> Take a look at the @Path annotation
>
>
>
> *From:* Kiran Rao [mailto:tec...@gm...]
> *Sent:* 11 February 2015 20:19
> *To:* simple-support
> *Subject:* [Simple-support] Interpret a sub-element as String
>
>
>
> Hi,
>
>
>
> Here's an XML I have:
>
>
>
> <root-element>
>
> <description>lorem-ipsum</description>
>
> <sub-element id="1"><name>Hello World</name></sub-element>
>
> </root-element>
>
>
>
> Now, for whatever reason, I want to read the <sub-element> part as a
> String rather than as an object - i.e.,
>
>
>
> @Root(name="root-element", strict=false)
>
> class RootElement {
>
> @Element(name="description")
>
> String description
>
>
>
> //No @Element annotation here.
>
> String subElement;
>
> }
>
>
>
>
>
> RootElement root = new Persister().read(RootElement.class, INPUT);
>
>
>
> RootElement EXPECTED = new RootElement("lorem-ipsum", "<sub-element
> id=\"1\"><name>Hello World</name></sub-element>");
>
> assertEquals(EXPECTED, root);
>
>
>
> Similarly, when I serialize this RootElement object, I want the string to
> appear as a sub-element.
>
>
>
>
>
> Any idea on how to go about doing this? It looks like I am looking for
> some sort of interceptor - I get the partially parsed object and then I can
> fill in the missing fields.
>
>
>
> I tried using a Converter and the @Convert annotation; I tried
> implementing a Visitor - in both cases I got stuck trying to figure out
> what portion has been parsed already.
>
>
>
> I have temporarily written code to first parse the object with all fields
> except subElement; and then set this field using sub-string operations.
> However, this is not really scalable - especially when I use sub-element
> inside a list, inside other parent elements, or when root-element itself
> has other parent elements etc.
>
>
>
>
>
>
>
|
|
From: Niall G. - Y. <Nia...@yi...> - 2015-02-12 01:22:49
|
Take a look at the @Path annotation
From: Kiran Rao [mailto:tec...@gm...]
Sent: 11 February 2015 20:19
To: simple-support
Subject: [Simple-support] Interpret a sub-element as String
Hi,
Here's an XML I have:
<root-element>
<description>lorem-ipsum</description>
<sub-element id="1"><name>Hello World</name></sub-element>
</root-element>
Now, for whatever reason, I want to read the <sub-element> part as a String rather than as an object - i.e.,
@Root(name="root-element", strict=false)
class RootElement {
@Element(name="description")
String description
//No @Element annotation here.
String subElement;
}
RootElement root = new Persister().read(RootElement.class, INPUT);
RootElement EXPECTED = new RootElement("lorem-ipsum", "<sub-element id=\"1\"><name>Hello World</name></sub-element>");
assertEquals(EXPECTED, root);
Similarly, when I serialize this RootElement object, I want the string to appear as a sub-element.
Any idea on how to go about doing this? It looks like I am looking for some sort of interceptor - I get the partially parsed object and then I can fill in the missing fields.
I tried using a Converter and the @Convert annotation; I tried implementing a Visitor - in both cases I got stuck trying to figure out what portion has been parsed already.
I have temporarily written code to first parse the object with all fields except subElement; and then set this field using sub-string operations. However, this is not really scalable - especially when I use sub-element inside a list, inside other parent elements, or when root-element itself has other parent elements etc.
|
|
From: Kiran R. <tec...@gm...> - 2015-02-11 09:18:57
|
Hi,
Here's an XML I have:
<root-element>
<description>lorem-ipsum</description>
<sub-element id="1"><name>Hello World</name></sub-element>
</root-element>
Now, for whatever reason, I want to read the <sub-element> part as a String
rather than as an object - i.e.,
@Root(name="root-element", strict=false)
class RootElement {
@Element(name="description")
String description
//No @Element annotation here.
String subElement;
}
RootElement root = new Persister().read(RootElement.class, INPUT);
RootElement EXPECTED = new RootElement("lorem-ipsum", "<sub-element
id=\"1\"><name>Hello World</name></sub-element>");
assertEquals(EXPECTED, root);
Similarly, when I serialize this RootElement object, I want the string to
appear as a sub-element.
Any idea on how to go about doing this? It looks like I am looking for some
sort of interceptor - I get the partially parsed object and then I can fill
in the missing fields.
I tried using a Converter and the @Convert annotation; I tried implementing
a Visitor - in both cases I got stuck trying to figure out what portion has
been parsed already.
I have temporarily written code to first parse the object with all fields
except subElement; and then set this field using sub-string operations.
However, this is not really scalable - especially when I use sub-element
inside a list, inside other parent elements, or when root-element itself
has other parent elements etc.
|
|
From: Niall G. <gal...@ya...> - 2015-01-20 11:41:14
|
Hi, The origin of this framework was actually to allow me to work with XML for the HTTP framework hosted at www.simpleframework.org. Because I own this domain I decided to continue using it. I am not a big fan of brand or product names, I prefer functional names. The reason is probably one you can relate to, any name I pick will likely drive me nuts also. If you don't like the name then just invent one for it! Its too late now to create a new one, perhaps an acronym might catch on, but I doubt it. Unfortunately your just going to have to live with the pain! Niall -------------------------------------------- On Tue, 20/1/15, Lukas Degener <l.d...@ta...> wrote: Subject: [Simple-support] "Simple" is not a name. To: sim...@li... Received: Tuesday, 20 January, 2015, 9:30 PM Dear Devs, I have been using your framework for years now in a lot of projects. I found it enjoyable and helpful most of the time. Thanks for that. There is one thing, though, that has been nagging me since the very first day: That name. That "name" is freakin' *madness*. It drives me berserk! Just try and google it for a couple of minutes and you'll get my point. I love your framework (See? See how I am dodging it? I can't even call it by its silly name!), but please consider giving it a real name. Call it "John Doe" if you must, that would be an improvement. /RANT Sorry for that, I just needed to vent. Already feeling better now ;-) Happy hacking, --lu ------------------------------------------------------------------------------ New Year. New Location. New Benefits. New Data Center in Ashburn, VA. GigeNET is offering a free month of service with a new server in Ashburn. Choose from 2 high performing configs, both with 100TB of bandwidth. Higher redundancy.Lower latency.Increased capacity.Completely compliant. http://p.sf.net/sfu/gigenet _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: -=}\\*/{=- <rui...@gm...> - 2015-01-20 11:34:24
|
:S the name is most wonderful <http://wonderful world>... and you can kill yourself... .. or you can narrow your search results using the right keywords: https://www.google.pt/?q=simple+framework [happy hacking]r. On Tue, Jan 20, 2015 at 10:30 AM, Lukas Degener <l.d...@ta...> wrote: > Dear Devs, > > I have been using your framework for years now in a lot of projects. I > found it enjoyable and helpful most of the time. Thanks for that. > > There is one thing, though, that has been nagging me since the very > first day: > > That name. > That "name" is freakin' *madness*. > It drives me berserk! Just try and google it for a couple of minutes and > you'll get my point. > > I love your framework (See? See how I am dodging it? I can't even call > it by its silly name!), but please consider giving it a real name. Call > it "John Doe" if you must, that would be an improvement. > > /RANT > Sorry for that, I just needed to vent. > Already feeling better now ;-) > > Happy hacking, > --lu > > > > ------------------------------------------------------------------------------ > New Year. New Location. New Benefits. New Data Center in Ashburn, VA. > GigeNET is offering a free month of service with a new server in Ashburn. > Choose from 2 high performing configs, both with 100TB of bandwidth. > Higher redundancy.Lower latency.Increased capacity.Completely compliant. > http://p.sf.net/sfu/gigenet > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > |
|
From: Lukas D. <l.d...@ta...> - 2015-01-20 10:53:03
|
Dear Devs, I have been using your framework for years now in a lot of projects. I found it enjoyable and helpful most of the time. Thanks for that. There is one thing, though, that has been nagging me since the very first day: That name. That "name" is freakin' *madness*. It drives me berserk! Just try and google it for a couple of minutes and you'll get my point. I love your framework (See? See how I am dodging it? I can't even call it by its silly name!), but please consider giving it a real name. Call it "John Doe" if you must, that would be an improvement. /RANT Sorry for that, I just needed to vent. Already feeling better now ;-) Happy hacking, --lu |
|
From: Niall G. - Y. <Nia...@yi...> - 2014-11-20 22:48:21
|
If you do not have the element it will be null. Like so. Currently there is no way to tell the difference between <acpi></acpi> and <acpi/>, so that means an empty string “” rather than a null. <feature> <apic/> <pae/> </feature> From: 张敏 [mailto:zm...@16...] Sent: 21 November 2014 02:43 To: sim...@li... Subject: [Simple-support] How ro reserialization a null element like <acpi /> to java entry ? How ro reserialization a null element like <acpi /> to java entry thanks everybody for the work to simple-xml ,it's. so easy to use simple-xml but I hava a question how to reserialization a. Xml to. java. Like. this <feature> <acpi/> <apic/> <pae/> </feature> Thanks |
|
From: 张敏 <zm...@16...> - 2014-11-20 15:42:44
|
How ro reserialization a null element like <acpi /> to java entry thanks everybody for the work to simple-xml ,it's. so easy to use simple-xml but I hava a question how to reserialization a. Xml to. java. Like. this <feature> <acpi/> <apic/> <pae/> </feature> Thanks |
|
From: Niall G. - Y. <Nia...@yi...> - 2014-11-11 23:09:35
|
Hi, The only way to do this is imperatively using a Converter. See the @Convert annotation. Niall From: Aon Geek [mailto:ao...@gm...] Sent: 12 November 2014 05:09 To: sim...@li... Subject: [Simple-support] Dynamic element names Hi, I was wondering if there is any way to have dynamic element names while serializing objects to xml. Such as <transaction98765> <ts>xxxx</ts> <node></node> </transaction98765>. I have this requirement where our data exchange protocol expect ids appended to the transaction element. Appreciate your help. Thanks, -Azhar |
|
From: Aon G. <ao...@gm...> - 2014-11-11 18:09:28
|
Hi, I was wondering if there is any way to have dynamic element names while serializing objects to xml. Such as <transaction98765> <ts>xxxx</ts> <node></node> </transaction98765>. I have this requirement where our data exchange protocol expect ids appended to the transaction element. Appreciate your help. Thanks, -Azhar |
|
From: Niall G. <gal...@ya...> - 2014-11-09 12:14:27
|
Hi,
Check out the tutorial, it should have the details you need.
Niall
--------------------------------------------
On Sat, 8/11/14, Christian Schudt <chr...@gm...> wrote:
Subject: [Simple-support] Deserialize any element (xsd:any)
To: sim...@li...
Received: Saturday, 8 November, 2014, 10:12 AM
Hi all,
I am trying to deserialize an XML String to an object.
The problem I am having is that the object can have *any*
element (xsd:any).
I tried it that way:
@Root
public class Container
{
@Element(required = false)
private Object anyElement;
}
But when deserializing the following XML:
<container><xyz
xmlns=„any_arbitrary_namespace“/></container>
I get a org.simpleframework.xml.core.ElementException:
Element ‚xyz' does not have a match in class…
I have a class which would map to the xyz element.
I also thought, that I have to register it (similar to
creating a JAXBContext), so that the persister is aware of
it, like:
registry.lookup(Xyz.class);
but I doesn’t work.
Here’s the same question:
http://stackoverflow.com/questions/26361729/simplexml-any-element-matching
Thanks for help,
Christian
------------------------------------------------------------------------------
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Christian S. <chr...@gm...> - 2014-11-07 23:12:44
|
Hi all,
I am trying to deserialize an XML String to an object.
The problem I am having is that the object can have *any* element (xsd:any).
I tried it that way:
@Root
public class Container
{
@Element(required = false)
private Object anyElement;
}
But when deserializing the following XML:
<container><xyz xmlns=„any_arbitrary_namespace“/></container>
I get a org.simpleframework.xml.core.ElementException: Element ‚xyz' does not have a match in class…
I have a class which would map to the xyz element.
I also thought, that I have to register it (similar to creating a JAXBContext), so that the persister is aware of it, like:
registry.lookup(Xyz.class);
but I doesn’t work.
Here’s the same question:
http://stackoverflow.com/questions/26361729/simplexml-any-element-matching
Thanks for help,
Christian
|
|
From: Farley L. <poy...@ui...> - 2014-09-15 20:13:59
|
Hi,
I'm serializing a list of custom class (non-string) which requires null
values to maintain the element positions.
However, I haven't found the correct annotation to set it and am not even
sure whether it is supported.
I searched the mailing list and there is a case to use null string values
in the list.
{@Textprivate String value;}
But I didn't find the relevant documentation to deal with null element
values in a list of a custom class.
Here is the use case where two lists "names" and "inits" maintain
corresponding element positions and one of them (inits) has a null element
value in the head of the list. The generated xml follows.
<names class="java.util.ArrayList">
<string>num</string>
<string>i</string>
</names>
<inits class="java.util.ArrayList">
<expression class="streamit.frontend.nodes.ExprConstFloat" val="2.0">
<context
fileName="StreamIt/src/test/streamit/FIRcoarse/FIRcoarse.str"
lineNumber="8" columnNumber="18"/>
</expression>
</inits>
Apparently, the null element value is eliminated so as to cause the 2nd
element to be misplaced in the deserialized list.
The expected generated xml should be something like the following.
<names class="java.util.ArrayList">
<string>num</string>
<string>i</string>
</names>
<inits class="java.util.ArrayList">
<expression class="streamit.frontend.nodes.ExprConstFloat" val="2.0"/>
<expression class="streamit.frontend.nodes.ExprConstFloat" val="2.0">
<context
fileName="StreamIt/src/test/streamit/FIRcoarse/FIRcoarse.str"
lineNumber="8" columnNumber="18"/>
</expression>
</inits>
When deserialized, the first element should be set to null instead of
calling the no-argument constructor.
If supported, what is the correct to annotate the element list?
Thanks.
Farley
|
|
From: Sobeos <so...@gm...> - 2014-09-15 06:31:42
|
???
But then I have two attributes in the xml with the same value for nothing.
id = 5 xxx = 5
Not a good solution.
I'm sure it is easy for you to fix it in the CylcicStrategy and so at the right location.
-----Ursprüngliche Nachricht-----
Von: Niall Gallagher [mailto:gal...@ya...]
Gesendet: Samstag, 13. September 2014 06:08
An: 'Niall Gallagher - Yieldbroker'; sim...@li...; Sobeos
Betreff: Re: [Simple-support] Reusing XML elements
Why not do this
Strategy strategy = new CycleStrategy("xxx", "ref");
Now "id" is not a special case and can be treated like anything else.
--------------------------------------------
On Fri, 12/9/14, Sobeos <so...@gm...> wrote:
Subject: Re: [Simple-support] Reusing XML elements
To: "'Niall Gallagher - Yieldbroker'" <Nia...@yi...>, sim...@li...
Received: Friday, 12 September, 2014, 10:13 PM
#yiv8167355837
#yiv8167355837 --
_filtered #yiv8167355837 {font-family:Calibri;panose-1:2 15
5 2 2 2 4 3 2 4;}
_filtered #yiv8167355837 {font-family:Tahoma;panose-1:2 11
6 4 3 5 4 4 2 4;}
_filtered #yiv8167355837 {font-family:Consolas;panose-1:2
11 6 9 2 2 4 3 2 4;}
#yiv8167355837
#yiv8167355837 p.yiv8167355837MsoNormal, #yiv8167355837 li.yiv8167355837MsoNormal, #yiv8167355837 div.yiv8167355837MsoNormal
{margin:0cm;margin-bottom:.0001pt;font-size:11.0pt;}
#yiv8167355837 a:link, #yiv8167355837
span.yiv8167355837MsoHyperlink
{color:blue;text-decoration:underline;}
#yiv8167355837 a:visited, #yiv8167355837 span.yiv8167355837MsoHyperlinkFollowed
{color:purple;text-decoration:underline;}
#yiv8167355837 p
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv8167355837 p.yiv8167355837MsoAcetate, #yiv8167355837 li.yiv8167355837MsoAcetate, #yiv8167355837 div.yiv8167355837MsoAcetate
{margin:0cm;margin-bottom:.0001pt;font-size:8.0pt;}
#yiv8167355837 span.yiv8167355837E-MailFormatvorlage18
{color:windowtext;}
#yiv8167355837 span.yiv8167355837E-MailFormatvorlage19
{color:#1F497D;}
#yiv8167355837 span.yiv8167355837SprechblasentextZchn
{}
#yiv8167355837 span.yiv8167355837E-MailFormatvorlage22
{color:#1F497D;}
#yiv8167355837 .yiv8167355837MsoChpDefault
{font-size:10.0pt;}
_filtered #yiv8167355837 {margin:70.85pt 70.85pt 2.0cm 70.85pt;}
#yiv8167355837 div.yiv8167355837WordSection1
{}
#yiv8167355837 Means what? Writing my own Strategy?
I can’t see how to simply override
some implementation to get the functionality.I had a short look into the code.As far as I can see, the logic is not in CyclicStrategy directly. And it is not so simple to extend the class.So I have to copy CyclicStrategy code to change the Contract. And copy some other classes like ReadGraph and WriteGraph…Understand all the internals....
Sounds like a lot of hazzle to fix
some small bug in the basic CyclicStrategy implementation.
Perhaps and hopefully I got you
wrong…
Von: Niall Gallagher - Yieldbroker
[mailto:Nia...@yi...]
Gesendet: Freitag, 12. September 2014
01:51
An: Sobeos;
sim...@li...
Betreff: RE: [Simple-support] Reusing
XML elements Yes there is, just override the implementation and capture the “id” in that way. From: Sobeos [mailto:so...@gm...]
Sent: 11 September 2014 19:42
To: sim...@li...
Subject: [Simple-support] Reusing XML
elements
I’m reusing
XML elements in my xml based on the id ref machanism which is working fine. http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php#reuse Now I want to unmarshall the id attribute as a normal member variable. As result I get always 0. Is there a way to get the value of id in the java object when using final Strategy strategy = new CycleStrategy("id", "ref");? Any ideas/hints? Diese E-Mail ist frei von Viren und Malware, denn der avast!
Antivirus Schutz ist aktiv.
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist aktiv.
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Want excitement?
Manually
upgrade your production database.
When you
want reliability, choose Perforce
Perforce
version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
---
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist aktiv.
http://www.avast.com
|
|
From: Niall G. <gal...@ya...> - 2014-09-13 04:07:55
|
Why not do this
Strategy strategy = new CycleStrategy("xxx", "ref");
Now "id" is not a special case and can be treated like anything else.
--------------------------------------------
On Fri, 12/9/14, Sobeos <so...@gm...> wrote:
Subject: Re: [Simple-support] Reusing XML elements
To: "'Niall Gallagher - Yieldbroker'" <Nia...@yi...>, sim...@li...
Received: Friday, 12 September, 2014, 10:13 PM
#yiv8167355837
#yiv8167355837 --
_filtered #yiv8167355837 {font-family:Calibri;panose-1:2 15
5 2 2 2 4 3 2 4;}
_filtered #yiv8167355837 {font-family:Tahoma;panose-1:2 11
6 4 3 5 4 4 2 4;}
_filtered #yiv8167355837 {font-family:Consolas;panose-1:2
11 6 9 2 2 4 3 2 4;}
#yiv8167355837
#yiv8167355837 p.yiv8167355837MsoNormal, #yiv8167355837
li.yiv8167355837MsoNormal, #yiv8167355837
div.yiv8167355837MsoNormal
{margin:0cm;margin-bottom:.0001pt;font-size:11.0pt;}
#yiv8167355837 a:link, #yiv8167355837
span.yiv8167355837MsoHyperlink
{color:blue;text-decoration:underline;}
#yiv8167355837 a:visited, #yiv8167355837
span.yiv8167355837MsoHyperlinkFollowed
{color:purple;text-decoration:underline;}
#yiv8167355837 p
{margin-right:0cm;margin-left:0cm;font-size:12.0pt;}
#yiv8167355837 p.yiv8167355837MsoAcetate, #yiv8167355837
li.yiv8167355837MsoAcetate, #yiv8167355837
div.yiv8167355837MsoAcetate
{margin:0cm;margin-bottom:.0001pt;font-size:8.0pt;}
#yiv8167355837 span.yiv8167355837E-MailFormatvorlage18
{color:windowtext;}
#yiv8167355837 span.yiv8167355837E-MailFormatvorlage19
{color:#1F497D;}
#yiv8167355837 span.yiv8167355837SprechblasentextZchn
{}
#yiv8167355837 span.yiv8167355837E-MailFormatvorlage22
{color:#1F497D;}
#yiv8167355837 .yiv8167355837MsoChpDefault
{font-size:10.0pt;}
_filtered #yiv8167355837 {margin:70.85pt 70.85pt 2.0cm
70.85pt;}
#yiv8167355837 div.yiv8167355837WordSection1
{}
#yiv8167355837 Means what? Writing my own Strategy?
I can’t see how to simply override
some implementation to get the functionality.I had a short look into the
code.As far as I can see, the logic is not
in CyclicStrategy directly. And it is not so simple to
extend the class.So I have to copy CyclicStrategy code
to change the Contract. And copy some other classes like
ReadGraph and WriteGraph…Understand all the
internals....
Sounds like a lot of hazzle to fix
some small bug in the basic CyclicStrategy
implementation.
Perhaps and hopefully I got you
wrong…
Von: Niall Gallagher - Yieldbroker
[mailto:Nia...@yi...]
Gesendet: Freitag, 12. September 2014
01:51
An: Sobeos;
sim...@li...
Betreff: RE: [Simple-support] Reusing
XML elements Yes there is, just override the
implementation and capture the “id” in that
way. From: Sobeos [mailto:so...@gm...]
Sent: 11 September 2014 19:42
To: sim...@li...
Subject: [Simple-support] Reusing XML
elements
I’m reusing
XML elements in my xml based on the id ref machanism which
is working fine. http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php#reuse Now I want to unmarshall the
id attribute as a normal member variable. As result I get
always 0. Is there a
way to get the value of id in the java object when using
final
Strategy strategy
= new
CycleStrategy("id",
"ref");? Any ideas/hints? Diese E-Mail ist frei von Viren
und Malware, denn der avast!
Antivirus Schutz ist aktiv.
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist
aktiv.
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Want excitement?
Manually
upgrade your production database.
When you
want reliability, choose Perforce
Perforce
version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|