黑马程序员技术交流社区
标题:
pull解析xml文件的详细步骤
[打印本页]
作者:
从黑到白的马
时间:
2016-1-20 13:34
标题:
pull解析xml文件的详细步骤
//pull解析类
复制代码
//创建Person类
package com.heima.domain;
public class Book {
private int id;
private String name;
private int price;
public Book() {
super();
// TODO Auto-generated constructor stub
}
public Book(int id, String name, int price) {
super();
this.id = id;
this.name = name;
this.price = price;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
@Override
public String toString() {
return "Book [id=" + id + ", name=" + name + ", price=" + price + "]";
}
}
复制代码
//xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!-- 222111111 -->
<bookstore>
<book id="1">
<name>数学书</name>
<price>11</price>
</book>
<book id="2">
<name>英语书</name>
<price>22</price>
</book>
</bookstore>
复制代码
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2