我有以下xsd:
中列出的paymentcard标签示例<xs:element name="paymentCard" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element type="cardsTypeRestriction" name="cardType" maxOccurs="1" />
<xs:element type="xs:string" name="cardHolderName" minOccurs="0" maxOccurs="1"/>
<xs:element type="xs:string" name="validFrom" minOccurs="0" maxOccurs="1"/>
<xs:element type="xs:string" name="expirationDate" minOccurs="0" maxOccurs="1"/>
<xs:element name="cardNumbers" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="cardNumber" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="cardCurrencies" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="cardsCurrencyRestriction" name="cardCurrency" maxOccurs="unbounded" default="GBP"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="cardAmounts" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:float" name="cardAmount" maxOccurs="unbounded" default="20.00"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element type="xs:string" name="cardCvv" maxOccurs="1" default="123"/>
<xs:element type="xs:string" name="cardIssueNumber" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
但是当我从这样的xsd创建xml时,它没有提供任何默认的预填充值,所以我得到了这个xml:
<paymentCard>
<cardType></cardType>
<cardNumbers>
<cardNumber></cardNumber>
</cardNumbers>
<cardCurrencies>
<cardCurrency></cardCurrency>
</cardCurrencies>
<cardAmounts>
<cardAmount></cardAmount>
</cardAmounts>
<cardCvv></cardCvv>
</paymentCard>
创建新的xml时我想要的是
<paymentCard>
<cardType></cardType>
<cardNumbers>
<cardNumber></cardNumber>
</cardNumbers>
<cardCurrencies>
<cardCurrency>GBP</cardCurrency>
</cardCurrencies>
<cardAmounts>
<cardAmount>20.00</cardAmount>
</cardAmounts>
<cardCvv>123</cardCvv>
</paymentCard>
仅填充cardType和cardNumber。 那可能吗?如果是,我的xsd有什么问题?