[xsd-users] Re: Copying objects

Mathew Benson mathew.benson at gmail.com
Sat Mar 22 13:32:38 EDT 2014


I should clarify.  My model has a container class
called CommandContainerEntryListType which contains various objects
including a ParameterRefEntry sequence.  My function walks the model and
basically merges the various CommandContainerEntryListType objects together
into a single object returned by the function.  But the IDREF pointers are
null.  I think the following is the root of the problem:

getEntryList()
{
CommandContainerEntryListType entryList;  /* This is the problem. */
/* Start walking the model. */


That "entryList" object is meant to contain the collected objects. The
problem is that its created outside the DOM so IDREFs couldn't possibly
point to the original ID. I would really need to create the entryList
object in the same DOM. Just for closure is it even possible to create an
object in the DOM without actually attaching it as a child to another
object? I'm thinking no. I'm thinking this is a bad solution anyway. I
think a better solution is to just create a custom container and store
references to the objects.



On Sat, Mar 22, 2014 at 12:10 PM, Mathew Benson <mathew.benson at gmail.com>wrote:

> What's the best way to copy an object or reference to an object and retain
> the IDREF pointers?  I'm writing a function that needs to collect various
> objects in the object model and I wanted to use one of the XSD created
> objects as a container.  It already contains vectors containing the objects
> I want to collect.  But I noticed when I call push_back() to store the
> object away, its making a copy and the IDREF pointers are null.  Or should
> I just create a custom container and store pointers?
>


More information about the xsd-users mailing list