lagyossarian
Programmer
I'm new to XML and XSD. I have an existing schema with an element, ASSET, to which I want to add a sub-element, ACCOUNT. The existing code is below:
<xs:element name="ASSET">
<xs:complexType>
<xs:sequence>
<xs:complexContent>
<xs:restriction base="xs:anyType">
<xs:attribute name="BorrowerID" type="xs:IDREFS"/>
<xs:attribute name="_AccountIdentifier" type="xs:string"/>
<xs:attribute name="_CashOrMarketValueAmount" type="xs:string"/>
<xs:attribute name="_Type">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="Automobile"/>
<xs:enumeration value="CashOnHand"/>
<xs:enumeration value="RelocationMoney"/>
<xs:enumeration value="PendingNetSaleProceedsFromRealEstateAssets"/>
<xs:enumeration value="MoneyMarketFund"/>
<xs:enumeration value="TrustAccount"/>
<xs:enumeration value="BridgeLoanNotDeposited"/>
<xs:enumeration value="SaleOtherAssets"/>
<xs:enumeration value="OtherNonLiquidAssets"/>
<xs:enumeration value="Stock"/>
<xs:enumeration value="GiftsNotDeposited"/>
<xs:enumeration value="SecuredBorrowedFundsNotDeposited"/>
<xs:enumeration value="SavingsAccount"/>
<xs:enumeration value="GiftsTotal"/>
<xs:enumeration value="LifeInsurance"/>
<xs:enumeration value="NetWorthOfBusinessOwned"/>
<xs:enumeration value="EarnestMoneyCashDepositTowardPurchase"/>
<xs:enumeration value="Bond"/>
<xs:enumeration value="CheckingAccount"/>
<xs:enumeration value="CertificateOfDepositTimeDeposit"/>
<xs:enumeration value="OtherLiquidAssets"/>
<xs:enumeration value="RetirementFund"/>
<xs:enumeration value="MutualFund"/>
<xs:enumeration value ="Bank"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="_VerifiedIndicator">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="Y"/>
<xs:enumeration value="N"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="_HolderName" type="xs:string"/>
<xs:attribute name="_HolderStreetAddress" type="xs:string"/>
<xs:attribute name="_HolderCity" type="xs:string"/>
<xs:attribute name="_HolderState" type="xs:string"/>
<xs:attribute name="_HolderPostalCode" type="xs:string"/>
<xs:attribute name="AutomobileMakeDescription" type="xs:string"/>
<xs:attribute name="AutomobileModelYear" type="xs:string"/>
<xs:attribute name="LifeInsuranceFaceValueAmount" type="xs:string"/>
<xs:attribute name="OtherAssetTypeDescription" type="xs:string"/>
<xs:attribute name="StockBondMutualFundShareCount" type="xs:string"/>
</xs:restriction>
</xs:complexContent>
<xs:element name="Account" minOccurs="0" maxOccurs="3">
<xs:complexType>
<xs:restriction base="anyType">
<xs:attribute name="_Balance" type="xs:decimal"/>
<xs:attribute name="_AcctNumber" type="xs:string"/>
</xs:restriction>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
I'm getting an error when I validate the schema:
file:///c:/Documents and Settings/gbusby/My Documents/MORTGAGE_APPLICATION_v2_3.xsd:204,24: Error: complexContent content must be one of element, group, modelGroupRef. Saw {null}
file:///c:/Documents and Settings/gbusby/My Documents/MORTGAGE_APPLICATION_v2_3.xsd:261,38: Invalid child 'restriction' in the complex type
The XML document MORTGAGE_APPLICATION_v2_3.xsd is NOT valid (2 errors)
What am I doing wrong here? Any help/guidance rendered is much appreciated.
Greg
<xs:element name="ASSET">
<xs:complexType>
<xs:sequence>
<xs:complexContent>
<xs:restriction base="xs:anyType">
<xs:attribute name="BorrowerID" type="xs:IDREFS"/>
<xs:attribute name="_AccountIdentifier" type="xs:string"/>
<xs:attribute name="_CashOrMarketValueAmount" type="xs:string"/>
<xs:attribute name="_Type">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="Automobile"/>
<xs:enumeration value="CashOnHand"/>
<xs:enumeration value="RelocationMoney"/>
<xs:enumeration value="PendingNetSaleProceedsFromRealEstateAssets"/>
<xs:enumeration value="MoneyMarketFund"/>
<xs:enumeration value="TrustAccount"/>
<xs:enumeration value="BridgeLoanNotDeposited"/>
<xs:enumeration value="SaleOtherAssets"/>
<xs:enumeration value="OtherNonLiquidAssets"/>
<xs:enumeration value="Stock"/>
<xs:enumeration value="GiftsNotDeposited"/>
<xs:enumeration value="SecuredBorrowedFundsNotDeposited"/>
<xs:enumeration value="SavingsAccount"/>
<xs:enumeration value="GiftsTotal"/>
<xs:enumeration value="LifeInsurance"/>
<xs:enumeration value="NetWorthOfBusinessOwned"/>
<xs:enumeration value="EarnestMoneyCashDepositTowardPurchase"/>
<xs:enumeration value="Bond"/>
<xs:enumeration value="CheckingAccount"/>
<xs:enumeration value="CertificateOfDepositTimeDeposit"/>
<xs:enumeration value="OtherLiquidAssets"/>
<xs:enumeration value="RetirementFund"/>
<xs:enumeration value="MutualFund"/>
<xs:enumeration value ="Bank"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="_VerifiedIndicator">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="Y"/>
<xs:enumeration value="N"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="_HolderName" type="xs:string"/>
<xs:attribute name="_HolderStreetAddress" type="xs:string"/>
<xs:attribute name="_HolderCity" type="xs:string"/>
<xs:attribute name="_HolderState" type="xs:string"/>
<xs:attribute name="_HolderPostalCode" type="xs:string"/>
<xs:attribute name="AutomobileMakeDescription" type="xs:string"/>
<xs:attribute name="AutomobileModelYear" type="xs:string"/>
<xs:attribute name="LifeInsuranceFaceValueAmount" type="xs:string"/>
<xs:attribute name="OtherAssetTypeDescription" type="xs:string"/>
<xs:attribute name="StockBondMutualFundShareCount" type="xs:string"/>
</xs:restriction>
</xs:complexContent>
<xs:element name="Account" minOccurs="0" maxOccurs="3">
<xs:complexType>
<xs:restriction base="anyType">
<xs:attribute name="_Balance" type="xs:decimal"/>
<xs:attribute name="_AcctNumber" type="xs:string"/>
</xs:restriction>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
I'm getting an error when I validate the schema:
file:///c:/Documents and Settings/gbusby/My Documents/MORTGAGE_APPLICATION_v2_3.xsd:204,24: Error: complexContent content must be one of element, group, modelGroupRef. Saw {null}
file:///c:/Documents and Settings/gbusby/My Documents/MORTGAGE_APPLICATION_v2_3.xsd:261,38: Invalid child 'restriction' in the complex type
The XML document MORTGAGE_APPLICATION_v2_3.xsd is NOT valid (2 errors)
What am I doing wrong here? Any help/guidance rendered is much appreciated.
Greg