This is my XML code-This part is well-formed and contain no errors while doing the validation.
<Employees>
<Employee>
<Name>
<FirstName>Tom</FirstName>
<LastName>Sawyer</LastName>
</Name>
<Salary>10000</Salary>
<Biography>
Worked at the <Company>MCB Ltd</Company>
as <JobTitle>Cashier</JobTitle>
</Biography>
</Employee>
<Employee>
<Name>
<FirstName>John</FirstName>
<LastName>Herold</LastName>
</Name>
<Wage>9500.25</Wage>
<Biography>
Worked at the <Company>University of Mauritius</Company>
as <JobTitle>Software Engineer</JobTitle>
</Biography>
</Employee>
</Employees>
This is my XSD code: The problem is here. I am getting this as error "element': The content is not valid. Expected is (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*))."
I'm a beginner using xml and xsd. The question is as follows:
Use the following schema namespace:
- http://www.w3.org/2001/XMLSchema-instance
- Minimum & Maximum number of Employee:
- Minimum : 1
- Maximum: unbounded
- Salary is between 10,000 and 90,000 inclusive.
- Declare the types of the following elements as global types:
- write the name for this complexType as name
- write the name for this simpleType as salary
<xs:element name="Employees"> <xs:sequence> <xs:element name="Employee" type="xs:String" minOccurs="1" maxOccurs="unbounded"> <xs:element name="Name" type="xs:String"> <xs:complexType name="name" type="xs:String"> <xs:element name="FirstName"> <xs:attribute name="Tom" type="xs:String"/> </xs:element> <xs:element name="LastName"> <xs:attribute name="Sawyer" type="xs:String"/> </xs:element> </xs:complexType> </xs:element> <xs:simpleType name="salary" type="xs:integer"> <xs:attribute name="10000" type="xs:integer" minInclusive="10000" maxInclusive="90000"/> </xs:simpleType> <xs:element name="Biography"> <xs:complexType mixed="true"> <xs:sequence> <xs:element name="Company"> <xs:attribute name="MCB Ltd" type="xs:String"/> </xs:element> <xs:element name="JobTitle"> <xs:attribute name="Cashier" type="xs:String"/> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:element> <xs:element name="Employee" type="xs:String" minOccurs="1" maxOccurs="unbounded"> <xs:element name="Name" type="xs:String"> <xs:complexType name="name" type="xs:String"> <xs:element name="FirstName"> <xs:attribute name="John" type="xs:String"/> </xs:element> <xs:element name="LastName"> <xs:attribute name="Herold" type="xs:String"/> </xs:element> </xs:complexType> </xs:element> <xs:simpleType name="wage" type="integer"> <xs:attribute name="9500.25" type="xs:integer" /> </xs:simpleType> <xs:element name="Biography"> <xs:complexType mixed="true"> <xs:sequence> <xs:element name="Company"> <xs:attribute name="University of Mauritius" type="xs:String"/> </xs:element> <xs:element name="JobTitle"> <xs:attribute name="Software Engineer" type="xs:String"/> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:element> </xs:sequence> </xs:element> </xs:schema>