summaryrefslogtreecommitdiff
path: root/xsd
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-12-10 11:24:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-12-10 11:24:56 +0200
commit2a700917616a2cc0e751adb76d8f71348a80b0d8 (patch)
treef688bd1ea8eb669ed75b5a0a4ff922b3fc70cd36 /xsd
parent2f0f77b511a3dae214d084105a4277ea0009300b (diff)
Enter abstract elements into substitution map
We cannot just omit them because they may serve as "links" between the root of the substitution group and non-abstract elements that use these elements as their roots.
Diffstat (limited to 'xsd')
-rw-r--r--xsd/xsd/cxx/tree/tree-source.cxx28
1 files changed, 20 insertions, 8 deletions
diff --git a/xsd/xsd/cxx/tree/tree-source.cxx b/xsd/xsd/cxx/tree/tree-source.cxx
index 00e895b..d702509 100644
--- a/xsd/xsd/cxx/tree/tree-source.cxx
+++ b/xsd/xsd/cxx/tree/tree-source.cxx
@@ -3727,24 +3727,36 @@ namespace CXX
}
}
- if (!abst && polymorphic && e.substitutes_p () &&
- !options.suppress_parsing ())
+ // Note that we cannot just omit this element if it's abstract
+ // because it may serve as a "link" between the root of the
+ // substitution group and a non-abstract element that uses this
+ // element as its root (see element_factory_map::find_substitution()
+ // for details).
+ //
+ if (polymorphic && e.substitutes_p () && !options.suppress_parsing ())
{
String const& name (ename (e));
Type& r (e.substitutes ().root ());
os << "static" << endl
<< "const ::xsd::cxx::tree::element_factory_initializer< " <<
- poly_plate << ", " << char_type << ", ";
-
- belongs (e, belongs_);
-
- os << " >" << endl
+ poly_plate << ", " << char_type << " >" << endl
<< "_xsd_" << name << "_element_factory_init (" << endl
<< strlit (r.name ()) << "," << endl
<< strlit (r.namespace_ ().name ()) << "," << endl
<< strlit (e.name ()) << "," << endl
- << strlit (e.namespace_ ().name ()) << ");"
+ << strlit (e.namespace_ ().name ()) << "," << endl;
+
+ if (abst)
+ os << "0";
+ else
+ {
+ os << "&::xsd::cxx::tree::factory_impl< ";
+ belongs (e, belongs_);
+ os << " >";
+ }
+
+ os << ");"
<< endl
<< endl;
}