我不明白。这个 XSD 到底是什么意思?:
<element name="X509Data" type="ds:X509DataType"/>
<complexType name="X509DataType">
<sequence maxOccurs="unbounded">
<choice>
<element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/>
<element name="X509SKI" type="base64Binary"/>
<element name="X509SubjectName" type="string"/>
<element name="X509Certificate" type="base64Binary"/>
<element name="X509CRL" type="base64Binary"/>
<any namespace="##other" processContents="lax"/>
</choice>
</sequence>
</complexType>
我是这样理解的:
元素下面的所有元素
<sequence>
都可以根据需要经常出现,但至少出现一次(因为minOccurs
未设置属性minOccurs
,默认值为 1)。但是元素下面的一个
<choice>
元素只能出现一次(因为没有设置minOccurs
或maxOccurs
设置)。
但是,既然<choice>
元素在元素之下<sequence>
,那么其他列出的元素还能出现吗?那你为什么不定义<sequence>
元素下的所有东西而不是定义另一个<choice>
元素呢?
这是我的 XML 文档的一部分:
<X509Data>
<X509IssuerSerial>
<X509IssuerName>E=forename.surname@provider.com, CN=Forename Surname, OU=Management, O=Company, L=City, ST=State, C=CO</X509IssuerName>
<X509SerialNumber>13894744055819454397</X509SerialNumber>
</X509IssuerSerial>
<X509Certificate>MIIEEjCCAvqgAwIBAgIJAMDUDBnsFse9MA0GCSqGSIb3DQEBCwUAMIGdMQswCQYD
VQQGEwJERTEQMA4GA1UECAwHU2FjaHNlbjEQMA4GA1UEBwwHTGVpcHppZzERMA8G
A1UECgwIQ29tcHVkb2MxEzARBgNVBAsMCk1hbmFnZW1lbnQxFTATBgNVBAMMDFN0
ZXZlIE1hcnRpbjErMCkGCSqGSIb3DQEJARYcc3RldmUubWFydGluMTk5MEBvdXRs
b29rLmNvbTAeFw0yMDAxMDcxNTQzMThaFw0yMTAxMDYxNTQzMThaMIGdMQswCQYD
VQQGEwJERTEQMA4GA1UECAwHU2FjaHNlbjEQMA4GA1UEBwwHTGVpcHppZzERMA8G
A1UECgwIQ29tcHVkb2MxEzARBgNVBAsMCk1hbmFnZW1lbnQxFTATBgNVBAMMDFN0
ZXZlIE1hc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