In the example you indicated, the difference is subtle, however, two examples actually represent completely different things :
- The second example is a document with a title and many pages.
- The first example, however, has a document with a title and a set of pages
As I said, in your example the difference is redundant and therefore easy to miss, so instead consider the following minor variations:
<document> <title>...</title> <contents> <page>...</page> <page>...</page> </contents> <chapter name="chapterName"> <page>...</page> <page>...</page> </chapter> <index> <page>...</page> <page>...</page> </index> </document>
In this case, the document contains many collections of pages. (Of course, some may argue that you could have presented it differently the same way):
<document> <title>...</title> <page section="contents">...</page> <page section="chapter1">...</page> <page section="index">...</page> </document>
However, you would have to change the page element, in the example above, I would say it is worse (why should the page know what it contains?)
Another subtle consideration is that often ordering elements means something:
<document> <page>...</page> <title>...</title> <page>...</page> <page>...</page> </document>
In this example, we have (for some reason) a page in front of the heading - obviously not possible with collections. Another consideration is that each collection may also (for example) have a title .
My point is that they represent different things - in fact, this is not the case when pro vs is so suitable for choosing the format that most closely matches your data model.
Justin
source share