JAXB XML转Bean,Bean转XML

xml转Bean JAXBContext context = JAXBContext.newInstance(Bean.class); Unmarshaller unmarshaller = context.createUnmarshaller(); Bean bean = (Bean) unmarshaller.unmarshal(new StringReader(xml)); Bean转Xml JAXBContext context = JAXBContext.newInstance(Bean.class); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true); StringWriter writer = new StringWriter(); marshaller.marshal(bean,writer);

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念