javax.xml.bind.annotation.Xml

本文深入探讨了Java中 javax.xml.bind.annotation.Xml 注解的使用,包括其在XML序列化和反序列化过程中的作用,以及各种属性如element, attribute, namespace等的配置方法。通过实例解析,帮助读者理解如何有效地管理和转换Java对象与XML文档。" 103887851,8395152,UML活动图详解:元素与应用场景,"['UML', '系统建模', '流程图', '动态行为', '控制流']
部署运行你感兴趣的模型镜像
public static <T> T xmlToBean(String xml, Class<T> clazz) throws JAXBException
	{
		JAXBContext context = JAXBContext.newInstance(clazz);
		Unmarshaller um = context.createUnmarshaller();
		StringReader sr = new StringReader(xml);
		return (T)(um.unmarshal(sr));
	}

	public static String objectToXML(Object object) throws JAXBException
	{
	    String xml = "";
	    JAXBContext context = JAXBContext.newInstance(object.getClass());
	    Marshaller m =context.createMarshaller();
	    m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
	    Writer w = new StringWriter();
	    m.marshal(object, w);
	    xml = w.toString();
	    return xml;
	}
package com.syswinsoft.roc.bussiness.finance.bill.center.feign.web.dto.taxcontrol;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name="business")
public class InvoiceOpener
{
	@XmlAttribute(name="id")
	private String id = "10008";

	@XmlAttribute(name="comment")
	private String comment = "发票开具";

	@XmlElement(name="body")
	private InvoiceOpenerBody body;

	public String getId()
	{
		return id;
	}

	public void setId(String id)
	{
		this.id = id;
	}

	public String getComment()
	{
		return comment;
	}

	public void setComment(String comment)
	{
		this.comment = comment;
	}

	public InvoiceOpenerBody getBody()
	{
		return body;
	}

	public void setBody(InvoiceOpenerBody body)
	{
		this.body = body;
	}
	
}
package com.syswinsoft.roc.bussiness.finance.bill.center.feign.web.dto.taxcontrol;

import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;

@XmlAccessorType(XmlAccessType.FIELD)
public class InvoiceOpenerBody
{
	@XmlAttribute(name="yylxdm")
	private String yylxdm = "1";

	@XmlElement(name="kpzdbs")
	private String kpzdbs;

	@XmlElement(name="fplxdm")
	private String fplxdm;

	@XmlElement(name="kplx")
	private String kplx;

	@XmlElement(name="fpqqlsh")
	private String fpqqlsh;

	@XmlElement(name="tspz")
	private String tspz;

	@XmlElement(name="xhdwsbh")
	private String xhdwsbh;

	@XmlElement(name="xhdwmc")
	private String xhdwmc;

	@XmlElement(name="xhdwdzdh")
	private String xhdwdzdh;

	@XmlElement(name="xhdwyhzh")
	private String xhdwyhzh;

	@XmlElement(name="ghdwsbh")
	private String ghdwsbh;

	@XmlElement(name="ghdwmc")
	private String ghdwmc;

	@XmlElement(name="ghdwdzdh")
	private String ghdwdzdh;

	@XmlElement(name="ghdwyhzh")
	private String ghdwyhzh;

	@XmlElement(name="qdbz")
	private String qdbz;

	@XmlElement(name="zsfs")
	private String zsfs;

	@XmlElementWrapper(name="fyxm")
	@XmlElement(name="group")
	private List<InvoiceOpenerGroup> invoiceOpenerGroupList;

	@XmlElement(name="hjje")
	private String hjje;

	@XmlElement(name="hjse")
	private String hjse;

	@XmlElement(name="jshj")
	private String jshj;

	@XmlElement(name="kce")
	private String kce;

	@XmlElement(name="bz")
	private String bz;

	@XmlElement(name="skr")
	private String skr;

	@XmlElement(name="fhr")
	private String fhr;

	@XmlElement(name="kpr")
	private String kpr;

	@XmlElement(name="tzdbh")
	private String tzdbh;

	@XmlElement(name="yfpdm")
	private String yfpdm;

	@XmlElement(name="yfphm")
	private String yfphm;

	public String getYylxdm()
	{
		return yylxdm;
	}

	public void setYylxdm(String yylxdm)
	{
		this.yylxdm = yylxdm;
	}

	public String getKpzdbs()
	{
		return kpzdbs;
	}

	public void setKpzdbs(String kpzdbs)
	{
		this.kpzdbs = kpzdbs;
	}

	public String getFplxdm()
	{
		return fplxdm;
	}

