is this good practice ?

Discussion in 'XML' started by Gieke, Jul 24, 2008.

  1. Gieke

    Gieke Guest

    hi group,
    I'm new here. Worked a bit with xml over the years, and now having a
    discussion if something is allowed or not, or good practice or not.
    It's about repeating a tag within a tag that contains also other things.
    an example to make it clear:

    <basicFlightInfo>
    <flightDetails>
    <departureDate>011008</departureDate>
    <departureTime>0834</departureTime>
    </flightDetails>
    <departureLocation>
    <cityAirport>ZWE</cityAirport>
    </departureLocation>
    <productTypeDetail>D</productTypeDetail>
    <productTypeDetail>702</productTypeDetail>
    <productTypeDetail>ET</productTypeDetail>
    </basicFlightInfo>

    Is it allowed to repeat the <productTypeDetail> ?
    Would it be better to nest it in another tag, like :
    <details>
    <productTypeDetail>D</productTypeDetail>
    <productTypeDetail>702</productTypeDetail>
    <productTypeDetail>ET</productTypeDetail>
    </details>

    Or is it necessary to do so ?

    thanks for advice !

    Guido
     
    Gieke, Jul 24, 2008
    #1
    1. Advertising

  2. Gieke

    Pavel Lepin Guest

    Gieke <> wrote in
    <4888983e$0$1604$>:
    > It's about repeating a tag within a tag that contains also
    > other things. an example to make it clear:
    >
    > <basicFlightInfo>
    > <flightDetails>
    > <departureDate>011008</departureDate>
    > <departureTime>0834</departureTime>
    > </flightDetails>
    > <departureLocation>
    > <cityAirport>ZWE</cityAirport>
    > </departureLocation>
    > <productTypeDetail>D</productTypeDetail>
    > <productTypeDetail>702</productTypeDetail>
    > <productTypeDetail>ET</productTypeDetail>
    > </basicFlightInfo>
    >
    > Is it allowed to repeat the <productTypeDetail> ?


    It is definitely allowed.

    > Would it be better to nest it in another tag, like :
    > <details>
    > <productTypeDetail>D</productTypeDetail>
    > <productTypeDetail>702</productTypeDetail>
    > <productTypeDetail>ET</productTypeDetail>
    > </details>
    >
    > Or is it necessary to do so ?


    This is by no means necessary, but a good practice in my
    opinion. Well-structured documents are much easier to
    process.

    --
    Waterfall - One Process To Rule Them All
     
    Pavel Lepin, Jul 25, 2008
    #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. Alex Young

    Good practice for signal types

    Alex Young, Oct 11, 2004, in forum: VHDL
    Replies:
    3
    Views:
    2,831
    Alan Fitch
    Oct 12, 2004
  2. Ashe Sjedic

    Profile good practice

    Ashe Sjedic, Feb 2, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    310
    Ashe Sjedic
    Feb 2, 2006
  3. Matt
    Replies:
    4
    Views:
    1,389
    Roedy Green
    Jun 23, 2004
  4. vlsidesign
    Replies:
    26
    Views:
    997
    Keith Thompson
    Jan 2, 2007
  5. SM
    Replies:
    9
    Views:
    510
Loading...

Share This Page