[xsd-users] Splitting a long schema with <include> fails

Johnston, Dan Daniel.Johnston at nrc-cnrc.gc.ca
Wed Nov 7 12:12:30 EST 2012


I wanted to split a long schema file into more manageable sub-sections.
My platform is Win7-64, with Visual Studio 2009.

This is general format of my top-level schema, and one of the included files.

++++++++++++++++++ Top Level +++++++++++++++++++++++++++++++++
<?xml version="1.0"?>

<!--

file      : definitionschema.xsd
comment   : This file implements ...
author    : Daniel F. Johnston <daniel.johnston at nrc.gc.ca>
Created   : 2012, Oct. 02
Changed   : 2012-Oct-04, Dan Johnston, - fix comments
copyright : Protected for use by NRC-CNRC staff only! 2012-2020

-->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   elementFormDefault="qualified">
   <xsd:include schemaLocation="parmeshschema.xsd"/>                                    <<<<<< Note the use of the 'include'

   <!-- Define a 'BlowView Definition' file in terms of its one common element -->
   <xsd:complexType name="DefinitionFile">
      <xsd:sequence>
         <xsd:element name="HeaderSection" type="HeaderSection"/>
      </xsd:sequence>
   </xsd:complexType>

...


   <!-- substitution group root -->
   <!-- Define the 'base' definition file as a valid 'type' of definition file -->
   <xsd:element name="DefinitionFile" type="DefinitionFile"/>

   <!-- substitution group root -->
   <!-- Define the 'parmesh' definition file as a valid 'type' of definition file -->
   <xsd:element name="ParmeshDefinition" type="ParmeshDefinition" substitutionGroup="DefinitionFile" />

</xsd:schema>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

++++++++++++++++++++ included schema +++++++++++++++++++++++++
<?xml version="1.0"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   elementFormDefault="qualified">

   <!-- Define a 'parmesh' file as a type of 'definition file' -->
   <xsd:complexType name="ParmeshDefinition">
      <xsd:complexContent>
         <xsd:extension base="DefinitionFile">
            <xsd:sequence>
               <xsd:element name="ResultsSection" type="ResultsSection"/>
               <xsd:element name="ProgrammingSection" type="ProgrammingSection"/>
            </xsd:sequence>
         </xsd:extension>
      </xsd:complexContent>
   </xsd:complexType>

...

</xsd:schema>

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The xsd.exe reads this set of file OK, and the 'sample driver' contains parser commands for all the sub-components in the 'included' schema (so it must be reading both parts).
(Here is the batch file that I used to run xsd.exe)

++++++++++++++++++++++
"C:\Program Files (x86)\CodeSynthesis XSD 3.3\bin\xsd.exe" cxx-parser --prologue "// Copyright NRC" --generate-polymorphic --root-element-last --generate-print-impl --generate-test-driver --force-overwrite definitionschema.xsd
++++++++++++++++++++++

But...
Code is not generated for the second file.
I have a "definitionschema-pskel.hxx/cxx file, and the header has a line which  includes a "parmeshschema-pskel.hxx" file (similarly for the pimpl files), but there are NO parmeshschema* files generated.

Am I doing something wrong? Or, is this a bug?

Thanks!

Dan Johnston


More information about the xsd-users mailing list