Well, we've bought Whizlabs XML Simulator. I run diagnostic exam, and something went wrong. Some questions don't make any sense, and some seemed to be incorrect. Guys, we pay you money! The money for the tests, not for this nice look & feel! Later i read some another complaints about Whizlabs, and that they dont pay to much attention to these complaints. Maybe this forum is a better place. Who knows. Let's look at their "sample questions" article at http://www.whizlabs.com/articles/xml-questions.html:
Question 3: Which of the following DTDs will successfully validate the XML document below? <root> <root1/> <root2> root2 data </root2> <root3> root3 data </root3> <root3/> </root>
one of the choices (marked as incorrect one, and it is true) B. <!ELEMENT root1 (#PCDATA)> <!ELEMENT root2 (#PCDATA)> <!ELEMENT root3 (#PCDATA)> <!ELEMENT root4 (#PCDATA)> <!ELEMENT root (root1+,root2+,root3?)+>
But the description is wrong! "Choice B is incorrect since root4 is not a part of the given XML document, and as per the DTD, at least one instance of the root4 element must be present in any XML document that conforms to the DTD."
In fact, choice B is incorrect because of incorrect number of root3 elements in the source document. Agree?
Ok, that's all for now. I will post some more later, just to let the people know
Hey buddy! Whats wrong with the DTD? It seems fine to me. The element root4 is defined in the DTD but its not specified in the 'root' element as a child. So, it shouldn't be there in the xml source. The definition of the 'root' element has (root1+, root2+, root3?)+. So, there can be 1 root1, 1 root2 and 1 root3. But since this whole set can be repeated, the 2nd root3 occurance becomes a part of the 2nd set with root1 and root2 omitted (since they're anyway optional). Hope this clears up the fog somewhat. Cheers, Dhananjay