---
title: "java反射-实体类转xml jar包"
author: "vortexchoo"
date: "2015-10-23T14:31:19Z"
tags: []
categories: ["编程语言"]
slug: "java-xml-jar"
draft: false
lastmod: "2015-10-23T14:31:19Z"
id: 2251339
url: "https://vortexchoo.iteye.com/blog/2251339"
---

同上一篇一样，避免重复造车轮，写了这个jar包。

引入jar包，使用方法：引入jar，添加至 build path

 

 public static void main(String\[] args) {

A a = new A();

B b = new B();

b.setAddr("addr");

b.setId(1000L);

b.setName("name");

a.setB(b);

a.setId(new Short("1"));

 

VortexBean2xml c = new VortexBean2xml();

String res = c.bean2XML(a);

System.out.println(res);

}