Schema design: Loose and repeating vs rigid?

Harry4711

New Member
Apologies if this question is too open ended, and would be better asked somewhere else.I'm currently in discussions about schema design for XML schemas representing sets of questionnaires. The questionnaires are reasonably similar, and contain questions which have a few attributes:
  • Question unique ID
  • Question title
  • Question answer type (text, numeric, date etc.)
  • Answer value
We capture answers to the questionnaires through a website, and now need to send them to other parties via XML messages. I am wondering about the pros and cons of sending XML documents representing filled out questionnaires in:[*]A 'repeating and flexible' format like this:\[code\]<Questionnaire> <Questions> <Question> <QuestionId>1234</QuestionId> <Name>Interviewee</Name> <Answer>Joe Bloggs</Answer> </Question> <Question> <QuestionId>1235</QuestionId> <Name>Date of birth</Name> <Answer>1980-03-15</Answer> </Question> ... </Questions></Questionnaire>\[/code\][*]A more rigid format:\[code\]<Questionnaire> <Interviewee>Joe Bloggs</Interviewee> <DateOfBirth>1980-03-15</Answer> ...</Questionnaire>\[/code\]There are few enough questionnaires that creating a separate XSD each time a new one was produced probably wouldn't cause too large a headache.My thoughts are that the second would be much easier to validate, and as the questions have types these would map nicely to schema data types. However the first would naturally be easier to produce from our underlying representation of the questions when we capture responses via the website.Are there any general best practices for these kind of design decisions, or an obvious reason why one approach would cause fewer headaches than the other, or does this really just depend on the particular set of data being represented and how it will be processed?
 
Back
Top