summaryrefslogtreecommitdiff
path: root/libxsd
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 /libxsd
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 'libxsd')
-rw-r--r--libxsd/xsd/cxx/tree/type-factory-map.hxx7
-rw-r--r--libxsd/xsd/cxx/tree/type-factory-map.txx16
2 files changed, 15 insertions, 8 deletions
diff --git a/libxsd/xsd/cxx/tree/type-factory-map.hxx b/libxsd/xsd/cxx/tree/type-factory-map.hxx
index e20acfe..d52982f 100644
--- a/libxsd/xsd/cxx/tree/type-factory-map.hxx
+++ b/libxsd/xsd/cxx/tree/type-factory-map.hxx
@@ -150,11 +150,14 @@ namespace xsd
//
//
- template<unsigned long id, typename C, typename T>
+ template<unsigned long id, typename C>
struct element_factory_initializer
{
+ typedef typename type_factory_map<C>::factory factory;
+
element_factory_initializer (const C* root_name, const C* root_ns,
- const C* subst_name, const C* subst_ns);
+ const C* subst_name, const C* subst_ns,
+ factory);
~element_factory_initializer ();
diff --git a/libxsd/xsd/cxx/tree/type-factory-map.txx b/libxsd/xsd/cxx/tree/type-factory-map.txx
index 1eddb25..5a9dc38 100644
--- a/libxsd/xsd/cxx/tree/type-factory-map.txx
+++ b/libxsd/xsd/cxx/tree/type-factory-map.txx
@@ -302,6 +302,9 @@ namespace xsd
if (i != element_map_.end ())
{
+ // Note that we may find an abstract element in which case the
+ // returned factory will be NULL.
+ //
f = find_substitution (i->second, qn);
}
}
@@ -455,21 +458,22 @@ namespace xsd
//
//
- template<unsigned long id, typename C, typename T>
- element_factory_initializer<id, C, T>::
+ template<unsigned long id, typename C>
+ element_factory_initializer<id, C>::
element_factory_initializer (const C* root_name, const C* root_ns,
- const C* subst_name, const C* subst_ns)
+ const C* subst_name, const C* subst_ns,
+ factory f)
: root_name_ (root_name), root_ns_ (root_ns),
subst_name_ (subst_name), subst_ns_ (subst_ns)
{
type_factory_map_instance<id, C> ().register_element (
xml::qualified_name<C> (root_name, root_ns),
xml::qualified_name<C> (subst_name, subst_ns),
- &factory_impl<T>);
+ f);
}
- template<unsigned long id, typename C, typename T>
- element_factory_initializer<id, C, T>::
+ template<unsigned long id, typename C>
+ element_factory_initializer<id, C>::
~element_factory_initializer ()
{
type_factory_map_instance<id, C> ().unregister_element (