C
Charles Packer
Does XML have a way to refer to duplicated data?
Suppose I create a source text that consists of rules for
generating an object text of expanded material when parsed by
a program that knows the rules. Suppose that
one of the rules is long and occurs multiple times in
the source text. I want to have only one instance of this
rule in the source text for compactness and ease of editing
it later. In this example...
..
..
..
<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.
Suppose I create a source text that consists of rules for
generating an object text of expanded material when parsed by
a program that knows the rules. Suppose that
one of the rules is long and occurs multiple times in
the source text. I want to have only one instance of this
rule in the source text for compactness and ease of editing
it later. In this example...
..
..
..
<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.