Trying to parse xml list without parent node using simple frame work

calvinklein

New Member
I am using Simple Framework to parse an xml file. I can parse everything I need except for lists that do not have parent nodes. The code snippet below 'category.xml' shows the xml format and the parentless list of categories. I have also included the code for \[code\]Category\[/code\] class and my Root class \[code\]ArrayOfTypeCategory\[/code\]. I have a funny feeling the solution is easy but I cant but my finger on it. Has it got something to do woth \[code\](inline=true)\[/code\]? Any help will be much appreciated.---category.xml---\[code\]<?xml version="1.0" encoding="utf-8"?><ArrayOfCategory xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ACCUMobileWS.org/"> <Category> <CategoryId>99</CategoryId> <Name>Frank</Name> <Description>Prison Break</Description> </Category> <Category> <CategoryId>101</CategoryId> <Name>Jim</Name> <Description>Breakig Bad</Description> </Category></ArrayOfCategory>\[/code\]---Category Class---\[code\]package com.SimpleFramwork;import org.simpleframework.xml.Element;import org.simpleframework.xml.Text;@Elementpublic class Category {@Textpublic String CategoryId;@Textpublic String Name;@Textpublic String Description;}\[/code\]---ArrayOfTypeCategory Class----\[code\]package com.SimpleFramwork;//importsimport java.util.List;import org.simpleframework.xml.ElementList;import org.simpleframework.xml.Root;@Rootpublic class ArrayOfCategory {@ElementList(inline = true)private List<Category> list;public List getCategories() { return list;}}\[/code\]I get this error in the log cat when I run the project ' \[code\]org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.ElementList(data=http://stackoverflow.com/questions/11081941/false, empty=true, entry=, inline=true, name=, required=true, type=void) on field'list' private java.util.List com.SimpleFramwork.ArrayOfCategory.list for class com.SimpleFramwork.ArrayOfCategory at line 2'\[/code\]
 
Back
Top