[Simple-support] Does not understand this ElementException
Brought to you by:
niallg
|
From: Thomas <tho...@gm...> - 2012-09-19 13:05:17
|
Hello,
I have a little problem with Simple. First, here is a part of my XSD file:
<xs:complexType name="SignedDataObjectType">
<xs:sequence>
<xs:element name="Encapsulated" type="xs:boolean"/>
<xs:element name="MimeType" type="xs:string"/>
<xs:element name="Name" type="xs:string" minOccurs="0"/>
<xs:element name="Description" type="xs:string" minOccurs="0"/>
<xs:element name="Size" type="xs:long" minOccurs="0"/>
<xs:element name="DigestAlgAndValue" type="xad:DigestAlgAndValueType" minOccurs="0"/>
<xs:element name="Revisions" type="vt:RevisionsType" minOccurs="0"/>
<xs:element name="Errors" type="vt:ErrorsType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="Id" type="xs:ID" use="required"/>
</xs:complexType>
Then, here is my targetted Java class:
public class SignedDataObjectType {
@Attribute(name = "Id")
protected String id;
@Element(name = "Encapsulated")
protected boolean encapsulated;
@Element(name = "MimeType")
public String mimeType;
@Element(name = "Name", required = false)
protected String name;
@Element(name = "Description", required = false)
protected String description;
@Element(name = "Size", required = false)
protected Long size;
@Element(name = "DigestAlgAndValue", required = false)
protected DigestAlgAndValueType digestAlgAndValue;
@Element(name = "Revisions", required = false)
protected RevisionsType revisions;
@Element(name = "Errors", required = false)
protected ErrorsType errors;
... setters and getters here...
And to finish, a the part of my XML file:
... other datas here...
<vt:SignedDataObject Id="signeddata-1">
<vt:Encapsulated>true</vt:Encapsulated>
<vt:MimeType>application/pdf</vt:MimeType>
<vt:Name>signeddata-1.pdf</vt:Name>
<vt:Size>131323</vt:Size>
<vt:DigestAlgAndValue>
<ds:DigestMethod Algorithm="1.3.14.3.2.26"></ds:DigestMethod>
<ds:DigestValue>KuWqL3YVcSMZeHRov5nE90PZSeY=</ds:DigestValue>
</vt:DigestAlgAndValue>
</vt:SignedDataObject>
... other datas here...
And I have this exception:
org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.Attribute(empty=, name=Id, required=true) on field 'id' protected java.lang.String com.lexpersona.lp7verifybox.entities.SignedDataObjectType.id for class com.lexpersona.lp7verifybox.entities.SignedDataObjectType at line 43
at org.simpleframework.xml.core.Composite.validate(Composite.java:644)
at org.simpleframework.xml.core.Composite.readAttributes(Composite.java:416)
...blah blah blah...
As you can see, the datas exists. So, I tried to use the required false (which is very bad because my class attributes are mandatory) in the annotation but I have another exception with the DigestAlgAndValue tag:
org.simpleframework.xml.core.ElementException: Element 'DigestMethod' does not have a match in class com.lexpersona.lp7verifybox.entities.SignedDataObjectType at line 48
at org.simpleframework.xml.core.Composite.readElement(Composite.java:527)
... blah blah blah...
I do not understand why Simple is against me at this level :s
And you can note the I already use the DigestAlgAndValue element before and that works... I realy do not understand why Exception are thrown in this level :(
Have you any ideas? Do I need to send you more informations?
Thomas
|