I am having an xml request for which I am trying to make tags mandatory. but positioning the tags at respective position confuses me as I am new to xml. I am using in java with SAX parsing validation.
The xml is
<empRequest><id>5</id><fname>Samp</fname></empRequest>
If I need to check 'id' as mandatory
The following is my xsd file. I feel the proper re-positioning is need for validation.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="empRequest">
<xs:complexType>
<xs:element name="id" type="xs:int">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:int">
<xs:attribute name="id" use="required">
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="fname" type="xs:string"></xs:element>
</xs:complexType>
</xs:element>
Kindly help me with exact xsd for the request.