Re: [Simple-support] Need Help deserializing
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2012-01-23 08:31:12
|
It should be entry="Open" name should not exist as its inline. So change the openList annotation to use entry="Open" and not name="Open"
--- On Thu, 19/1/12, Sony Ericsson <101...@gm...> wrote:
From: Sony Ericsson <101...@gm...>
Subject: [Simple-support] Need Help deserializing
To: sim...@li...
Received: Thursday, 19 January, 2012, 5:23 PM
Hello,
Source XML:
<List>
<ItemType>Fruits</ItemType>
<Order>Yes</Order>
<Open>
<id>111</id>
<name>Apple</name>
</Open>
<Open>
<id>222</id>
<name>Mango</name>
</Open>
</List>
My Code looks like below:
@Root(name = "List", strict = false)
public class List {
@ElementList(name = "Open", required = false, inline = true)
private List<Openl> openList;
@Element(name = "ItemType", required = false)
private String itemType;
@Element(name = "Order", required = false)
private String shouldWeOrder;
public String getOpenItemList() {
return openList;
}
public String getItemType() {
return itemType;
}
public String getOrder() {
return shouldWeOrder;
}
}
@Root(name="Open")
public class Open {
@Element(name = "id", required = false)
private String id;
@Element(name = "name", required = false)
private String name;
public String getId() {
return id;
}
public String getName() {
return name;
}
}
I am only able to deserialize ItemType and Order. My List - openList is always null, that may be because I am not constructing one. So, how to do that ? How to deserialize such XML ?
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
-----Inline Attachment Follows-----
_______________________________________________
Simple-support mailing list
Sim...@li...
https://lists.sourceforge.net/lists/listinfo/simple-support
|