微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将 XMLElementRefs 转换为具体的 JAVA 类 (JAXB)

如何解决将 XMLElementRefs 转换为具体的 JAVA 类 (JAXB)

我有一个非常复杂的 XML 模式,其中的一个片段如下所示:

<xs:complexType name="searchLoopType">
    <xs:sequence>
        <xs:element name="loopVarName" type="xs:string"/>
        <xs:choice>
            <xs:sequence>
                <xs:element name="forever" />
                <xs:element name="whileCondition" type="dps:condition" />
            </xs:sequence>
            <xs:sequence>
                <xs:element name="startValue" type="dps:valueType" />
                <xs:element name="endValue" type="dps:valueType" />
                <xs:element name="whileCondition" type="dps:condition" minOccurs="0" />
            </xs:sequence>
            .
            .
            .
            .

它正在创建 JAXB 类:

@XmlAccessorType(XmlAccesstype.FIELD)
@XmlType(name = "searchLoopType",propOrder = {
    "loopVarName","foreverAndWhileConditionorStartValue","loopVariables","outputLoopOrOutputGroupOrOutput"
})
public class SearchLoopType {

    @XmlElement(required = true)
    protected String loopVarName;
    @XmlElementRefs({
        @XmlElementRef(name = "startValue",namespace = "http://www.gtt.com/logicalprovisioning/dps/xml/discoveryProcessingTable",type = JAXBElement.class,required = false),@XmlElementRef(name = "whileCondition",@XmlElementRef(name = "loopList",@XmlElementRef(name = "forever",@XmlElementRef(name = "endValue",required = false)
    })
    protected List<JAXBElement<?>> foreverAndWhileConditionorStartValue;
.
.
.
.

我尝试进行一些自定义。但不知何故,我无法在标签下制作具体的元素类。你能指导我怎么做吗?我的 globalBindings 设置为:

<jxb:globalBindings generateIsSetMethod="true" enableJavaNamingConventions="true" typesafeEnumMemberName="generateName" typesafeEnumBase="xsd:string" fixedAttributeAsConstantProperty="true" generateElementClass="true" choicecontentproperty="true" />

如果您需要更多信息,请告诉我。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。