simple-support Mailing List for Simple (Page 14)
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: amit.shipra <ami...@rb...> - 2012-08-10 13:04:37
|
Could someone please help with this issue. Let me know if I am doing anything
wrong here?? :-/
amit.shipra wrote:
>
> Hi there,
>
> XML looks like:
>
> <ns0:book id="BOOK">
> <ns0:identifier>
> <ns0:sourceSystem>DTCC</ns0:sourceSystem>
> </ns0:identifier>
> </ns0:book>
> <ns0:trader id="ID_EXECUTING_TRADER">
> <ns0:identifier>
> <ns0:sourceSystem>NYSE</ns0:sourceSystem>
> </ns0:identifier>
> </ns0:trader>
>
>
> and my JAVA code (for sourceSystem Element) is:
>
> @Element(name="sourceSystem")
> @Path("ns0:book/ns0:identifier")
> private String bookSourceSystem="system1";
>
>
> @Element(name="sourceSystem")
> @Path("ns0:trader/ns0:identifier")
> private String traderSourceSystem="system2";
>
>
> However, I am getting the NullPointerException:
>
> StackTrace:
> Exception in thread "main" java.lang.NullPointerException
> at
> org.simpleframework.xml.core.InstantiatorBuilder.register(InstantiatorBuilder.java:461)
> at
> org.simpleframework.xml.core.InstantiatorBuilder.register(InstantiatorBuilder.java:433)
> at
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:283)
> at
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:259)
> at
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:200)
> at org.simpleframework.xml.core.Scanner.field(Scanner.java:511)
> at org.simpleframework.xml.core.Scanner.scan(Scanner.java:395)
> at org.simpleframework.xml.core.Scanner.<init>(Scanner.java:104)
> at
> org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory.java:77)
> at org.simpleframework.xml.core.Support.getScanner(Support.java:203)
> at org.simpleframework.xml.core.Source.getScanner(Source.java:271)
> at org.simpleframework.xml.core.Source.getCaller(Source.java:300)
> at
> org.simpleframework.xml.core.Composite.writeReplace(Composite.java:1147)
> at org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1124)
> at
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:1098)
> at
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
> at org.simpleframework.xml.core.Composite.write(Composite.java:975)
> at org.simpleframework.xml.core.Composite.write(Composite.java:952)
> at
> org.simpleframework.xml.core.Composite.writeElement(Composite.java:1256)
> at
> org.simpleframework.xml.core.Composite.writeElement(Composite.java:1239)
> at org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1127)
> at
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:1098)
> at
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
> at
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:1087)
> at
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
> at org.simpleframework.xml.core.Composite.write(Composite.java:975)
> at org.simpleframework.xml.core.Composite.write(Composite.java:952)
> at org.simpleframework.xml.core.Traverser.write(Traverser.java:236)
> at org.simpleframework.xml.core.Traverser.write(Traverser.java:208)
> at org.simpleframework.xml.core.Traverser.write(Traverser.java:186)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1180)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1162)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1140)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1259)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1241)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1222)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1201)
>
>
> Source code block:
>
> private void register(Label label, LabelMap map) throws Exception {
> String name = label.getName();
> String path = label.getPath();
>
> if(map.containsKey(name)) {
> Label current = map.get(name); <-- THIS RETURNS current AS NULL.
> String key = current.getPath();
>
>
> Could we have only one Element even if @Paths are different? Struck around
> this for long. Is there a work around?
>
>
>
--
View this message in context: http://old.nabble.com/NullPointerException-for-similar-Element-Names-with-different-%40Paths-tp34277238p34281760.html
Sent from the Simple XML Serialization mailing list archive at Nabble.com.
|
|
From: Niall G. - Y. <Nia...@yi...> - 2012-08-10 03:04:52
|
No, just ignore the library message on LogCat From: Bryan Barnes [mailto:bb...@lu...] Sent: Tuesday, 31 July 2012 12:12 AM To: sim...@li... Subject: Re: [Simple-support] javax dependency problem for Android Oops - sorry, forgot to mention that I have set the strict argument to false while deserializing. From: Bryan Barnes Sent: Monday, July 30, 2012 10:06 AM To: 'sim...@li...' Subject: javax dependency problem for Android While deserializing objects I noticed this output in LogCat: 07-30 09:38:45.183: I/dalvikvm(22970): Could not find method javax.xml.stream.XMLInputFactory.newInstance, referenced from method org.simpleframework.xml.stream.StreamProvider.<init> 07-30 09:38:45.183: W/dalvikvm(22970): VFY: unable to resolve static method 7583: Ljavax/xml/stream/XMLInputFactory;.newInstance ()Ljavax/xml/stream/XMLInputFactory; 07-30 09:38:45.183: D/dalvikvm(22970): VFY: replacing opcode 0x71 at 0x0003 07-30 09:38:45.183: W/dalvikvm(22970): VFY: unable to find class referenced in signature (Ljavax/xml/stream/XMLEventReader;) ...and soon after: 07-30 09:39:01.243: W/System.err(22970): org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.Element(data=false, name=, required=true, type=void) on field ....... for class ....... at line 1 I just introduced this library recently and am guessing I need one of the jar files from the lib folder distributed with Simple. Which one? Thanks a lot, Bryan |
|
From: Niall G. - Y. <Nia...@yi...> - 2012-08-10 02:59:53
|
The problem with nulls is representing it in XML, is <tag></tag> null or “”, if I could distinguish from </tag> and <tag></tag> things would be easy, bit its not possible with StAX, DOM, or XmlPull. So the empty= attribute is required. From: Robin Drew [mailto:rob...@gm...] Sent: Wednesday, 1 August 2012 2:18 AM To: sim...@li... Subject: [Simple-support] Empty Primitive Arrays Hi, As a follow up from the previous mail - I do note the "empty" attribute for the annotation allows for empty array de-serialization, so mostly my previous can be disregarded. I would however ask why this is not defaulted for those common types for which there is clearly no ambiguity as to whether it is an empty array such as int[] etc. Cheers, Robin |
|
From: amit.shipra <ami...@rb...> - 2012-08-09 16:07:24
|
Please ignore. My bad. Didn't read the document carefully. This solved the
problem.
@Element(name="sourceSystem[1]")
@Path("ns0:book/ns0:identifier")
private String bookSourceSystem="system1";
@Element(name="sourceSystem[2]")
@Path("ns0:trader/ns0:identifier")
private String traderSourceSystem="system2";
amit.shipra wrote:
>
> Hi there,
>
> XML looks like:
>
> <ns0:book id="BOOK">
> <ns0:identifier>
> <ns0:sourceSystem>DTCC</ns0:sourceSystem>
> </ns0:identifier>
> </ns0:book>
> <ns0:trader id="ID_EXECUTING_TRADER">
> <ns0:identifier>
> <ns0:sourceSystem>NYSE</ns0:sourceSystem>
> </ns0:identifier>
> </ns0:trader>
>
>
> and my JAVA code (for sourceSystem Element) is:
>
> @Element(name="sourceSystem")
> @Path("ns0:book/ns0:identifier")
> private String bookSourceSystem="system1";
>
>
> @Element(name="sourceSystem")
> @Path("ns0:trader/ns0:identifier")
> private String traderSourceSystem="system2";
>
>
> However, I am getting the NullPointerException:
>
> StackTrace:
> Exception in thread "main" java.lang.NullPointerException
> at
> org.simpleframework.xml.core.InstantiatorBuilder.register(InstantiatorBuilder.java:461)
> at
> org.simpleframework.xml.core.InstantiatorBuilder.register(InstantiatorBuilder.java:433)
> at
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:283)
> at
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:259)
> at
> org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:200)
> at org.simpleframework.xml.core.Scanner.field(Scanner.java:511)
> at org.simpleframework.xml.core.Scanner.scan(Scanner.java:395)
> at org.simpleframework.xml.core.Scanner.<init>(Scanner.java:104)
> at
> org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory.java:77)
> at org.simpleframework.xml.core.Support.getScanner(Support.java:203)
> at org.simpleframework.xml.core.Source.getScanner(Source.java:271)
> at org.simpleframework.xml.core.Source.getCaller(Source.java:300)
> at
> org.simpleframework.xml.core.Composite.writeReplace(Composite.java:1147)
> at org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1124)
> at
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:1098)
> at
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
> at org.simpleframework.xml.core.Composite.write(Composite.java:975)
> at org.simpleframework.xml.core.Composite.write(Composite.java:952)
> at
> org.simpleframework.xml.core.Composite.writeElement(Composite.java:1256)
> at
> org.simpleframework.xml.core.Composite.writeElement(Composite.java:1239)
> at org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1127)
> at
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:1098)
> at
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
> at
> org.simpleframework.xml.core.Composite.writeElements(Composite.java:1087)
> at
> org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
> at org.simpleframework.xml.core.Composite.write(Composite.java:975)
> at org.simpleframework.xml.core.Composite.write(Composite.java:952)
> at org.simpleframework.xml.core.Traverser.write(Traverser.java:236)
> at org.simpleframework.xml.core.Traverser.write(Traverser.java:208)
> at org.simpleframework.xml.core.Traverser.write(Traverser.java:186)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1180)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1162)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1140)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1259)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1241)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1222)
> at org.simpleframework.xml.core.Persister.write(Persister.java:1201)
>
>
> Source code block:
>
> private void register(Label label, LabelMap map) throws Exception {
> String name = label.getName();
> String path = label.getPath();
>
> if(map.containsKey(name)) {
> Label current = map.get(name); <-- THIS RETURNS current AS NULL.
> String key = current.getPath();
>
>
> Could we have only one Element even if @Paths are different? Struck around
> this for long. Is there a work around?
>
>
>
--
View this message in context: http://old.nabble.com/NullPointerException-for-similar-Element-Names-with-different-%40Paths-tp34277238p34277794.html
Sent from the Simple XML Serialization mailing list archive at Nabble.com.
|
|
From: Eunkyoung L. <ek...@st...> - 2012-08-09 15:15:59
|
Thank you for your answer.
I have one more question with serialization (opposite case).
If my module gets some xml snippet with element from other module , how can I serialize whole xml file with this text.
My module doesn’t know the schema of this xml snippet because this is application specific.
If I use String (@Text) for it, I can’t avoid validate exemption – Text has element - and escape.
If I use converter, can I avoid validate exemption ?
And how can I avoid escape() in writing ? writeText will do escape() for “<” and “>”
Example
@Root(name = "app-specific", strict=false)
public class AppSpecific {
@Text
protected String xmlText;
public void setAny(String text) {
this.xmlText = text;
}
}
AppSpecific test = new AppSpecific();
test.setAny("<Thresholds><Threshold><TypeId>57664</TypeId><Min> 100 </Min><Max> 50 </Max><Units>%</Units></Threshold></Thresholds>");
Aina Eunkyoung Lee
Samsung Telecommunications America
1301 E. Lookout Dr.
Richardson, TX 75082
Telephone : 972-761-7792
ek...@st...<mailto:mr...@st...>
From: Niall Gallagher [mailto:gal...@ya...]
Sent: Thursday, August 09, 2012 3:35 AM
To: sim...@li...; Eunkyoung Lee
Subject: Re: [Simple-support] xs:any with depth elements
You can not get it directly, however you can rebuild it within the converter with a StringBuilder. I am going to do an @Literal annotation to address this, however it may be a couple of months before I can do this.
--- On Wed, 8/8/12, Eunkyoung Lee <ek...@st...<mailto:ek...@st...>> wrote:
From: Eunkyoung Lee <ek...@st...<mailto:ek...@st...>>
Subject: [Simple-support] xs:any with depth elements
To: "sim...@li...<mailto:sim...@li...>" <sim...@li...<mailto:sim...@li...>>
Received: Wednesday, 8 August, 2012, 1:39 PM
I have 2 questions.
First , I have a problem with deserialization. Xml has xs:any element and it have hierarchical child node. When I tried to search this problem, convertor can be used for xs:any. But I’m not sure whether it can cover hierarchical xml also.
<element name="app-specific">
<complexType>
<sequence>
<any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="skip">
<annotation>
<documentation>
<summary>Application specific data in XML form.</summary>
<remarks>An application can define any arbitrary XMLas it's data. It may or may not adhere toa published schema.</remarks>
</documentation>
</annotation>
</any>
</sequence>
</complexType>
</element>
Example
<app-specific>
<Thresholds> <!-- xs:any start -->
<Threshold>
<TypeId> 57664 </TypeId>
<Min> 100 </Min>
<Max> 50 </Max>
<Units>%</Units>
</Threshold>
</Thresholds> <!—xs:any end -->
</app-specific>
Second, I want to get some part of xml as text even element is inside, is it possible?
For example I want to get “<Thresholds><Threshold><TypeId> 57664 </TypeId><Min> 100 </Min><Max> 50 </Max><Units>%</Units></Threshold> </Thresholds>” as Text.
I want to parse it later or send it to other application.
Any help will be appreciated.
Aina Eunkyoung Lee
Samsung Telecommunications America
1301 E. Lookout Dr.
Richardson, TX 75082
Telephone : 972-761-7792
ek...@st...</mc/compose?to...@st...>
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...</mc/compose?to=...@li...>
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: amit.shipra <ami...@rb...> - 2012-08-09 14:18:35
|
Hi there,
XML looks like:
<ns0:book id="BOOK">
<ns0:identifier>
<ns0:sourceSystem>DTCC</ns0:sourceSystem>
</ns0:identifier>
</ns0:book>
<ns0:trader id="ID_EXECUTING_TRADER">
<ns0:identifier>
<ns0:sourceSystem>NYSE</ns0:sourceSystem>
</ns0:identifier>
</ns0:trader>
and my JAVA code (for sourceSystem Element) is:
@Element(name="sourceSystem")
@Path("ns0:book/ns0:identifier")
private String bookSourceSystem="system1";
@Element(name="sourceSystem")
@Path("ns0:trader/ns0:identifier")
private String traderSourceSystem="system2";
However, I am getting the NullPointerException:
StackTrace:
Exception in thread "main" java.lang.NullPointerException
at
org.simpleframework.xml.core.InstantiatorBuilder.register(InstantiatorBuilder.java:461)
at
org.simpleframework.xml.core.InstantiatorBuilder.register(InstantiatorBuilder.java:433)
at
org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:283)
at
org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:259)
at
org.simpleframework.xml.core.StructureBuilder.process(StructureBuilder.java:200)
at org.simpleframework.xml.core.Scanner.field(Scanner.java:511)
at org.simpleframework.xml.core.Scanner.scan(Scanner.java:395)
at org.simpleframework.xml.core.Scanner.<init>(Scanner.java:104)
at
org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory.java:77)
at org.simpleframework.xml.core.Support.getScanner(Support.java:203)
at org.simpleframework.xml.core.Source.getScanner(Source.java:271)
at org.simpleframework.xml.core.Source.getCaller(Source.java:300)
at org.simpleframework.xml.core.Composite.writeReplace(Composite.java:1147)
at org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1124)
at
org.simpleframework.xml.core.Composite.writeElements(Composite.java:1098)
at org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
at org.simpleframework.xml.core.Composite.write(Composite.java:975)
at org.simpleframework.xml.core.Composite.write(Composite.java:952)
at org.simpleframework.xml.core.Composite.writeElement(Composite.java:1256)
at org.simpleframework.xml.core.Composite.writeElement(Composite.java:1239)
at org.simpleframework.xml.core.Composite.writeUnion(Composite.java:1127)
at
org.simpleframework.xml.core.Composite.writeElements(Composite.java:1098)
at org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
at
org.simpleframework.xml.core.Composite.writeElements(Composite.java:1087)
at org.simpleframework.xml.core.Composite.writeSection(Composite.java:1004)
at org.simpleframework.xml.core.Composite.write(Composite.java:975)
at org.simpleframework.xml.core.Composite.write(Composite.java:952)
at org.simpleframework.xml.core.Traverser.write(Traverser.java:236)
at org.simpleframework.xml.core.Traverser.write(Traverser.java:208)
at org.simpleframework.xml.core.Traverser.write(Traverser.java:186)
at org.simpleframework.xml.core.Persister.write(Persister.java:1180)
at org.simpleframework.xml.core.Persister.write(Persister.java:1162)
at org.simpleframework.xml.core.Persister.write(Persister.java:1140)
at org.simpleframework.xml.core.Persister.write(Persister.java:1259)
at org.simpleframework.xml.core.Persister.write(Persister.java:1241)
at org.simpleframework.xml.core.Persister.write(Persister.java:1222)
at org.simpleframework.xml.core.Persister.write(Persister.java:1201)
Source code block:
private void register(Label label, LabelMap map) throws Exception {
String name = label.getName();
String path = label.getPath();
if(map.containsKey(name)) {
Label current = map.get(name); <-- THIS RETURNS current AS NULL.
String key = current.getPath();
Could we have only one Element even if @Paths are different? Struck around
this for long. Is there a work around?
--
View this message in context: http://old.nabble.com/NullPointerException-for-similar-Element-Names-with-different-%40Paths-tp34277238p34277238.html
Sent from the Simple XML Serialization mailing list archive at Nabble.com.
|
|
From: Niall G. <gal...@ya...> - 2012-08-09 08:35:12
|
You can not get it directly, however you can rebuild it within the converter with a StringBuilder. I am going to do an @Literal annotation to address this, however it may be a couple of months before I can do this. --- On Wed, 8/8/12, Eunkyoung Lee <ek...@st...> wrote: From: Eunkyoung Lee <ek...@st...> Subject: [Simple-support] xs:any with depth elements To: "sim...@li..." <sim...@li...> Received: Wednesday, 8 August, 2012, 1:39 PM I have 2 questions. First , I have a problem with deserialization. Xml has xs:any element and it have hierarchical child node. When I tried to search this problem, convertor can be used for xs:any. But I’m not sure whether it can cover hierarchical xml also. <element name="app-specific"> <complexType> <sequence> <any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="skip"> <annotation> <documentation> <summary>Application specific data in XML form.</summary> <remarks>An application can define any arbitrary XMLas it's data. It may or may not adhere toa published schema.</remarks> </documentation> </annotation> </any> </sequence> </complexType> </element> Example <app-specific> <Thresholds> <!-- xs:any start --><Threshold><TypeId> 57664 </TypeId> <Min> 100 </Min><Max> 50 </Max><Units>%</Units></Threshold> </Thresholds> <!—xs:any end --></app-specific> Second, I want to get some part of xml as text even element is inside, is it possible?For example I want to get “<Thresholds><Threshold><TypeId> 57664 </TypeId><Min> 100 </Min><Max> 50 </Max><Units>%</Units></Threshold> </Thresholds>” as Text.I want to parse it later or send it to other application. Any help will be appreciated. Aina Eunkyoung Lee Samsung Telecommunications America 1301 E. Lookout Dr. Richardson, TX 75082 Telephone : 972-761-7792 ek...@st... -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Eunkyoung L. <ek...@st...> - 2012-08-08 21:05:54
|
I have 2 questions.
First , I have a problem with deserialization. Xml has xs:any element and it have hierarchical child node. When I tried to search this problem, convertor can be used for xs:any. But I'm not sure whether it can cover hierarchical xml also.
<element name="app-specific">
<complexType>
<sequence>
<any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="skip">
<annotation>
<documentation>
<summary>Application specific data in XML form.</summary>
<remarks>An application can define any arbitrary XMLas it's data. It may or may not adhere toa published schema.</remarks>
</documentation>
</annotation>
</any>
</sequence>
</complexType>
</element>
Example
<app-specific>
<Thresholds> <!-- xs:any start -->
<Threshold>
<TypeId> 57664 </TypeId>
<Min> 100 </Min>
<Max> 50 </Max>
<Units>%</Units>
</Threshold>
</Thresholds> <!-xs:any end -->
</app-specific>
Second, I want to get some part of xml as text even element is inside, is it possible?
For example I want to get "<Thresholds><Threshold><TypeId> 57664 </TypeId><Min> 100 </Min><Max> 50 </Max><Units>%</Units></Threshold> </Thresholds>" as Text.
I want to parse it later or send it to other application.
Any help will be appreciated.
Aina Eunkyoung Lee
Samsung Telecommunications America
1301 E. Lookout Dr.
Richardson, TX 75082
Telephone : 972-761-7792
ek...@st...<mailto:mr...@st...>
|
|
From: Niall G. <gal...@ya...> - 2012-08-07 05:02:58
|
add the @Attribute(name="id") to the constructor in B
--- On Mon, 6/8/12, Nhat Ngo <phu...@gm...> wrote:
From: Nhat Ngo <phu...@gm...>
Subject: [Simple-support] Deserilize objects with inheritance
To: sim...@li...
Received: Monday, 6 August, 2012, 7:27 PM
Hi everyone,
I'm a student, new to SimpleXML library. Per the title suggested, I am having a huge problem deserializing a stored inherited object using Java SimpleXML library. Let's say my codes are:@Root(name="a")
public class A {
@Attribute(name="id")
protected int id;
public A(@Attribute(name="id") int id){
this.id = id;
}
}
@Root(name="b")
public class B extends A {
@Element(name="key",type=int.class)
private int key;
public B(int id,
@Element(name="key",type=int.class) int key) {
super(id);
this.key = key;
}
}
public class Main {
public static void Main() {
File src = new File("example.xml");
Serializer serializer = new Persister();
//Serialize the object
B b = new B(1,1);
serializer.write(b, src);
//Error here, deserialize the object
B b2 = serializer.read(B.class, src);
}
}
There is no error and the Serializer happily serializes the object b to:<b id="1">
<key>1</key>
</b>
Now when I attempt to deserialize it, the program throws:org.simpleframework.xml.core.PersistenceException: Constructor not matched for class B
How should I annotate both class A and B to behave correctly? I've tried put in @Attribute(name="id") in B constructor to no avail and the serializer failed to serialize anything.
Thanks.
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Simon B. <sim...@if...> - 2012-08-07 04:42:52
|
You need to remove the @Root annotation from class B.Nhat Ngo <phu...@gm...> hat geschrieben:Hi everyone,
I'm a student, new to SimpleXML library. Per the title suggested, I am having a huge problem deserializing a stored inherited object using Java SimpleXML library. Let's say my codes are:
@Root(name="a")
public class A {
@Attribute(name="id")
protected int id;
public A(@Attribute(name="id") int id){
this.id = id;
}
}
@Root(name="b")
public class B extends A {
@Element(name="key",type=int.class)
private int key;
public B(int id,
@Element(name="key",type=int.class) int key) {
super(id);
this.key = key;
}
}
public class Main {
public static void Main() {
File src = new File("example.xml");
Serializer serializer = new Persister();
//Serialize the object
B b = new B(1,1);
serializer.write(b, src);
//Error here, deserialize the object
B b2 = serializer.read(B.class, src);
}
}
There is no error and the Serializer happily serializes the object b to:
<b id="1">
<key>1</key>
</b>
Now when I attempt to deserialize it, the program throws:
org.simpleframework.xml.core.PersistenceException: Constructor not matched for class B
How should I annotate both class A and B to behave correctly? I've tried put in @Attribute(name="id") in B constructor to no avail and the serializer failed to serialize anything.
Thanks.
|
|
From: Nhat N. <phu...@gm...> - 2012-08-07 02:27:22
|
Hi everyone,
I'm a student, new to SimpleXML library. Per the title suggested, I am
having a huge problem deserializing a stored inherited object using Java
SimpleXML library. Let's say my codes are:
@Root(name="a")
public class A {
@Attribute(name="id")
protected int id;
public A(@Attribute(name="id") int id){
this.id = id;
}
}
@Root(name="b")
public class B extends A {
@Element(name="key",type=int.class)
private int key;
public B(int id,
@Element(name="key",type=int.class) int key) {
super(id);
this.key = key;
}
}
public class Main {
public static void Main() {
File src = new File("example.xml");
Serializer serializer = new Persister();
//Serialize the object
B b = new B(1,1);
serializer.write(b, src);
//Error here, deserialize the object
B b2 = serializer.read(B.class, src);
}
}
There is no error and the Serializer happily serializes the object b to:
<b id="1">
<key>1</key>
</b>
Now when I attempt to deserialize it, the program throws:
org.simpleframework.xml.core.PersistenceException: Constructor not
matched for class B
How should I annotate both class A and B to behave correctly? I've tried
put in @Attribute(name="id") in B constructor to no avail and the
serializer failed to serialize anything.
Thanks.
|
|
From: Niall G. <gal...@ya...> - 2012-08-06 22:40:51
|
Ignore this error, this has no impact on the use of Simple. What happening here is the library has a preference order, StAX, then XmlPull, then Dom. Android uses XmlPull, so this is loaded when StAX fails.
--- On Mon, 6/8/12, Alex Cutovoi <mob...@gm...> wrote:
From: Alex Cutovoi <mob...@gm...>
Subject: [Simple-support] Error on using simplexml on android
To: sim...@li...
Received: Monday, 6 August, 2012, 12:03 PM
Hi for all.
I'm using the simplexml to write on android a simple class. I've followed the tutorials on the site. Below is one of the classes I want to insert:@Root(name="news-sites")
private class NewsSites{ @Element private Site site = null;
@ElementList private ArrayList<Site>siteList;
public NewsSites(){ siteList = new ArrayList<Site>(0);
} public void addSite(Site site){
siteList.add(site); } }
Very simple. This is the way I insert: try{ File file = new File(path+"/"+fileName);
Log.i("INFO", "1"); if(!file.exists()){ file = new File(path+"/"+fileName);
Log.i("INFO", "2"); //file.createNewFile(); Log.i("INFO", "3");
serializer.write(newsSites, file); Log.i("INFO", "4");
} Log.i("INFO", "WRITED");
}
But, this produces the following error.
08-06 15:57:56.832: I/dalvikvm(8861): Could not find method javax.xml.stream.XMLInputFactory.createXMLEventReader, referenced from method org.simpleframework.xml.stream.StreamProvider.provide
I believe it's because android doesn't have support for Stax. This is strange because simpleframework, when compiled, needs stax jars.
Do I need to force the insertion of Stax?
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|
|
From: Alex C. <mob...@gm...> - 2012-08-06 19:03:30
|
Hi for all.
I'm using the simplexml to write on android a simple class. I've followed
the tutorials on the site. Below is one of the classes I want to insert:
@Root(name="news-sites")
private class NewsSites{
@Element
private Site site = null;
@ElementList
private ArrayList<Site>siteList;
public NewsSites(){
siteList = new ArrayList<Site>(0);
}
public void addSite(Site site){
siteList.add(site);
}
}
Very simple. This is the way I insert:
try{
File file = new File(path+"/"+fileName);
Log.i("INFO", "1");
if(!file.exists()){
file = new File(path+"/"+fileName);
Log.i("INFO", "2");
//file.createNewFile();
Log.i("INFO", "3");
serializer.write(newsSites, file);
Log.i("INFO", "4");
}
Log.i("INFO", "WRITED");
}
But, this produces the following error.
08-06 15:57:56.832: I/dalvikvm(8861): Could not find method
javax.xml.stream.XMLInputFactory.createXMLEventReader, referenced from
method org.simpleframework.xml.stream.StreamProvider.provide
I believe it's because android doesn't have support for Stax. This is
strange because simpleframework, when compiled, needs stax jars.
Do I need to force the insertion of Stax?
|
|
From: Jean-Michel <int...@gm...> - 2012-08-06 12:30:00
|
On Mon, Aug 6, 2012 at 2:13 PM, Niall Gallagher <gal...@ya...> wrote: > > What version of Simple, 2.6.6 has some big perf improvements, and the next > release should also have. I had a 10 times increase from 2.6.5 to 2.6.6. > Also there is a proguard file which improves the performance by another > reasonable amount. Wow, the new version is indeed much faster. My xml is parsed in 1.2 s instead of 8s ! Problem solved for me, thanks a lot. Jean-Michel |
|
From: Niall G. <gal...@ya...> - 2012-08-06 12:18:42
|
Let me know how you go with 2.6.6, I have not yet had any feedback on it. So, other than my own experiences with my XML parsing on Android I really have no idea how its been working for other people. But it should be much faster, and 2.6.7 should be faster again when I release it. --- On Mon, 6/8/12, Niall Gallagher <gal...@ya...> wrote: From: Niall Gallagher <gal...@ya...> Subject: Re: [Simple-support] Performance issues on android To: "simple-support" <sim...@li...>, "Jean-Michel" <int...@gm...> Received: Monday, 6 August, 2012, 5:13 AM What version of Simple, 2.6.6 has some big perf improvements, and the next release should also have. I had a 10 times increase from 2.6.5 to 2.6.6. Also there is a proguard file which improves the performance by another reasonable amount. --- On Mon, 6/8/12, Jean-Michel <int...@gm...> wrote: From: Jean-Michel <int...@gm...> Subject: [Simple-support] Performance issues on android To: "simple-support" <sim...@li...> Received: Monday, 6 August, 2012, 1:11 AM Hello, Simple has the greatest API ever for parsing xml files, thanks a lot !Sadly, it's a bit slow on Android for me :on a Samsung Galaxy S, the user has to wait 8 seconds before the parsing of the scenario (see attached file with 367 lines which will serialize into 56 java objects) finishes. The complete project is avaible here :http://dl.dropbox.com/u/16861689/simple3.zip Here is the substance of it : @Rootpublic class ScenarioDataSet { @ElementListUnion({ @ElementList(entry="SMTPScenario", type=SMTPScenario.class, inline=true), @ElementList(entry="PINGScenario", type=PINGScenario.class, inline=true), @ElementList(entry="DLScenario", type=DLScenario.class, inline=true), @ElementList(entry="HTTPScenario", type=HTTPScenario.class, inline=true), @ElementList(entry="POPScenario", type=POPScenario.class, inline=true), @ElementList(entry="Settings", type=Settings.class, inline=true), @ElementList(entry="ScenarioTable", type=ScenarioTable.class, inline=true), @ElementList(entry="ProcessScenario", type=ProcessScenario.class, inline=true), @ElementList(entry="RAS_APN", type=RAS_APN.class, inline=true), @ElementList(entry="NDIS_APN", type=NDIS_APN.class, inline=true), @ElementList(entry="DataTableGroupe", type=DataTableGroupe.class, inline=true), @ElementList(entry="DataTableCommand", type=DataTableCommand.class, inline=true) }) public List<Object> list; } Are they tricks to do better ? Jean-Michel -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Niall G. <gal...@ya...> - 2012-08-06 12:14:00
|
What version of Simple, 2.6.6 has some big perf improvements, and the next release should also have. I had a 10 times increase from 2.6.5 to 2.6.6. Also there is a proguard file which improves the performance by another reasonable amount. --- On Mon, 6/8/12, Jean-Michel <int...@gm...> wrote: From: Jean-Michel <int...@gm...> Subject: [Simple-support] Performance issues on android To: "simple-support" <sim...@li...> Received: Monday, 6 August, 2012, 1:11 AM Hello, Simple has the greatest API ever for parsing xml files, thanks a lot !Sadly, it's a bit slow on Android for me :on a Samsung Galaxy S, the user has to wait 8 seconds before the parsing of the scenario (see attached file with 367 lines which will serialize into 56 java objects) finishes. The complete project is avaible here :http://dl.dropbox.com/u/16861689/simple3.zip Here is the substance of it : @Rootpublic class ScenarioDataSet { @ElementListUnion({ @ElementList(entry="SMTPScenario", type=SMTPScenario.class, inline=true), @ElementList(entry="PINGScenario", type=PINGScenario.class, inline=true), @ElementList(entry="DLScenario", type=DLScenario.class, inline=true), @ElementList(entry="HTTPScenario", type=HTTPScenario.class, inline=true), @ElementList(entry="POPScenario", type=POPScenario.class, inline=true), @ElementList(entry="Settings", type=Settings.class, inline=true), @ElementList(entry="ScenarioTable", type=ScenarioTable.class, inline=true), @ElementList(entry="ProcessScenario", type=ProcessScenario.class, inline=true), @ElementList(entry="RAS_APN", type=RAS_APN.class, inline=true), @ElementList(entry="NDIS_APN", type=NDIS_APN.class, inline=true), @ElementList(entry="DataTableGroupe", type=DataTableGroupe.class, inline=true), @ElementList(entry="DataTableCommand", type=DataTableCommand.class, inline=true) }) public List<Object> list; } Are they tricks to do better ? Jean-Michel -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |
|
From: Robin D. <rob...@gm...> - 2012-07-31 16:18:31
|
Hi, As a follow up from the previous mail - I do note the "empty" attribute for the annotation allows for empty array de-serialization, so mostly my previous can be disregarded. I would however ask why this is not defaulted for those common types for which there is clearly no ambiguity as to whether it is an empty array such as int[] etc. Cheers, Robin |
|
From: Robin D. <rob...@gm...> - 2012-07-31 16:07:20
|
@Root(name = "ArrayTest")
public class ArrayTest {
@Attribute
private long[] coordinates = new long[0];
public static void main(String[] args) throws Exception {
StringWriter writer = new StringWriter();
new Persister().write(new ArrayTest(), writer);
String xml = writer.toString();
new Persister().read(ArrayTest.class, new StringReader(xml));
}
}
*The above fails attempting to parse a long from an empty string - yet the
array is empty!*
Hi - I noticed an issue with deserializing empty primitive (or even
non-primitive) arrays. As empty string is used to represent an empty array,
the split method in the ArrayTransform fails to obtain the correct length
of the list. Split on an empty string results in an array of length 1,
however the original array was empty. I can see there is still an issue
with empty string arrays, however for types which can not possibly have
elements as empty strings such as int arrays. I would suggest the API
refuse to serialize empty arrays if the result will be ambiguous.
If this is a feature not a bug, let me know - I believe I have the latest
source (2.6.6).
Many thanks, love the API by the way - use it loads!
Regards,
Robin
|
|
From: Niall G. <gal...@ya...> - 2012-07-30 22:34:14
|
A converter can do this for you with Simple, you need to implement the org.simpleframework.xml.convert.Converter interface. Take a look at the unit tests. Its very easy to do. --- On Mon, 30/7/12, Aaron Digulla <di...@he...> wrote: > From: Aaron Digulla <di...@he...> > Subject: Re: [Simple-support] Availabily of object inlining > To: sim...@li... > Received: Monday, 30 July, 2012, 12:25 PM > Am 30.07.2012 20:20, schrieb Maxim > Solodovnik: > > Hello Niall > > > > sorry for double post > > I was able to parse "inline" object by using following > "ugly" code: > > InputNode root = NodeBuilder.read(new > FileInputStream(xml)); > > InputNode root1 = NodeBuilder.read(new > FileInputStream(xml)); //HACK to > > handle Adresses inside user > > I don't see how that could help since it reads the same file > twice > (instead of reading more nodes in the same file). > > > can you advise how can I handle duplicated element in > source XML (one > > element was printed twice by mistake) > > Yes. Remember: If something seems impossible to do, then you > might have > the wrong tool. > > So the solution in your case is that the old XML is corrupt. > To fix > this, you can: > > 1. Create a second mapping (i.e. new classes, new mappings) > and then > write a tool that create the new object structure from the > new mapping. > > 2. Use XSLT or some other simple XML transformer to convert > the old > format into the new one. > > Simple can't do this for you since it uses annotations to > configure the > parsing process and in Java, each field/class/method can > have only one > annotation. > > Regards, > > -- > Aaron "Optimizer" Digulla a.k.a. Philmann Dark > "It's not the universe that's limited, it's our > imagination. > Follow me and I'll show you something beyond the limits." > http://blog.pdark.de/ > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's > security and > threat landscape has changed and how IT managers can > respond. Discussions > will include endpoint security, mobile security and the > latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > |
|
From: Aaron D. <di...@he...> - 2012-07-30 19:28:46
|
Am 30.07.2012 20:20, schrieb Maxim Solodovnik: > Hello Niall > > sorry for double post > I was able to parse "inline" object by using following "ugly" code: > InputNode root = NodeBuilder.read(new FileInputStream(xml)); > InputNode root1 = NodeBuilder.read(new FileInputStream(xml)); //HACK to > handle Adresses inside user I don't see how that could help since it reads the same file twice (instead of reading more nodes in the same file). > can you advise how can I handle duplicated element in source XML (one > element was printed twice by mistake) Yes. Remember: If something seems impossible to do, then you might have the wrong tool. So the solution in your case is that the old XML is corrupt. To fix this, you can: 1. Create a second mapping (i.e. new classes, new mappings) and then write a tool that create the new object structure from the new mapping. 2. Use XSLT or some other simple XML transformer to convert the old format into the new one. Simple can't do this for you since it uses annotations to configure the parsing process and in Java, each field/class/method can have only one annotation. Regards, -- Aaron "Optimizer" Digulla a.k.a. Philmann Dark "It's not the universe that's limited, it's our imagination. Follow me and I'll show you something beyond the limits." http://blog.pdark.de/ |
|
From: Maxim S. <sol...@gm...> - 2012-07-30 18:21:01
|
Hello Niall
sorry for double post
I was able to parse "inline" object by using following "ugly" code:
InputNode root = NodeBuilder.read(new FileInputStream(xml));
InputNode root1 = NodeBuilder.read(new FileInputStream(xml)); //HACK to
handle Adresses inside user
InputNode listNode = root.getNext();
InputNode listNode1 = root1.getNext(); //HACK to handle inline object
A a = serializer.read(A.class, listNode , false);
B b = serializer.read(B.class, listNode1 , false);
can you advise how can I handle duplicated element in source XML (one
element was printed twice by mistake)
Thanks in advance
On Tue, Jul 31, 2012 at 12:15 AM, Maxim Solodovnik <sol...@gm...>wrote:
> Hello Niall,
>
> Thanks for the quick reply.
>
> Here is the full story:
> Our application performs backup of the DB into XML files.
> I try to update this system to use Simple XML framework.
>
> The new version should work with old backup files :(
> So I need possibility to import old XML files.
>
> currently I have 2 problems:
> 1) contents of B is inside A
> 2) A contains 1 node 2 times
>
> I tried to parse object in "semi-automatic" mode by trying to process
> InputNode twice:
> first time for object A and second time for object B
>
> But this seems to be impossible since InputNode is iterable only once :(((
>
> can you suggest any clue for this?
>
> I personally think of XSLT transform of the document prior to import (but
> it not seems to be very good solution)
>
> Thanks in advance for your answers
>
> BTW I'm currently using 2.6.6 version
>
>
> On Mon, Jul 30, 2012 at 4:48 PM, Niall Gallagher <
> gal...@ya...> wrote:
>
>> You could use a Converter, or you could just serialize one object i.e
>> drop B.
>>
>> --- On *Fri, 27/7/12, Maxim Solodovnik <sol...@gm...>* wrote:
>>
>>
>> From: Maxim Solodovnik <sol...@gm...>
>> Subject: [Simple-support] Availabily of object inlining
>> To: sim...@li...
>> Received: Friday, 27 July, 2012, 2:04 AM
>>
>>
>> Hello,
>>
>> I have very specific question regarding object serialization:
>> Our current code uses "hand writed" serialization/deserialization to/from
>> XML.
>> I would like to port it to use "Simple framework".
>>
>> 2 features I was unable to find in documentation/examples
>> 1) serializing of List<MyObject> (can be workarounded by creating
>> additional class holding list as the only parameter)
>> 2) inlining of property object:
>> imaging we have
>> @Root
>> class A {
>> @Element
>> String prop;
>> @Element
>> B b;
>> }
>>
>> @Root
>> class B {
>> @Element
>> String propB1;
>> @Element
>> String propB2;
>> }
>>
>> Serializing of A will produce:
>> <a>
>> <prop></prop>
>> <b>
>> <propB1></propB1>
>> <propB2></propB2>
>> </b>
>> </a>
>>
>> what I need is to get (to be compatible with previous versions)
>> <a>
>> <prop></prop>
>> <propB1></propB1>
>> <propB2></propB2>
>> </a>
>>
>> Is this possible somehow?
>>
>> Maybe 1) above can be implemented without creating additional class?
>>
>> Sorry for the long post
>> Thanks in advance
>>
>> --
>> WBR
>> Maxim aka solomax
>>
>> -----Inline Attachment Follows-----
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>
>> -----Inline Attachment Follows-----
>>
>> _______________________________________________
>> Simple-support mailing list
>> Sim...@li...<http://mc/compose?to=...@li...>
>> https://lists.sourceforge.net/lists/listinfo/simple-support
>>
>>
>
>
> --
> WBR
> Maxim aka solomax
>
--
WBR
Maxim aka solomax
|
|
From: Maxim S. <sol...@gm...> - 2012-07-30 17:16:06
|
Hello Niall,
Thanks for the quick reply.
Here is the full story:
Our application performs backup of the DB into XML files.
I try to update this system to use Simple XML framework.
The new version should work with old backup files :(
So I need possibility to import old XML files.
currently I have 2 problems:
1) contents of B is inside A
2) A contains 1 node 2 times
I tried to parse object in "semi-automatic" mode by trying to process
InputNode twice:
first time for object A and second time for object B
But this seems to be impossible since InputNode is iterable only once :(((
can you suggest any clue for this?
I personally think of XSLT transform of the document prior to import (but
it not seems to be very good solution)
Thanks in advance for your answers
BTW I'm currently using 2.6.6 version
On Mon, Jul 30, 2012 at 4:48 PM, Niall Gallagher
<gal...@ya...>wrote:
> You could use a Converter, or you could just serialize one object i.e drop
> B.
>
> --- On *Fri, 27/7/12, Maxim Solodovnik <sol...@gm...>* wrote:
>
>
> From: Maxim Solodovnik <sol...@gm...>
> Subject: [Simple-support] Availabily of object inlining
> To: sim...@li...
> Received: Friday, 27 July, 2012, 2:04 AM
>
>
> Hello,
>
> I have very specific question regarding object serialization:
> Our current code uses "hand writed" serialization/deserialization to/from
> XML.
> I would like to port it to use "Simple framework".
>
> 2 features I was unable to find in documentation/examples
> 1) serializing of List<MyObject> (can be workarounded by creating
> additional class holding list as the only parameter)
> 2) inlining of property object:
> imaging we have
> @Root
> class A {
> @Element
> String prop;
> @Element
> B b;
> }
>
> @Root
> class B {
> @Element
> String propB1;
> @Element
> String propB2;
> }
>
> Serializing of A will produce:
> <a>
> <prop></prop>
> <b>
> <propB1></propB1>
> <propB2></propB2>
> </b>
> </a>
>
> what I need is to get (to be compatible with previous versions)
> <a>
> <prop></prop>
> <propB1></propB1>
> <propB2></propB2>
> </a>
>
> Is this possible somehow?
>
> Maybe 1) above can be implemented without creating additional class?
>
> Sorry for the long post
> Thanks in advance
>
> --
> WBR
> Maxim aka solomax
>
> -----Inline Attachment Follows-----
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> Simple-support mailing list
> Sim...@li...<http://mc/compose?to=...@li...>
> https://lists.sourceforge.net/lists/listinfo/simple-support
>
>
--
WBR
Maxim aka solomax
|
|
From: Bryan B. <bb...@lu...> - 2012-07-30 14:21:50
|
While deserializing objects I noticed this output in LogCat: 07-30 09:38:45.183: I/dalvikvm(22970): Could not find method javax.xml.stream.XMLInputFactory.newInstance, referenced from method org.simpleframework.xml.stream.StreamProvider.<init> 07-30 09:38:45.183: W/dalvikvm(22970): VFY: unable to resolve static method 7583: Ljavax/xml/stream/XMLInputFactory;.newInstance ()Ljavax/xml/stream/XMLInputFactory; 07-30 09:38:45.183: D/dalvikvm(22970): VFY: replacing opcode 0x71 at 0x0003 07-30 09:38:45.183: W/dalvikvm(22970): VFY: unable to find class referenced in signature (Ljavax/xml/stream/XMLEventReader;) ...and soon after: 07-30 09:39:01.243: W/System.err(22970): org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.Element(data=false, name=, required=true, type=void) on field ....... for class ....... at line 1 I just introduced this library recently and am guessing I need one of the jar files from the lib folder distributed with Simple. Which one? Thanks a lot, Bryan |
|
From: Bryan B. <bb...@lu...> - 2012-07-30 14:21:27
|
Oops - sorry, forgot to mention that I have set the strict argument to false while deserializing. From: Bryan Barnes Sent: Monday, July 30, 2012 10:06 AM To: 'sim...@li...' Subject: javax dependency problem for Android While deserializing objects I noticed this output in LogCat: 07-30 09:38:45.183: I/dalvikvm(22970): Could not find method javax.xml.stream.XMLInputFactory.newInstance, referenced from method org.simpleframework.xml.stream.StreamProvider.<init> 07-30 09:38:45.183: W/dalvikvm(22970): VFY: unable to resolve static method 7583: Ljavax/xml/stream/XMLInputFactory;.newInstance ()Ljavax/xml/stream/XMLInputFactory; 07-30 09:38:45.183: D/dalvikvm(22970): VFY: replacing opcode 0x71 at 0x0003 07-30 09:38:45.183: W/dalvikvm(22970): VFY: unable to find class referenced in signature (Ljavax/xml/stream/XMLEventReader;) ...and soon after: 07-30 09:39:01.243: W/System.err(22970): org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.Element(data=false, name=, required=true, type=void) on field ....... for class ....... at line 1 I just introduced this library recently and am guessing I need one of the jar files from the lib folder distributed with Simple. Which one? Thanks a lot, Bryan |
|
From: Niall G. <gal...@ya...> - 2012-07-30 09:54:41
|
Hi, I have just released Simple 2.6.6. This release has huge performance improvements for use on Android. For objects I use on Android, which make heavy use of the union annotations, I have seen a x10 increase in performance. I would advise anyone using this library on Android to upgrade. Also, in the trunk there is a Proguard obfuscation file which adds further performance improvements and size reduction for Android. Link below. https://simple.svn.sourceforge.net/svnroot/simple/trunk/download/stream/script/proguard.pro Thanks,Niall |