1 Attachment(s)
Refering XSD inside another XSD
Hi there:
I hv set a reference of XSD file (file2.xsd) inside the another xsd file (file1.xsd) using the "ref" attributes of an "element" and the "include" statement....
In this implementation - "root" element of file2.xsd is completely imported into file1.xsd....
But, i need only sub node of file2.xsd to be included into the file1.xsd..
please can u help me in this...
Sample files attached...
[In file1.xsd, "F2Data" node is refereed... This is referring to "root" element of file2.xsd, but i need to refer "EmploymentDetails" node of file2.xsd in file1.xsd...]
Thanks
VB
Re: Refering XSD inside another XSD
In your second file, (File2.xsd) declare the sub node as its own element type.
Replace the definition inside F2Data with a ref instead. eg:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="F2Data">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="ApplicantName"/>
<xs:element ref="EmploymentDetails"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="EmploymentDetails">
<xs:complexType>
<xs:sequence>
<xs:element name="EmpType"/>
<xs:element name="Salary"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>