let's say I have below standard.xsd
file piece of code,
<xs:complexType name="StdBasicTags">
<xs:sequence>
<xs:element name="Name" type="xs:string" nillable="true">
<xs:annotation>
<xs:documentation>Name</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
Now I have another XSD file which inlcudes above file and adds some additional element to above complexType StdBasicTags
The file name is fullStandard.xsd
and the way I have extended the StdBasicTags
is as follows :
<xs:include schemaLocation="standard.xsd"/>
........
........
<xs:complexType name="FullStdBasicTags">
<xs:complexContent>
<xs:extension base="StdBasicTags">
<xs:sequence>
<xs:element name="Surname" type="xs:string">
<xs:annotation>
<xs:documentation>Last name</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
I have following queries,
I am using licensed Altova XmlSpy tool to generate Sample xml for fullStandard.xsd file but I can only see the
Name
element and not theSurname
element as expected. Can anyone tell what is the possible reason to it, what is it that I am missing?I am having to give another name which is
FullStdBasicTags
for extending theStdBasicTags
and adding a new element. In this case what is going to be the output of the full final XML file? The idea is to have bothName
andSurname
under same parent complexTypeStdBasicTags
.Lastly, is there anything wrong with the architecture/output I am expecting?
Note** both the files are getting validated correctly. Also the idea is to achieve what I have just mentioned without making any changes to the
standard.xsd
file.
**UPDATE I am surprised that till now no one got any suggestions to me. Meanwhile I tried this,
<xs:element name="FullNewRoot">
<xs:complexType>
<xs:sequence>
<xs:element ref="rootElementName"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Where rootElementName
is the root element of standard.xsd. After adding this now I am able to see the additional elements. But now the trouble is that, entire standard.xsd structure is appearing first and then whatever I have redefined in fullStandard.xsd is appearing, while I just want all of them for once.
Please please suggest something.