Re: Nested XML Elements - Legal?

Discussion in 'XML' started by Andy Fish, Aug 18, 2003.

  1. Andy Fish

    Andy Fish Guest

    You're fine. There is no confusion at all with having the same element name
    in different places within a piece of XML.

    obviously if you were using it to represent different things it would be a
    bad idea, but as you're representing a hierarchy of similar objects, this is
    exactly what I would do.

    "PaulC" <> wrote in message
    news:Xns93DB86A6B1395h6ygi756f4EAF@195.8.68.218...
    > Just wondering if the below is legal XML, as I want to use it for the
    > configuration file of one of my applications.
    >
    > -0-0-0 Snip 0-0-0-
    >
    > <menu caption = "File">
    > <menu caption = "Open">
    > <menu item = "Process" />
    > <menu item = "File" />
    > </menu>
    > <menu item = "Save" />
    > <menu item = "Exit" />
    > </menu>
    >
    > -0-0-0 Snip 0-0-0-
    >
    > The idea of the above is create a menu entitled "File" where the "Open"
    > item has subitems. The question is, can elements be nested in this way, or
    > does each element have to have a different name than the one it's inside ?
     
    Andy Fish, Aug 18, 2003
    #1
    1. Advertisements

  2. Andy Fish

    PaulC Guest

    Thanks.

    "Andy Fish" <> wrote in
    news:vL40b.322$:

    > You're fine. There is no confusion at all with having the same element
    > name in different places within a piece of XML.
    >
    > obviously if you were using it to represent different things it would
    > be a bad idea, but as you're representing a hierarchy of similar
    > objects, this is exactly what I would do.
     
    PaulC, Aug 18, 2003
    #2
    1. Advertisements

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. Peter C. Chapin
    Replies:
    4
    Views:
    2,172
    Peter C. Chapin
    Jul 6, 2003
  2. Nice

    legal <xml> tag

    Nice, Aug 21, 2003, in forum: XML
    Replies:
    7
    Views:
    685
    Dimitre Novatchev
    Aug 21, 2003
  3. P
    Replies:
    1
    Views:
    1,361
    Joe Kesselman
    Jul 7, 2006
  4. Ultrus
    Replies:
    3
    Views:
    569
    Stefan Behnel
    Jul 9, 2007
  5. Ultrus
    Replies:
    4
    Views:
    4,297
    Stefan Behnel
    Aug 30, 2007
  6. Ramon F Herrera
    Replies:
    10
    Views:
    1,535
    Simon Slavin
    Dec 22, 2007
  7. Chris Seberino
    Replies:
    3
    Views:
    901
    Stefan Behnel
    Jun 12, 2009
  8. Erik Wasser
    Replies:
    5
    Views:
    816
    Peter J. Holzer
    Mar 5, 2006
Loading...