Storing general-purpose and specific entries

Discussion in 'XML' started by Robert Bj?rn, Jun 1, 2004.

  1. Robert Bj?rn

    Robert Bj?rn Guest

    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"
    greensetting2="y">
    <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>
    <entry name="something" size="3">
    <redentry redsetting1="x" redsetting2="y" />
    </entry>

    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?
     
    Robert Bj?rn, Jun 1, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maarten van Reeuwijk

    Looking for very simple general purpose tokenizer

    Maarten van Reeuwijk, Jan 19, 2004, in forum: Python
    Replies:
    6
    Views:
    394
  2. Ron Stephens
    Replies:
    23
    Views:
    2,944
    Ron Stephens
    Apr 12, 2004
  3. Donald Newcomb

    NEWB: General purpose list iteration?

    Donald Newcomb, Aug 12, 2005, in forum: Python
    Replies:
    4
    Views:
    324
    Donald Newcomb
    Aug 12, 2005
  4. John Machin
    Replies:
    6
    Views:
    400
    metaperl
    Aug 16, 2006
  5. Don Bruder
    Replies:
    3
    Views:
    1,005
    spikeysnack
    Aug 3, 2010
Loading...

Share This Page