	public void setFplxdm(String fplxdm)
	{
		this.fplxdm = fplxdm;
	}

	public String getKplx()
	{
		return kplx;
	}

	public void setKplx(String kplx)
	{
		this.kplx = kplx;
	}

	public String getFpqqlsh()
	{
		return fpqqlsh;
	}

	public void setFpqqlsh(String fpqqlsh)
	{
		this.fpqqlsh = fpqqlsh;
	}

	public String getTspz()
	{
		return tspz;
	}

	public void setTspz(String tspz)
	{
		this.tspz = tspz;
	}

	public String getXhdwsbh()
	{
		return xhdwsbh;
	}

	public void setXhdwsbh(String xhdwsbh)
	{
		this.xhdwsbh = xhdwsbh;
	}

	public String getXhdwmc()
	{
		return xhdwmc;
	}

	public void setXhdwmc(String xhdwmc)
	{
		this.xhdwmc = xhdwmc;
	}

	public String getXhdwdzdh()
	{
		return xhdwdzdh;
	}

	public void setXhdwdzdh(String xhdwdzdh)
	{
		this.xhdwdzdh = xhdwdzdh;
	}

	public String getXhdwyhzh()
	{
		return xhdwyhzh;
	}

	public void setXhdwyhzh(String xhdwyhzh)
	{
		this.xhdwyhzh = xhdwyhzh;
	}

	public String getGhdwsbh()
	{
		return ghdwsbh;
	}

	public void setGhdwsbh(String ghdwsbh)
	{
		this.ghdwsbh = ghdwsbh;
	}

	public String getGhdwmc()
	{
		return ghdwmc;
	}

	public void setGhdwmc(String ghdwmc)
	{
		this.ghdwmc = ghdwmc;
	}

	public String getGhdwdzdh()
	{
		return ghdwdzdh;
	}

	public void setGhdwdzdh(String ghdwdzdh)
	{
		this.ghdwdzdh = ghdwdzdh;
	}

	public String getGhdwyhzh()
	{
		return ghdwyhzh;
	}

	public void setGhdwyhzh(String ghdwyhzh)
	{
		this.ghdwyhzh = ghdwyhzh;
	}

	public String getQdbz()
	{
		return qdbz;
	}

	public void setQdbz(String qdbz)
	{
		this.qdbz = qdbz;
	}

	public String getZsfs()
	{
		return zsfs;
	}

	public void setZsfs(String zsfs)
	{
		this.zsfs = zsfs;
	}

	public List<InvoiceOpenerGroup> getInvoiceOpenerGroupList()
	{
		return invoiceOpenerGroupList;
	}

	public void setInvoiceOpenerGroupList(List<InvoiceOpenerGroup> invoiceOpenerGroupList)
	{
		this.invoiceOpenerGroupList = invoiceOpenerGroupList;
	}

	public String getHjje()
	{
		return hjje;
	}

	public void setHjje(String hjje)
	{
		this.hjje = hjje;
	}

	public String getHjse()
	{
		return hjse;
	}

	public void setHjse(String hjse)
	{
		this.hjse = hjse;
	}

	public String getJshj()
	{
		return jshj;
	}

	public void setJshj(String jshj)
	{
		this.jshj = jshj;
	}

	public String getKce()
	{
		return kce;
	}

	public void setKce(String kce)
	{
		this.kce = kce;
	}

	public String getBz()
	{
		return bz;
	}

	public void setBz(String bz)
	{
		this.bz = bz;
	}

	public String getSkr()
	{
		return skr;
	}

	public void setSkr(String skr)
	{
		this.skr = skr;
	}

	public String getFhr()
	{
		return fhr;
	}

	public void setFhr(String fhr)
	{
		this.fhr = fhr;
	}

	public String getKpr()
	{
		return kpr;
	}

	public void setKpr(String kpr)
	{
		this.kpr = kpr;
	}

	public String getTzdbh()
	{
		return tzdbh;
	}

	public void setTzdbh(String tzdbh)
	{
		this.tzdbh = tzdbh;
	}

	public String getYfpdm()
	{
		return yfpdm;
	}

	public void setYfpdm(String yfpdm)
	{
		this.yfpdm = yfpdm;
	}

	public String getYfphm()
	{
		return yfphm;
	}

	public void setYfphm(String yfphm)
	{
		this.yfphm = yfphm;
	}
	
}

 

您可能感兴趣的与本文相关的镜像

ACE-Step

ACE-Step

音乐合成
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值