Tag: xml binding

JiBX:如何在代码中继续使用接口?

如何在我想使用JiBX绑定的类中保留我的使用接口? 示例:我在java中有这个非常简单的模型: public interface A { B getB(); void setB(B b); } public interface B { String getData(); void setData(String data); } public class AImpl implements A { B b; @Override public B getB() { return b; } @Override public void setB(B b) { this.b = b; } } public class BImpl implements B { […]

JAXB @XmlAttribute @XmlValue真实的例子

我是JAXB的新手,在从XML转换为Java类实例时遇到了麻烦。 我有以下XML: client Greeting 1000 Your Connection with API Server is Successful 2009-02-16 06:22:21 我开发了以下Java代码: /** * Copyright 2013. ABN Software. All Rights reserved. * Author …… Andre * Created ….. 14.03.2013 * */ package net.regmaster.onlinenic.model; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlRootElement; import net.regmaster.onlinenic.enumtype.OnicEnumAction; import net.regmaster.onlinenic.enumtype.OnicEnumCategory; import net.regmaster.onlinenic.model.resdata.GreetingResData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** […]

将XML映射到Java中的对象

假设我有一个名为Test的类,就像这样 public class Test { private String testId; private String description; private String department; public Test() {} public Test(String id,String des,String dpt) { this.testId = id; this.department = dpt; this.description = des; } public String getTestId() { return testId; } public void setTestId(String testId) { this.testId = testId; } public String getDescription() { return description; […]