Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Representing duplicated data in XML

From: Peter Flynn <peter.nosp@-.--------.-->
To: NULL
Date: 9/6/2008 3:16:00 PM

Troy Cauble wrote:
> In comp.text.xml Charles Packer <mailbox@c...> wrote:
>> Does XML have a way to refer to duplicated data?
> 
>> .
>> .
>> <situation> something </situation>
>> <action1> action specific to something </action1>
>> <action2>
>>        .
>>        . ...often done in any situation...
>>        .
>> </action2>
>> <situation) something else </situation>
>> <action1> action specific to something else</action1>
>> ???
>> .
>> .
>> .
>>
>> ...the question marks are where I want to insert
>> correct XML that compactly signals a second use of
>> datum "action2". I learned from an XML tutorial that I can
>> assign an _attribute_ to action2. Might a solution to
>> the problem involve an attribute? The tutorials I perused
>> didn't have anything about this use of attributes.
> 
> 
> 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
> 
> 	<actiondefs>
> 		<actiondef id='myUniqueId'>blah...</actiondef>
> 	</actiondefs>
> 
> 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.

Sadly, SGML's CONREF (Content Reference) attribute type, which was 
(among other things) for this exact type of situation, never made it 
into XML.

///Peter


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent