I'm having problems while parsing a XML file. The XML schema used is:
<xsd:complexType name="QuoteFIBondPrice">
<xsd:complexContent>
<xsd:sequence>
<xsd:element name="BidPrice" type="QuoteFIBondValue" minOccurs="0"/>
<xsd:element name="MidPrice" type="QuoteFIBondValue" minOccurs="0"/>
<xsd:element name="OfferPrice" type="QuoteFIBondValue" minOccurs="0"/>
<xsd:element name="MaturityDate" type="DbGMLType:SystemName" minOccurs="0"/>
<xsd:element name="Coupon" type="DbGMLType:SystemName" minOccurs="0"/>
<xsd:element name="DisplayName" type="DbGMLType:SystemName" minOccurs="0"/>
</xsd:sequence>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="QuoteFIBondValue">
<xsd:all>
<xsd:element name="QuoteValue" type="DbGMLType:QuoteValue" minOccurs="0"/>
</xsd:all>
</xsd:complexType>
The error message I'm getting is this:
class com.db.dbadapter.util.xml.XMLValidatorParserException: SAXParseException(s) encountered: [s4s-elt-invalid-content.1: The content of 'QuoteFIBondPrice' is invalid. Element 'sequence' is invalid, misplaced, or occurs too often. (line: 53, column: 18) ]
Could you please give me a hand?
I've changed the XML schema and now it is this way:
<xsd:complexType name="QuoteFIBondPrice">
<xsd:sequence>
<xsd:element name="BidPrice" type="QuoteFIBondValue" minOccurs="0"/>
<xsd:element name="MidPrice" type="QuoteFIBondValue" minOccurs="0"/>
<xsd:element name="OfferPrice" type="QuoteFIBondValue" minOccurs="0"/>
<xsd:element name="MaturityDate" type="DbGMLType:SystemName" minOccurs="0"/>
<xsd:element name="Coupon" type="DbGMLType:SystemName" minOccurs="0"/>
<xsd:element name="DisplayName" type="DbGMLType:SystemName" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="QuoteFIBondValue">
<xsd:all>
<xsd:element name="QuoteValue" type="DbGMLType:QuoteValue" minOccurs="0"/>
</xsd:all>
</xsd:complexType>
After testing, I realised that the previous error has changed to:
**[cvc-complex-type.2.4.a: Invalid content was found starting with element 'BidPrice'. One of '{MaturityDate, Coupon, DisplayName}' is expected. (line: 35, column: 17) ]
[cvc-complex-type.2.3: Element 'BidPrice' cannot have character [children], because the type's content type is element-only. (line: 35, column: 35) ]
[cvc-complex-type.2.3: Element 'MidPrice' cannot have character [children], because the type's content type is element-only. (line: 36, column: 38) ]class com.db.dbadapter.util.xml.XMLValidatorParserException: SAXParseException(s) encountered:
[cvc-complex-type.2.3: Element 'OfferPrice' cannot have character [children], because the type's content type is element-only. (line: 34, column: 39) ]
[cvc-complex-type.2.4.a: Invalid content was found starting with element 'BidPrice'. One of '{MaturityDate, Coupon, DisplayName}' is expected. (line: 35, column: 17) ]
[cvc-complex-type.2.3: Element 'BidPrice' cannot have character [children], because the type's content type is element-only. (line: 35, column: 35) ]
[cvc-complex-type.2.3: Element 'MidPrice' cannot have character [children], because the type's content type is element-only. (line: 36, column: 38) ]**
@Jon, @skaffman, do you have any suggestion?
Many thanks