I have an xsd which has 3 imports to another xsd, 8 complex types and 3 simple types.
Now of this I have to work on only 1 compex type, which in turn inherits many other XSD - mainly the 3 imports which current xsd's has.
I will be getting XML file containing data only according to 1 complex type only, which I have mentioned.
Now am trying to generate sample XML file which contains data according to single complex type and am trying to validate it, but when I try to do so using XMLSpy or OxygenXML it says that root node is not defined.
Now, when I try to define root nodes it does not allow me to do so and if I try to create another xsd just for this complex type than also it gives me some errors as inherited xsd which this complex type points to in initial xsd is not working in new one, I tried to inherit 3 xsd's to which complex type point to in initial xsd in new xsd but still it is not working.
Also my another question is - Can we validate XML file against some part of XSD as compared to complete XSD because XML what am getting is according to 1 complex element type in XSD ?
Format of Initial XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:schema location targetNamespace=targetnamespace elementFormDefault="qualified" attributeFormDefault="unqualified" version="0.652">
<xs:import namespace=first xsd which is imported>
<xs:import namespace=second xsd which is imported>
<xs:import namespace=third xsd which is imported>
<xs:complexType name="firstcomplextype" abstract="false">
<xs:sequence>
<xs:element name="some value" type="xs:string" minOccurs="0"/>
<xs:element name="some value" type="some value"/>
<xs:element name="some value" type="xs:string" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="some value" type="xs:int" use="required"/>
<xs:attribute name="some value" type="xs:value" use="required"/>
<xs:attribute name="some value" type="xs:int" use="required"/>
</xs:complexType>
<xs:complexType name="second complex type" abstract="false">
<xs:sequence>
<xs:element name="some value" type="xs:some value" minOccurs="0"/>
<xs:element name="some value" type="xs:some value" minOccurs="0"/>
<xs:element name="some value" type="some value"/>
<xs:element name="some value" type="some value"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="third complex type**I need to work with only this complex type and xml file will contain data according to this complex type only and I need to validate incoming XML against only this complex type**" abstract="false">
<xs:sequence>
<xs:element name="some value" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="some value" type="some value" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="some value" type="some value"/>
<xs:element name="some value" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="some value" type="some value" minOccurs="0" maxOccurs="unbounded"/>---**Here this particular element points to another XSD, one of the imported XSD's**
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:sequence minOccurs="0">
<xs:element name="some value" type="xs:some value" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="some value" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="some value" type="some value" minOccurs="0" maxOccurs="unbounded"/>---**Here this particular element points to another XSD, one of the imported XSD's**
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:sequence minOccurs="0">
<xs:element name="some value" type="xs:some value" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="some value" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="some value" type="some value" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:sequence>
</xs:complexType>
<xs:complexType name="4th complex type" abstract="false">
<xs:sequence>
<xs:element name="elements">
<xs:complexType>
<xs:sequence>
<xs:element name="some value" type="some value" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
and the xsd continues as it has many more complex types and simple types. Any guidance would be highly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…