Hi,
It will not be a dummy XML file, the xml file generated will contain the
mandatory elements and it can be refined and used with my application. But I
would like to rephrase my question here as my problem doesn't seem to have
been clear. The focus is not on the XML file, but the design of the XSD
files.
I have an xml file part of which can be shown as below :
<PANEL_CLUSTER>
<ppDialogFile>PanelClusterDlg.resx</ppDialogFile>
<ppDeletable>0</ppDeletable>
<ppDefault>1</ppDefault>
<ppSubNodesPossible>1</ppSubNodesPossible>
<ppMax_NN_NETWORK>8</ppMax_NN_NETWORK>
<ppHelpIndex>%rr80202</ppHelpIndex>
<ppIcoName>PANEL_CLUSTER.ico</ppIcoName> From Definition.xsd
<ppDisplayName>%rr80202</ppDisplayName>
<ppSaveName>%rr80202</ppSaveName>
<spcheckdate>null</spcheckdate>
<ppCompute_ppDisplayName_Strict>%rr80202+""+$rr200 03</ppCompute_ppDisplayNam
e_Strict>
<ppEnum_rr20004>%rr91004</ppEnum_rr20004>
<rr20003 FLS="5,5">Cluster with 2 Magic-Panels</rr20003> From
Attributes.xsd
<rr20004 FLS="5,5">CT_UK</rr20004>
</PANEL_CLUSTER>
There will be 2 XSD files, one which contains the constraints for some
elements of the "PANEL_CLUSTER" element and the other which contains the
constraints for the remaining elements of the SAME "PANEL_CLUSTER" element.
The question is, how should these 2 XSD files be designed so that the final
XML file ( shown above ) can be validated against the 2 schemas. Are there
any help articles on how to build the XSD files and the syntax to be used?
I have tried it this way :
Say the first XSD file is called "Definition.xsd" and it is as below :
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="PANEL_CLUSTER">
<xs:complexType>
<xs:all>
<xs:element name="ppDialogFile" type="xs:string"/>
<xs:element name="ppDeletable" type="xs:boolean"/>
<xs:element name="ppDefault" type="xs:boolean"/>
<xs:element name="ppSubNodesPossible" type="xs:boolean"/>
<xs:element name="ppMax_NN_NETWORK" type="xs:byte"/>
<xs:element name="ppHelpIndex" type="xs:string"/>
<xs:element name="ppIcoName" type="xs:string"/>
<xs:element name="ppDisplayName" type="xs:string"/>
<xs:element name="ppSaveName" type="xs:string"/>
<xs:element name="spcheckdate" type="xs:string"/>
<xs:element name="ppCompute_ppDisplayName_Strict"
type="xs:string"/>
<xs:element name="ppEnum_rr20004" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
And the second is called "Attribute.xsd" and in this file, I want to specify
the remaining 2 elements of the PANEL_CLUSTER element, namely "rr20003" and
"rr20004". For this, I "include" the Definition.xsd file in the
Attribute.xsd file and add the remaining elements as follows :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="Definition.xsd"/>
<xs:element ref="PANEL_CLUSTER">
<xs:complexType>
<xs:element name="rr20003">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="FLS" type="xs:string"
use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="rr20004">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="FLS" type="xs:string"
use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
</xs:schema>
But this gives me an error saying the <xs:element ref="PANEL_CLUSTER"> is
not valid. Is there something wrong with what I am doing? Is there a better
way to accomplish the same goal ?
Regards,
Kanchana