java - Deserialiazing list of elements with @Text annotation in Simple -
I have two squares, packages and ModelRefObj . The package has two sets of ModelRefObj I am using simple framework to parse my instances of XML, so I have made some JunkyT Test I ModelRefObj XML I am able to parse, but when trying to pars a package, the following exception is being made :
org. Simpleframework.xml.core.ValueRequiredException: empty value for empty (empty =, data = false, = essential truth) for @ org.simpleframework.xml.Text 'value' on field 'personal' java.lang.String cz.semanta.coc.domain . Org.simpleframework.xml.core.Composite at cognos.ModelRefObj.value in on line 1 at cz.semanta.coc.domain.cognos.ModelRefObj org.simpleframework.xml.core.Composite.readInstance (Composite.java )80) .readText (Composite.javaache67) org.simpleframework.xml.core.Composite.access at $ 200 org.simpleframework.xml.core.Composite at $ Builder.read (Composite.java59) (Composite.java:1381 ) ...
Here's the XML that I'm trying to parse:
& lt; Package & gt; & Lt; Name & gt; Geo Sales (Nullis) & lt; / Name & gt; & Lt; Show & gt; & Lt; RefObj & gt; [Go_sales] & lt; / RefObj & gt; & Lt; RefObj & gt; [Filters and calculations]. [Return] & lt; / RefObj & gt; & Lt; / Visible & gt; & Lt; Hide & gt; & Lt; RefObj & gt; [Gosales] [Branch] [BRANCH_CODE] & lt; / RefObj & gt; & Lt; RefObj & gt; [Gosales] [branch] [address 1] & lt; / RefObj & gt; & Lt; RefObj & gt; [Gosales] [Branch] [city]
These are my annotated classes:
@Root (name = "package") public class package {@Element Private String name; @ElementList (name = "visible", entry = "riff obz", type = modelerf obje.class) private set & lt; ModelRefObj & gt; VisibleRefObjs; @ElementTelist (name = "hidden", entry = "riff objects", type = modelerf obje.class) private set & lt; ModelRefObj & gt; HiddenRefObjs; Package () {} ...} @Root (name = "refObj") public class ModelRefObj {@Text Private string value; ModelRefObj () {} Public ModelRefObj (string value) {this.value = value; } ...
I have implemented classes and use example xml Have given you
I created a main task to test
GO sales (nalysis)
Object P inspection in debug mode shows this output There are two groups with two elements and three elements, your code works well for me.
Comments
Post a Comment