2013-07-29 32 views
1

我已經編寫了一個.xsd模式(以下),與雅虎的YQL yahoo.finance.quote table 一起使用。但是當我使用XJC到架構中我碰到下面的錯誤綁定:JAXB綁定錯誤,「內容必須匹配...?」

[ERROR] s4s-elt-must-match.1: The content of 'query' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: attribute. 
    line 35 of file: 

這裏是瑪:

<?xml version="1.0" encoding="UTF-8"?> 

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"> 
    <xsd:element name="query"> 
    <xsd:complexType> 
     <xsd:sequence> 
     <xsd:element name="results" minOccurs="0" maxOccurs="1"> 
      <xsd:complexType> 
      <xsd:sequence> 
       <xsd:element name="quote" minOccurs="0" maxOccurs="unbounded"> 
       <xsd:complexType> 
        <xsd:sequence> 
        <xsd:element name="AverageDailyVolume" minOccurs="0" maxOccurs="1" type="xsd:int"/> 
        <xsd:element name="Change" minOccurs="0" maxOccurs="1" type="xsd:decimal"/> 
        <xsd:element name="DaysLow" minOccurs="0" maxOccurs="1" type="xsd:decimal"/> 
        <xsd:element name="DaysHigh" minOccurs="0" maxOccurs="1" type="xsd:decimal"/> 
        <xsd:element name="YearLow" minOccurs="0" maxOccurs="1" type="xsd:decimal"/> 
        <xsd:element name="YearHigh" minOccurs="0" maxOccurs="1" type="xsd:decimal"/> 
        <xsd:element name="MarketCapitalization" minOccurs="0" maxOccurs="1" type="xsd:normalizedString"/> 
        <xsd:element name="LastTradePriceOnly" minOccurs="0" maxOccurs="1" type="xsd:decimal"/> 
        <xsd:element name="DaysRange" minOccurs="0" maxOccurs="1" type="xsd:string"/> 
        <xsd:element name="Name" minOccurs="0" maxOccurs="1" type="xsd:string"/> 
        <xsd:element name="Symbol" minOccurs="0" maxOccurs="1" type="xsd:normalizedString"/> 
        <xsd:element name="Volume" minOccurs="0" maxOccurs="1" type="xsd:int"/> 
        <xsd:element name="StockExchange" minOccurs="0" maxOccurs="1" type="xsd:normalizedString"/> 
        </xsd:sequence> 
        <xsd:attribute name="symbol" type="xsd:normalizedString" use="required"/> 
       </xsd:complexType> 
       </xsd:element> 
      </xsd:sequence> 
      </xsd:complexType> 
     </xsd:element> 
     </xsd:sequence> 
     <xsd:attribute name="count" type="xsd:int" use="required"/> 
     <xsd:attribute name="created" type="xsd:normalizedString" use="required"/> 
     <xsd:attribute name="lang" type="xsd:normalizedString" use="required"/> 
    </xsd:complexType> 
    </xsd:element> 
</xsd:schema> 

任何人都可以,請給我解釋一下什麼是錯誤。特別是和/或糾正手段它?謝謝。

回答

2

我會想象這個問題是你在「complexType」定義之外複製的3個屬性(count,created,lang)(在文件底部)。

+0

哎呀應該使用複製粘貼,對不起,實際文件只包含這些屬性一次。我會在我的問題中解決這個問題。 – MCMeyersman

相關問題