Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Storing general-purpose and specific entries

Thread Tools

Storing general-purpose and specific entries

Robert Bj?rn
Posts: n/a
I would like to store a number of entries in XML format. For this I
require attributes that describe information common to all entries, as
well as additional information that depends on the type of entry.

What is the best way of solving this in XML, while not contradicting
the standard and ensuring maximum flexibility? I can think of a few
different approaches:

1) Define elements with different names for each type of entry,
something like this:

<greenentry name="something" size="3" greensetting1="x"
<redentry name="something" size="3" redsetting1="x" redsetting2="y">

The problem obviously is that each of the elements would have to
include, in the specification, those attributes (in the case above,
"name" and "size") common to all entries. That doesn't seem ideal.

2) Another solution I can think of, would be to nest specific
information inside a general element, like this:

<entry name="something" size="3">
<greenentry greensetting1="x" greensetting2="y" />
<entry name="something" size="3">
<redentry redsetting1="x" redsetting2="y" />

None of these approaches seem ideal to me. I would appreciate hearing
any suggestions or recommendations. Have I missed some solution? How
would you do it?
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
A HashMap isn't storing all of the entries. Stryder Java 14 12-10-2012 08:35 PM
Picking X random entries from linked list of Y entries Don Bruder C Programming 3 08-03-2010 09:10 AM
REGULAR EXPRESSIONS - identify specific entries as INVALID Skinnerfritz ASP .Net 5 06-20-2008 07:27 PM
storing pointer vs storing object toton C++ 11 10-13-2006 11:08 AM
Tying up Port Login table entries with Port Table Entries in CISCO SNMP John Ramsden Cisco 0 07-24-2004 04:03 PM