//创建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>
复制代码
|
|