My Xml:
<?xml version="1.0" encoding="UTF-8"?>
<company>
<companyname>ABC company</companyname>
<address>xyz street, India.</address>
<department>
<dname>Marketing</dname>
<deptphoneno>9876543210</deptphoneno>
<deptfaxno>0442456879</deptfaxno>
<deptemail>marketing@abc.com</deptemail>
<employee>
<empid>101</empid>
<ename>Rishie</ename>
<emailid>rishie@abc.com</emailid>
<phoneno>9876543211</phoneno>
</employee>
<contractemployee>
<name>Ravi</name>
<phoneno>9874563214</phoneno>
</contractemployee>
</department>
</company>
and my XSD:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="company">
<xs:complexType>
<xs:sequence>
<xs:element name="companyname" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:element name="department">
<xs:complexType>
<xs:sequence>
<xs:element name="dname" type="xs:string"/>
<xs:element name="deptphoneno" type="xs:integer"/>
<xs:element name="deptfaxno" type="xs:integer"/>
<xs:element name="deptemail" type="xs:string"/>
<xs:element name="employee">
<xs:complexType>
<xs:sequence>
<xs:element name="empid" type="xs:integer"/>
<xs:element name="ename" type="xs:string"/>
<xs:element name="emailid" type="xs:string"/>
<xs:element name="phoneno" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="contractemployee">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="phoneno" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I know that at first glance everything looks correct...but i keep getting some errors! I hope someone could help me out with this! Iam not sure whether its the xml or the xsd.
The Error:
Exception: cvc-complex-type.2.4.a: Invalid content was found starting with eleme
nt 'employee'. One of '{contractemployee}' is expected.
Please help me out with the tag <xs:schema>
in my XSD and <company>
in xml.