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. Advertising

  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. 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. P
    Replies:
    1
    Views:
    1,138
    Joe Kesselman
    Jul 7, 2006
  2. Ultrus
    Replies:
    3
    Views:
    361
    Stefan Behnel
    Jul 9, 2007
  3. Ultrus
    Replies:
    4
    Views:
    2,503
    Stefan Behnel
    Aug 30, 2007
  4. Ramon F Herrera
    Replies:
    10
    Views:
    1,245
    Simon Slavin
    Dec 22, 2007
  5. Chris Seberino
    Replies:
    3
    Views:
    729
    Stefan Behnel
    Jun 12, 2009
Loading...

Share This Page