19) Consider the following rules that have been determined for a set of XML information elements: o Either Title or ShortTitle is required o Title must be followed by either P or Table o ShortTitle must always be followed by P Which content model BEST depicts these rules and provides the greatest flexibility for future changes?
a) ((Title, P) | (Title, Table) | (ShortTitle, P))
I cannot exactly say why, but i answered this to be "c" in one of my practice exams. "c" fits perfectly to the description and i see a little duplication of things in "a". I repeat that i cannot totally justify my decision as to "why not 'a'"
I always considered c) as the best answer, though b) looks fine to me too. There is nothing illegal with c), btw. In fact, all first 3 answers are good. But the question is: "Which content model BEST depicts these rules and provides the greatest flexibility for future changes?" a) doesn't provide flexibility; say, you will need to add LongTitle into requirements, than you will need to add more combinations if using a); I was always trying to select between b) and c). And I still intuitively select c). I'm wondering what others think about this? Now I've got 39 correct out of 44.
I just tried out a short xml file, c) is logically correct. Then yes, c) should be the best answer in terms of flexibility.
Joined: Sep 26, 2002
I'm going to repeat a test and try to make selections as you suggested. Since, now I get 39 correct out 44, it's not difficult to repeat the test and change just that one answer. That should prove, I think.
XML Bible says, It is required that content models in element type declarations be deterministic. This requirement is for compatibility with SGML (which calls deterministic content models "unambiguous"); XML processors built using SGML systems may flag non-deterministic content models as errors. For example, the content model ((b, c) | (b, d)) is non-deterministic, because given an initial b the XML processor cannot know which b in the model is being matched without looking ahead to see which element follows the b. In this case, the two references to b can be collapsed into a single reference, making the model read (b, (c | d)). An initial b now clearly matches only a single name in the content model. The processor doesn't need to look ahead to see what follows; either c or d would be accepted. That is why, c is correct.