[xsd-users] copying IDREF elements classes

Omkar Wagh owagh at tower-research.com
Thu May 31 12:48:10 EDT 2012


Hi Boris

On 05/31/2012 12:16 PM, Boris Kolpackov wrote:
> 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);
This sounds exactly like what I need. I'll test it and post if it solves 
my problems.
>
> Boris

Thanks a lot.



More information about the xsd-users mailing list