[英]Java - Getting a ElementList attribute with SimpleXML (Android/Retrofit)
[英]Android Magento Soap PersistenceException in ElementList
我得到錯誤
Android Magento Soap Api org.simpleframework.xml.core.PersistenceException:元素“結果”已與@ org.simpleframework.xml.ElementList一起使用
當我請求使用Soap從Magento獲取catalogProductMedia時。 以下是XML文件和類。
<message name="catalogProductAttributeMediaListResponse">
<part name="result" type="typens:catalogProductImageEntityArray"/>
</message>
@Root(name = CatalogProductAttributeMediaListResponse.ROOT_NAME, strict = false)
public class CatalogProductAttributeMediaListResponse {
public static final String ROOT_NAME = "n0:catalogProductAttributeMediaListResponse";
@Element(required = false)
@Path("Body/catalogProductAttributeMediaListResponse")
private CatalogProductImageEntityArray result;
}
<complexType name="catalogProductImageEntityArray">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="typens:catalogProductImageEntity[]"/>
</restriction>
</complexContent>
</complexType>
@Root(name = "catalogProductImageEntityArray", strict = false)
public class CatalogProductImageEntityArray {
@ElementList(inline = true, entry = "item", required = false)
private List<CatalogProductImageEntity> productImageEntityList;
}
<complexType name="catalogProductImageEntity">
<all>
<element name="file" type="xsd:string"/>
<element name="label" type="xsd:string"/>
<element name="position" type="xsd:string"/>
<element name="exclude" type="xsd:string"/>
<element name="url" type="xsd:string"/>
<element name="types" type="typens:ArrayOfString"/>
</all>
</complexType>
@Root(name = "catalogProductEntity", strict = false)
public class CatalogProductImageEntity {
@Element(required = false)
private String url;
}
我只想獲取url,我已經生成了所有的getter和setter方法。 請幫幫我
嘗試像這樣注釋結果
@Element(required = false, inline=true)
@Path("Body/catalogProductAttributeMediaListResponse")
private CatalogProductImageEntityArray result;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.