Re: Representing duplicated data in XML

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Quoted text here. Click to load it

You could have optional id and ref elements.

    <action id='myUniqueId'>blah....</action>
    <action ref='myUniqueId'/>

with documentation saying to use a ref attribute *OR* content.
Better than documentation is something you can validate
with DTD/XML Schema/whatever.  Such as

    <actionref ref='myUniqueId'/>

Where actionref requires ref, does not allow content, and can be
used wherever action can.

Depending on your app, you might consider it poor form to
reference an action in a situation from another situation.
So you might want a section of

        <actiondef id='myUniqueId'>blah...</actiondef>

where id is required (and no longer allowed in action).

Also, you probably don't want to number your action element
names "action1", "action2", etc.  Just use "action".  Order
is significant within sub-elements.


Site Timeline