XML: How to reprepresent objects with multiple occurences?

Posted by savras on Stack Overflow See other posts from Stack Overflow or by savras
Published on 2010-03-09T23:06:09Z Indexed on 2010/04/02 9:23 UTC
Read the original article Hit count: 447

Filed under:
|
|

hi, i need to save objects that can occur multiple times. each object is marked with unique identifier. when it is serialized first time all its properties are written. after that only references are used.

<actionHistory>    
  <add>
    <figure id="1" xsi:type="point">
      <position x="1" y="2" />
    </figure>
  </add>
  <change>
    <target ref="1" />
    <property>x</property>
    <value>3</value>
  </change>
</actionHistory>

element 'target' only references to point saved before, but it can contain definition of new figure as well. there is also figure class hierarchy involved.

is there any way to express it using xml-schema? any suggestions how to improve code above will be also appreciated.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xml-serialization