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

  2. Gieke

    Pavel Lepin Guest

    It is definitely allowed.
    This is by no means necessary, but a good practice in my
    opinion. Well-structured documents are much easier to
    process.
     
    Pavel Lepin, Jul 25, 2008
    #2
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.