CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2001
    Location
    UK
    Posts
    308

    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
    Attached Files Attached Files
    Venu Bharadwaj
    "Dream it. U can do it!"

  2. #2
    Join Date
    Oct 2004
    Posts
    107

    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>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured