0

Hi,This place has solved lot of my problems , so here I come one more time. I have looked at this for long , can't fix this. I am copying my schema my xml and errors if you can help . Please and Thanks.

<xs:element name="listings">
<xs:complexType>
<xs:sequence>
<xs:element name="listing" maxOccurs="unbounded" ref="listing"/>
<xs:attribute name="id" use="required" type="xs:integer"/>
<xs:attribute name="kind"use="required" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="listing">
<xs:complexType>
<xs:sequence>
<xs:element ref="address"/>
<xs:element ref="price"/>
<xs:element ref="features"/>
<xs:element ref="area"/>
<xs:element ref="school_system"/>
<xs:element ref="annualtaxes"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="address" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="streetaddress" type="xs:string" minOccurs="0" />
<xs:element name="city" type="xs:string" minOccurs="0" />
<xs:element name="state" type="xs:string" minOccurs="0" />
<xs:element name="zipcode" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="price" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="catagory2" type="xs:string" minOccurs="0" />
<xs:element name="catagory4" type="xs:string" minOccurs="0" />
<xs:element name="catagory1" type="xs:string" minOccurs="0" />
<xs:element name="catagory3" type="xs:string" minOccurs="0" />
<xs:element name="catagory5" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>


<xs:element name="features" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="no_of_bedrooms" type="xs:string" minOccurs="0" />
<xs:element name="no_of_bathrooms" type="xs:string" minOccurs="0" />
<xs:element name="swimming_pool" type="xs:string" minOccurs="0" />
<xs:element name="alarm_system" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>


<xs:element name="area" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="land" type="xs:string" minOccurs="0" />
<xs:element name="square_feet" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="school_system" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="elementary" type="xs:string" minOccurs="0" />
<xs:element name="middle" type="xs:string" minOccurs="0" />
<xs:element name="highschool" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="annualtaxes" type="xs:string" minOccurs="0" msdata:Ordinal="1" />

</xs:schema>


<listing id="00001" kind="singlefamily">
<address>
<streetaddress>2 quarry ridge</streetaddress>
<city>charleston</city>
<state>wv</state>
<zipcode>25304</zipcode>
</address>
<price>
<catagory5>2,400,000</catagory5>
</price>
<features>
<no_of_bedrooms>6</no_of_bedrooms>
<no_of_bathrooms>7</no_of_bathrooms>
<swimming_pool>yes</swimming_pool>
<alarm_system>included</alarm_system>
</features>
<area>
<land>6 acres</land>
<square_feet>9000</square_feet>
</area>
<school_system>
<elementary>kanawha</elementary>
<middle>kanawha</middle>
<highschool>kanawha</highschool>
</school_system>
<annualtaxes>23,000</annualtaxes>
</listing>
<listing id="00002" kind="loft">
<address>
<streetaddress>2700 virginia ave NW #1410</streetaddress>
<city>foggy bottom</city>
<state>virginia</state>
<zipcode>20730</zipcode>
</address>
<price>
<catagory3>440,455</catagory3>
</price>
<features>
<no_of_bedrooms>2</no_of_bedrooms>
<no_of_bathrooms>2</no_of_bathrooms>
<swimming_pool>no</swimming_pool>
<alarm_system>unspecified</alarm_system>
</features>
<area>
<land>0</land>
<square_feet>1336</square_feet>
</area>
<school_system>
<elementary>kingsley</elementary>
<middle>weber</middle>
<highschool>shoemaker</highschool>
</school_system>
<annualtaxes>9000</annualtaxes>
</listing>
<listing id="0003" kind="duplex">
<address>
<streetaddress>13 gunpowder lane</streetaddress>
<city>rehoboth beach</city>
<state>delaware</state>
<zipcode>19971</zipcode>
</address>
<price>
<catagory1>22,000</catagory1>
</price>
<features>
<no_of_bedrooms>2</no_of_bedrooms>
<no_of_bathrooms>1</no_of_bathrooms>
<swimming_pool>no</swimming_pool>
<alarm_system>no</alarm_system>
</features>
<area>
<land>1 acre</land>
<square_feet>1880</square_feet>
</area>
<school_system>
<elementary>copenhaven</elementary>
<middle>copenhave</middle>
<highschool>copenhave</highschool>
</school_system>
<annualtaxes>1200</annualtaxes>
</listing>
<listing id="0004" kind="singlrfamily">
<address>
<streetaddress>12 cornwall rd</streetaddress>
<city>charleston</city>
<state>wv</state>
<zipcode>25314</zipcode>
</address>
<price>
<catagory4>600,500</catagory4>
</price>
<features>
<no_of_bedrooms>5</no_of_bedrooms>
<no_of_bathrooms>3</no_of_bathrooms>
<swimming_pool>no</swimming_pool>
<alarm_system>yes</alarm_system>
</features>
<area>
<land>2 acres</land>
<square_feet>5000</square_feet>
</area>
<school_system>
<elementary>kanawha</elementary>
<middle>kanawha</middle>
<highschool>kanawha</highschool>
</school_system>
<annualtaxes>4904</annualtaxes>
</listing>


