aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-07-30 10:45:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-07-30 10:45:18 +0200
commit0e7a03c98185396928dd36715567f7727a8f1c9b (patch)
tree0ed187266ee12073d7860275ea4756606af45de4
parent26899a31d9a85e6ec6cfb782b0977af05e3330c1 (diff)
Take into account type when resolve ref name
Apparently it is legal to have an element and an attribute with the same name.
-rw-r--r--xsd-frontend/parser.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/xsd-frontend/parser.cxx b/xsd-frontend/parser.cxx
index 3a0b180..a9701a4 100644
--- a/xsd-frontend/parser.cxx
+++ b/xsd-frontend/parser.cxx
@@ -469,8 +469,15 @@ namespace XSDFrontend
m.context ().remove ("instance-ns-name");
m.context ().remove ("instance-uq-name");
-
- Member& ref (resolve<Member> (ns_name, uq_name, s_, cache_));
+ // Resolve the name to the same type. It is legal to have
+ // an element and an attribute with the same name.
+ //
+ Member& ref (
+ m.is_a<Element> ()
+ ? static_cast<Member&> (
+ resolve<Element> (ns_name, uq_name, s_, cache_))
+ : static_cast<Member&> (
+ resolve<Attribute> (ns_name, uq_name, s_, cache_)));
// Make sure the referenced member is fully resolved.
// @@ Substitutes edge won't be resolved.