tags:

views:

18

answers:

1

I'm designing an XML document to store some data, that can also have some settings/customisation on it set by a user.

I'd like to keep the data stuff that the system defines separate from the customisation by the user.

Apalling example:

<example>
  <data>
    <fruit name="apple" maxCount="20" />
  </data>
  <settings>
    <fruit name="apple" colour="pink" size="40" />
  </settings>
</example>

This achieves what I want, but there is no obvious link between the two nodes, and I would have to use the name to cross-reference.

Is there a better way of doing this?

Thanks :)

+1  A: 

Hi Fiona,

You can use keys and keyrefs in XML schema to define and enforce such links. There is a decent tutorial: here

Daniel Vaughan
Exactly the kind of thing I was looking for, thanks
Fiona Holder