[xsd-users] Non intrusive data structures

Barrie Kovish barrie.kovish at singularsoftware.com
Wed Mar 31 12:54:44 EDT 2010


Hi Boris,

Thanks for the reply.

Looking at the documentation it looks like we should be able to remove an element from one sequence and place it in a second sequence without changing the address of other elements in either sequence.  That would be exactly what we need.  Do I understand this correctly? 

Do you have a target date for beta 3.3.0 going into general release?

Thanks,

Barrie

On 2010-03-29, at 8:33 AM, Boris Kolpackov wrote:

> Hi Barrie,
> 
> Barrie Kovish <barrie.kovish at singularsoftware.com> writes:
> 
>> I'm using the XSD tree mapping. I'd like to be able to move 
>> elements around the XML document without changing the address 
>> of the elements.  For example suppose I have
>> 
>> <Dealer id="A">
>>    <Car id="1">
>>        <Color>
>>            Red
>>        <Color>
>>    </Car>
>>    <Car id="2">
>>        <Color>
>>            Blue
>>        <Color>
>>    </Car>
>> </Dealer>
>> 
>> <Dealer id="B" >
>>    <Car id="3">
>>        <Color>
>>            Red
>>        <Color>
>>    </Car>
>>    <Car id="4">
>>        <Color>
>>            Blue
>>        <Color>
>>    </Car>
>> </Dealer>
>> 
>> In code I want to keep a list of pointers to all Red cars. But if I 
>> move car id 1 from dealer A to dealer B the address of the XSD data 
>> structure will change. Is there a way to generate XSD classes which 
>> save the Car elements as pointers?
> 
> If you are using the beta for the upcoming 3.3.0 release[1], then you 
> can detach a sub-tree from the object model and then re-attach it at
> a different point, all without reallocations and thus without changing
> the sub-tree's memory location. Here is the relevant part from the
> NEWS file:
> 
>  New option, --generate-detach, triggers the generation of detach 
>  functions for required elements and attributes. For optional and 
>  sequence cardinalities the detach functions are now provided by the 
>  respective containers even without this option. These functions, for 
>  example, allow one to move sub-trees in the object model either within
>  the same tree or between different trees without copying. For more 
>  information, refer to Section 2.8 "Mapping for Local Elements and 
>  Attributes" in the C++/Tree Mapping User Manual.
> 
> [The C++/Tree Mapping User Manual is in the package's documentation/
> directory; the online version is still for 3.2.0.]
> 
> [1] http://www.codesynthesis.com/products/xsd/download.xhtml
> 
> Boris




More information about the xsd-users mailing list