Re: repeatable XML element
So you need multiple "list_entry" within the list?
Then yes, you can just repeat the list_entry:
Code:
<ET id="list">
<ELEM name="description" type="string/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
</ET>
but alternative and perhaps more "pretty" and easier to read, you can wrap all the entries in a container tag, something like:
Code:
<ET id="list">
<ELEM name="description" type="string/>
<ET id="entries">
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
</ET>
</ET>
Re: repeatable XML element
thanks for your reply and info.
what would be the best way to describe a variable number of list_entry elements though?
could you just add attribute to indicate maximum # of instances of the list_entry
or do you have static elements defined?
thanks
Re: repeatable XML element
That depends on how you want to "display" it.
If you're building up a Schema (XSD) file to display the structure fo the XML file, you use the XSD syntax to display sequences and occurrences.
I'm unfamiliar with the syntax you're using, so I don't know whether it is a specific definition language or just pseudo code?
If it is a specific definition language, I would guess there already would be some sort of defined standard for displaying relationships/sequences.
However, if it is just pseudo code then I'd properly do something like this:
Code:
<ET id="list">
<ELEM name="description" type="string/>
<ET id="entries" entrycount="6">
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
<ELEM name="list_entry" type="string"/>
</ET>
</ET>
meaning using an attribute on the parent container tag to display the number. If you need that information of course.
Re: repeatable XML element
thank much for your helpful posts.