I am trying to understand a XSD schema. I can't post the original schema but it is somewhat as follows. The problem I have is that I don't understand why the same namespace(http://www.test.com/test) is being referred twice, once with prefix and once without prefix. Is this valid? If yes, what purpose it serves?
Also, while generating XML for this XSD, will I use prefix or not?
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.test.com/test"
xmlns:pre="http://www.test.com/test" targetNamespace="http://www.test.com/test"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="StudentType">
<xs:sequence>
<xs:element name="studentId" type="xs:token" />
<xs:element name="firstName" type="xs:token"/>
<xs:element name="middleName" type="xs:token" minOccurs="0"/>
<xs:element name="lastName" type="xs:token"/>
</xs:sequence>
</xs:complexType>
<xs:element name="students">
<xs:complexType>
<xs:sequence>
<xs:element name="student" type="StudentType" minOccurs="0" maxOccurs="unbounded">
<xs:unique name="uniqueStudentId">
<xs:selector xpath="pre:studentId"/>
<xs:field xpath="."/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>