summaryrefslogtreecommitdiff
path: root/documentation
diff options
context:
space:
mode:
Diffstat (limited to 'documentation')
-rw-r--r--documentation/cxx/tree/manual/index.xhtml57
-rw-r--r--documentation/xsd.125
-rw-r--r--documentation/xsd.xhtml20
3 files changed, 101 insertions, 1 deletions
diff --git a/documentation/cxx/tree/manual/index.xhtml b/documentation/cxx/tree/manual/index.xhtml
index f1696c0..c00be9e 100644
--- a/documentation/cxx/tree/manual/index.xhtml
+++ b/documentation/cxx/tree/manual/index.xhtml
@@ -3470,6 +3470,63 @@ f (root& r)
}
</pre>
+ <p>The mapping can often automatically determine which types are
+ polymorphic based on the substitution group declarations. However,
+ if your XML vocabulary is not using substitution groups or if
+ substitution groups are defined in a separate schema, then you will
+ need to use the <code>--polymorphic-type</code> option to specify
+ which types are polymorphic. When using this option you only need
+ to specify the root of a polymorphic type hierarchy and the mapping
+ will assume that all the derived types are also polymorphic.
+ Also note that you need to specify this option when compiling every
+ schema file that references the polymorphic type. Consider the following
+ two schemas as an example:</p>
+
+ <pre class="xml">
+&lt;!-- base.xsd -->
+&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ &lt;xs:complexType name="base">
+ &lt;xs:sequence>
+ &lt;xs:element name="b" type="xs:int"/>
+ &lt;/xs:sequence>
+ &lt;/xs:complexType>
+
+ &lt;!-- substitution group root -->
+ &lt;xs:element name="base" type="base"/>
+
+&lt;/xs:schema>
+ </pre>
+
+ <pre class="xml">
+&lt;!-- derived.xsd -->
+&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ &lt;include schemaLocation="base.xsd"/>
+
+ &lt;xs:complexType name="derived">
+ &lt;xs:complexContent>
+ &lt;xs:extension base="base">
+ &lt;xs:sequence>
+ &lt;xs:element name="d" type="xs:string"/>
+ &lt;/xs:sequence>
+ &lt;/xs:extension>
+ &lt;/xs:complexContent>
+ &lt;/xs:complexType>
+
+ &lt;xs:element name="derived" type="derived" substitutionGroup="base"/>
+
+&lt;/xs:schema>
+ </pre>
+
+ <p>In this example we need to specify "<code>--polymorphic-type base</code>"
+ when compiling both schemas because the substitution group is declared
+ in a schema other than the one defining type <code>base</code>.</p>
+
+ <p>You can also indicate that all types should be treated as polymorphic
+ with the <code>--polymorphic-type-all</code>. However, this may result
+ in slower generated code with a greater footprint.</p>
+
<!-- Mapping for any and anyAttribute -->
diff --git a/documentation/xsd.1 b/documentation/xsd.1
index 743f1af..762d865 100644
--- a/documentation/xsd.1
+++ b/documentation/xsd.1
@@ -739,6 +739,31 @@ are replaced with new lines.
Generate polymorphism-aware code. Specify this option if you use substitution
groups or
.BR xsi:type .
+Use the
+.B --polymorphic-type
+or
+.B --polymorphic-type-all
+option to specify which type hierarchies are polymorphic.
+
+.IP "\fB\--polymorphic-type \fItype\fR"
+Indicate that
+.I type
+is a root of a polymorphic type hierarchy. The compiler can often
+automatically determine which types are polymorphic based on the
+substitution group declarations. However, you may need to use this
+option if you are not using substitution groups or if substitution
+groups are defined in another schema. You need to specify this option
+when compiling every schema file that references
+.IR type .
+The
+.I type
+argument is an XML Schema type name that can be optionally qualified
+with a namespace in the
+.IB namespace # name
+form.
+
+.IP "\fB\--polymorphic-type-all\fR"
+Indicate that all types should be treated as polymorphic.
.IP "\fB\--generate-serialization\fR"
Generate serialization functions. Serialization functions convert
diff --git a/documentation/xsd.xhtml b/documentation/xsd.xhtml
index 1f1c5f8..46e8c1a 100644
--- a/documentation/xsd.xhtml
+++ b/documentation/xsd.xhtml
@@ -657,7 +657,25 @@
<dl class="options">
<dt><code><b>--generate-polymorphic</b></code></dt>
<dd>Generate polymorphism-aware code. Specify this option if you use
- substitution groups or <code><b>xsi:type</b></code>.</dd>
+ substitution groups or <code><b>xsi:type</b></code>. Use the
+ <code><b>--polymorphic-type</b></code> or
+ <code><b>--polymorphic-type-all</b></code> option to specify
+ which type hierarchies are polymorphic.</dd>
+
+ <dt><code><b>--polymorphic-type</b></code> <i>type</i></dt>
+ <dd>Indicate that <code><i>type</i></code> is a root of a polymorphic
+ type hierarchy. The compiler can often automatically determine
+ which types are polymorphic based on the substitution group
+ declarations. However, you may need to use this option if you are
+ not using substitution groups or if substitution groups are defined
+ in another schema. You need to specify this option when compiling
+ every schema file that references <code><i>type</i></code>. The
+ <code><i>type</i></code> argument is an XML Schema type name that
+ can be optionally qualified with a namespace in the
+ <code><i>namespace</i><b>#</b><i>name</i></code> form.</dd>
+
+ <dt><code><b>--polymorphic-type-all</b></code></dt>
+ <dd>Indicate that all types should be treated as polymorphic.</dd>
<dt><code><b>--generate-serialization</b></code></dt>
<dd>Generate serialization functions. Serialization functions