首页 > 解决方案 > 如何正确地将对象列表添加到 XSD

问题描述

<xsd:element minOccurs="0" name="Consents">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element minOccurs="0" name="Marketing" type="ConsentType" />
            <xsd:element minOccurs="0" name="CheckExternalDB" type="ConsentType" />
            <xsd:element minOccurs="0" name="DocsByEMail" type="ConsentType" />
            <xsd:element minOccurs="0" name="DocsByPrintHouse" type="ConsentType" />
            <xsd:element minOccurs="0" name="DocsByEBOK" type="ConsentType" />
            <xsd:element minOccurs="0" name="DataToGroup" type="TimeConsentType" />
            <xsd:element minOccurs="0" name="MarketingGroup" type="TimeConsentType" />
            <xsd:element minOccurs="0" name="EMarketingInf" type="TimeConsentType" />
              <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                 <xsd:element minOccurs="0" maxOccurs="unbounded" name="CustomerConsents" type="CustomerConsentsBasic" />
              </xsd:sequence>
            </xsd:sequence>
        </xsd:complexType>
      </xsd:element>

我的课看起来像这样

public class CompanyType {  
    @XmlElement(name = "Consents")
    protected CompanyType.Consents consents;
}

  public static class Consents { 
        @XmlElement(name = "CustomerConsents")
        protected List<CustomerConsentsBasic> customerConsents;
 }

customerConsents 是一个列表,我想正确地表示它。以上是我的XSD,如果某处有问题,有人可以纠正它。

标签: javaxsd

解决方案


推荐阅读