[xsde-users] bad_cast when generating from schemas having element and attribute with same name

Boris Kolpackov boris at codesynthesis.com
Wed Feb 12 00:01:04 EST 2014


Hi Vladimir,

Vladimir Zykov <vladimir.zykov at doctormobile.us> writes:
 
> We fixed this by changing line 490 in parser.cxx to
> 
> if (ref.is_a<Element> () && m.is_a<Element> ())

This bug has already been fixed and the correct fix is to change
this line (478):

            Member& ref (resolve<Member> (ns_name, uq_name, s_, cache_)); 

To read:

            // 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_)));

Thanks for the report and let me know if you run into any other
problems.

Boris



More information about the xsde-users mailing list