Is it better to use nesting or multiple files?
Which is the better approach, to nest, or have multiple files with "IDs" that "link" the different files?
Here are my examples that I am working with:
Multiple files:
- company.xml
- branches.xml
- years.xml
- months.xml
Nested:
- company_nested.xml
First time at XML, 开发者_如何学Cso it could be horribly wrong! (and I am planning to make XSD's as soon as I have some idea of where the structure is going).
Both approaches have their place; it really depends on how the data will be used. Using a single file is great if you're primarily going to process the data with XSLT. If, on the other hand, you're just using XML as a persistence mechanism for an object tree, the separate files let you rewrite just the parts of interest without affecting the whole file.
It depends what you are trying to achieve. Without any knowledge of project requirements or constraints, no one can say whether one design is better than another.
精彩评论