E sad, izgleda da nisam dobro podesio Xpath selector jer mi kad pokrenem XJC skriptu javlja gresku:
/xjc/ Error [file:/D:/Projects/Java/XMLExample/fakultet.xsd:35] c-general-xpath: The expression '.student' is not valid with respect to the XPath subset supported by XML Schema.
/xjc/ Error [file:/D:/Projects/Java/XMLExample/fakultet.xsd:45] c-general-xpath: The expression '.professor' is not valid with respect to the XPath subset supported by XML Schema.
probao sam da stavim i "./" za selector i "professor/".
XSD za profesora izgleda ovako:
Code:
<xs:complexType name="professorType">
<xs:sequence>
<xs:element name="id" maxOccurs="1" type="xs:int"/>
<xs:element name="name" maxOccurs="1" minOccurs="1" type="xs:string"/>
<xs:element name="lastName" maxOccurs="1" minOccurs="1" type="xs:string"/>
<xs:element name="salary" maxOccurs="1" minOccurs="1" type="xs:double"/>
<xs:element name="address" maxOccurs="1" minOccurs="1" type="addressType"/>
<xs:element name="subjects" type="subjectsType"/>
</xs:sequence>
</xs:complexType>
<xs:element name="professor" type="professorType">
<xs:key name="professorID">
<xs:selector xpath=".professor"/>
<xs:field xpath="@id"/>
</xs:key>
</xs:element>
<xs:complexType name="professorType">
<xs:sequence>
<xs:element name="id" maxOccurs="1" type="xs:int"/>
<xs:element name="name" maxOccurs="1" minOccurs="1" type="xs:string"/>
<xs:element name="lastName" maxOccurs="1" minOccurs="1" type="xs:string"/>
<xs:element name="salary" maxOccurs="1" minOccurs="1" type="xs:double"/>
<xs:element name="address" maxOccurs="1" minOccurs="1" type="addressType"/>
<xs:element name="subjects" type="subjectsType"/>
</xs:sequence>
</xs:complexType>
<xs:element name="professor" type="professorType">
<xs:key name="professorID">
<xs:selector xpath=".professor"/>
<xs:field xpath="@id"/>
</xs:key>
</xs:element>
Kako treba da se napise taj Xpath selector?
Pozdrav