Inesessary是否需要每次都描述所有标签? 我怎样才能从
中选择文本“340.00гр” <param name="Вес">340.00 гр</param>
尝试描述下一个嵌套的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'不在第23行的com.example.pavel.lesson8.models.Offer类中有匹配
答案 0 :(得分:0)
在java中解析是超级的,但在python中进行相同的解析非常好,我的个人建议是使用python进行html和其他文件解析。因为,有很多图书馆可以轻松,即时地完成您的工作