XSD/Schema compilation checklist

From Code Synthesis Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 09:49, 17 February 2008
Boris (Talk | contribs)
(C++/Tree Mapping Options)
← Previous diff
Revision as of 09:57, 17 February 2008
Boris (Talk | contribs)
(C++/Tree Mapping Options)
Next diff →
Line 22: Line 22:
* If your XML vocabulary uses XML Schema polymorphism (<code>xsi:type</code> or substitution groups), then you will need to compile your schemas with the <code>--generate-polymorphic</code> option. See [http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.11 Section 2.11, "Mapping for <code>xsi:type</code> and Substitution Groups"] in the [http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/ C++/Tree Mapping User Manual] for details. * If your XML vocabulary uses XML Schema polymorphism (<code>xsi:type</code> or substitution groups), then you will need to compile your schemas with the <code>--generate-polymorphic</code> option. See [http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.11 Section 2.11, "Mapping for <code>xsi:type</code> and Substitution Groups"] in the [http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/ C++/Tree Mapping User Manual] for details.
 +
 +* If your XML vocabulary uses XML Schema wildcards (<code>xsd:any</code> and <code>xsd:anyAttribute</code>) then you may want to use the <code>--generate-wildcard</code> option. See [http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.12 Section 2.12, "Mapping for any and anyAttribute"] in the [http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/ C++/Tree Mapping User Manual] for details.
 +
 +* If you would like to change the identifier naming convention used in the generate code, then you can use the <code>--type-naming</code> and <code>--function-naming</code> options. See the Naming Convention section in the [http://www.codesynthesis.com/projects/xsd/documentation/xsd.xhtml XSD command line interface documentation (man pages)].
 +
 +* If you are using Visual Studio 2005 and rely on IntelliSense, then you may want to compile your schemas with the <code>--generate-intellisense</code> option.
== C++/Parser Mapping Options == == C++/Parser Mapping Options ==
The following options are specific to the [[Tree|C++/Parser mapping]]: The following options are specific to the [[Tree|C++/Parser mapping]]:

Revision as of 09:57, 17 February 2008

This page provides a checklist-like run through the most commonly used XSD options. For more details on each option as well as for the complete list of options refer to the XSD command line interface documentation (man pages).

Contents


Common Options

The following options are available for all mappings:

  • You can map any XML Schema namespace (including the no-namespace case and built-in XML Schema namespace) to a custom C++ namespace with the --namespace-map option, for example, --namespace-map http://www.example.com/xmlns/my=ExampleInc::My. To place the generated code for a schema without a target namespace into a C++ namespace, use the empty string as XML Schema namespace: --namespace-map =My. To map a set of namespaces at once the --namespace-regex option is available.
  • To place the generated code into a specific directory, use the --output-dir options, for example, --output-dir src.
  • You can select the character type that should be used in the generated code with the --char-type option. Available choices are char (default), and wchar_t.
  • If you have several schema files and some of them are not self-sufficient (that is, you get XML Schema errors when trying to compile them with XSD) or have cyclic dependecies that involve inheritance (that is, you get C++ errors when compiling the generated code with the message saying that the base type is undefined) then you will need to use the file-per-type compilation mode which is turned on with the --file-per-type option. For more information about the file-per-type mode see this blog post.

C++/Tree Mapping Options

The following options are specific to the C++/Tree mapping:

  • If you are using Visual Studio 2005 and rely on IntelliSense, then you may want to compile your schemas with the --generate-intellisense option.

C++/Parser Mapping Options

The following options are specific to the C++/Parser mapping:

Personal tools