0

XYZ school wants to store the details of students and staff in an XML file. The following scenario helps in designing the XML document:

persons will be the root tag.

persons will have the entry of each person with name, age, gender, address.

A person can be either a student or staff.

student will have rollno, standard and section.

If staff, then staffid and subject.

Every person must have an address with the following entry- doorno, street,city and state.

I created following XML Structure for the same statement:

<xs:schema xmlns:xs="http">
   <xs:element name="persons">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="person">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element name="name" type="xs:string" />
                     <xs:element name="age" type="xs:integer" />
                     <xs:element name="gender" type="xs:string" />
                     <xs:element name="address">
                        <xs:sequence>
                           <xs:element name="doorno" type="xs:integer" />
                           <xs:element name="street" type="xs:string" />
                           <xs:element name="city" type="xs:string" />
                           <xs:element name="state" type="xs:string" />
                        </xs:sequence>
                     </xs:element>
                     <xs:element name="student" minOccurs="0">
                        <xs:complexType>
                           <xs:sequence>
                              <xs:element name="rollno" type="xs:integer" />
                              <xs:element name="standard" type="xs:integer" />
                              <xs:element name="section" type="xs:string" />
                           </xs:sequence>
                        </xs:complexType>
                     </xs:element>
                     <xs:element name="staff" minOccurs="0">
                        <xs:complexType>
                           <xs:sequence>
                              <xs:element name="staffid" type="xs:integer" />
                              <xs:element name="subject" type="xs:string" />
                           </xs:sequence>
                        </xs:complexType>
                     </xs:element>
                  </xs:sequence>
               </xs:complexType>
            </xs:element>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
</xs:schema>

Above code is giving me an error and I am unable to solve that error. Please help! Error is cannot find the declaration of element 'xs:schema'.

Rohn07
  • 13
  • 2
  • 5
  • Does this answer your question? [XML Schema Validation : Cannot find the declaration of element](https://stackoverflow.com/questions/15642046/xml-schema-validation-cannot-find-the-declaration-of-element) – NvrKill Aug 17 '20 at 14:02
  • Yes, it answered my doubt, Thank you for the support! @RyffLe – Rohn07 Aug 26 '20 at 13:59

0 Answers0