我必須開發android xml解析示例。getattribute值在android字符串
在這裏,我必須得到屬性值...
這是代碼的將ID:
private int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
在這裏,我得到的int arrtibute值:
for (int i = 0; i < nodeList.getLength(); i++) {
Element e = (Element) nodeList.item(i);
Employee employee = new Employee();
employee.setId(Integer.parseInt(e.getAttribute(ATTR_ID)));
確定它做得好..
現在我必須得到字符串的arrtibute值...
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
我怎樣才能得到它?
請給我的代碼,這些...
你在哪裏添加String對象? – Martin 2013-02-14 11:34:07