Now here's the errors

10: 43 cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'listing'.
10: 43 cvc-complex-type.3.2.2: Attribute 'kind' is not allowed to appear in element 'listing'.
37: 35 cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'listing'.
37: 35 cvc-complex-type.3.2.2: Attribute 'kind' is not allowed to appear in element 'listing'.
64: 36 cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'listing'.
64: 36 cvc-complex-type.3.2.2: Attribute 'kind' is not allowed to appear in element 'listing'.
91: 42 cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'listing'.
91: 42 cvc-complex-type.3.2.2: Attribute 'kind' is not allowed to appear in element 'listing'.
118: 39 cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'listing'.
118: 39 cvc-complex-type.3.2.2: Attribute 'kind' is not allowed to appear in element 'listing'.
145: 42 cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'listing'.
145: 42 cvc-complex-type.3.2.2: Attribute 'kind' is not allowed to appear in element 'listing'.
172: 41 cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'listing'.
172: 41 cvc-complex-type.3.2.2: Attribute 'kind' is not allowed to appear in element 'listing'.
199: 42 cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'listing'.
199: 42 cvc-complex-type.3.2.2: Attribute 'kind' is not allowed to appear in element 'listing'.
226: 42 cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'listing'.
226: 42 cvc-complex-type.3.2.2: Attribute 'kind' is not allowed to appear in element 'listing'.
253: 42 cvc-complex-type.3.2.2: Attribute 'id' is not allowed to appear in element 'listing'.
253: 42 cvc-complex-type.3.2.2: Attribute 'kind' is not allowed to appear in element 'listing'.

Errors in file bela.xsd:
14: 70 s4s-att-not-allowed: Attribute 'name' cannot appear in element 'element'.
15: 61 s4s-elt-must-match.1: The content of 'sequence' must match (annotation?, (element | group | choice | sequence | any)*). A problem was found starting at: attribute.
16: 63 s4s-elt-must-match.1: The content of 'sequence' must match (annotation?, (element | group | choice | sequence | any)*). A problem was found starting at: attribute.
34: 82 s4s-att-not-allowed: Attribute 'maxOccurs' cannot appear in element 'element'.
34: 82 s4s-att-not-allowed: Attribute 'minOccurs' cannot appear in element 'element'.
47: 76 s4s-att-not-allowed: Attribute 'maxOccurs' cannot appear in element 'element'.
47: 76 s4s-att-not-allowed: Attribute 'minOccurs' cannot appear in element 'element'.
60: 79 s4s-att-not-allowed: Attribute 'maxOccurs' cannot appear in element 'element'.
60: 79 s4s-att-not-allowed: Attribute 'minOccurs' cannot appear in element 'element'.
72: 75 s4s-att-not-allowed: Attribute 'maxOccurs' cannot appear in element 'element'.
72: 75 s4s-att-not-allowed: Attribute 'minOccurs' cannot appear in element 'element'.
81: 84 s4s-att-not-allowed: Attribute 'maxOccurs' cannot appear in element 'element'.
81: 84 s4s-att-not-allowed: Attribute 'minOccurs' cannot appear in element 'element'.
91: 96 s4s-att-not-allowed: Attribute 'minOccurs' cannot appear in element 'element'.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by phpbeginners
0

hi can you try do not put the "<xs:attribute/>" inside the <xs:sequence></xs:sequence>

<xs:element name="listings">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="listing" maxOccurs="unbounded" ref="listing"/>
      <xs:attribute name="id" use="required" type="xs:integer"/>
      <xs:attribute name="kind"use="required" type="xs:integer"/>
   </xs:sequence>
 </xs:complexType>
</xs:element>

should be like this...

<xs:element name="listings">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="listing" maxOccurs="unbounded" ref="listing"/>
   </xs:sequence> <!--here's your sequence closing tag -->
      <xs:attribute name="id" use="required" type="xs:integer"/>
      <xs:attribute name="kind"use="required" type="xs:integer"/>
 </xs:complexType>
</xs:element>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.