[xsd-users] copying IDREF elements classes
Boris Kolpackov
boris at codesynthesis.com
Thu May 31 12:16:58 EDT 2012
Hi Omkar,
Omkar Wagh <owagh at tower-research.com> writes:
> document doc = document_(filename);
>
> some_bigger_unit sbu_new (sbu1.unit1(), sbu2.unit1());
>
> Now if I try to dereference the element that sbu_new.unit1() should
> point to, I get a dynamic cast failure.
The id references are resolved in the tree to which a node belongs. In
your example sbu1 and sbu2 belong to the doc tree. But your sbu_new
doesn't belong to any bigger tree so the reference cannot be resolved.
If you add sbu_new to the doc tree, then the references will resolve.
You can also "fake" a node as belonging to a tree by setting its
container node, for example:
sbu_new._container (&doc);
Boris
More information about the xsd-users
mailing list