[英]Parse the following XML using Retrofit SimpleXml-Converter Simple XML
Do Inesessary need to describe all tags every time? Inesessary是否需要每次都描述所有标签? How can I take only text "340.00 гр" from
我该如何仅从中获取文本“ 340.00гр”
<param name="Вес">340.00 гр</param>
Try to describe next nested xml: http://ufa.farfor.ru/getyml/?key=ukAXxeJYZN 尝试描述下一个嵌套的xml: http : //ufa.farfor.ru/getyml/?key = ukAXxeJYZN
@Root(name = "yml_catalog", strict = false)
public class OffersResponse {
@Path("shop/offers")
@ElementList(entry = "offer",inline = true)
private static ArrayList<Offer> offerList;
public ArrayList<Offer> getOfferList() {
return offerList;
}
}
@Root(name = "offer")
public class Offer {
@Element(required = false, name = "url")
private String url;
@Element(required = false, name = "name")
private String name;
@Element(required = false, name = "price")
private String price;
@Element(required = false, name = "description")
private String description;
@Element(required = false, name = "picture")
private String picture;
@Element(required = false, name = "categoryId")
private String categoryId;
@Element(required = false, name = "param")
private String param;
}
09-02 14:31:21.064 28998-28998/com.example.pavel.lesson8 D/TAG: onFailure: java.lang.RuntimeException: org.simpleframework.xml.core.AttributeException: Attribute 'id' does not have a match in class com.example.pavel.lesson8.models.Offer at line 23 09-02 14:31:21.064 28998-28998 / com.example.pavel.lesson8 D / TAG:onFailure:java.lang.RuntimeException:org.simpleframework.xml.core.AttributeException:属性'id'不匹配在类com.example.pavel.lesson8.models.Offer中的第23行
parsing in java is super, but the same parsing in python is excellent,my personal advice is to use python for html and other files parsing . 用Java进行解析是超级好,但是用python进行相同的解析非常好,我个人的建议是使用python进行html和其他文件的解析。 Because , there are so many libraries were there to do your work easily and instantly
因为,那里有很多图书馆可以轻松,立即地完成您的工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.