XML Schema Design

  • Thread starter Thread starter POB
  • Start date Start date

POB

POB

Soldato
Joined
27 May 2003
Posts
5,948
Location
Its a Small World
Hi.

I'm trying to design an XML Schema for something a WebService returns.

Which would be better when creating child elemtents:

Code:
<book>
          <chapters>
                         <chapter>
                         <chapter>
          </chapters>
</book>

Or would

Code:
<book>
         <chapter>
         <chapter>
</book>


In the example each chapter could also have multiple children.

The chapters section would just be there to hold the chapters, just trying to work out if this makes things easier or harder for people to understand.

There could be about three further levels each with groups below the chapters, so the XML could get a lot deeper by adding the extra group holders.

Thanks for any help / opions.
 
Within groups.

That way when you want to add another element or elements under <book> that aren't chapters, it's better organized and more easily able to separate the book's inner content from other information (like <Authors> or <Editors> or <Reviewers> or <Editions> or <Formats> etc.).

If you had some or all or more than those all under the <book> parent element, it would then be the easier option to work with, and since you already started off correctly, you wouldn't have to do any data or code reworking to accomodate the expansions once you hit the need to restructure it.
 
Back
Top Bottom