Assume the XML document has no CDATA sections, PIs, comments, or DOCTYPE. 1. You are shown just a slice of an XML document: > some text (possibly whitespace) not containing the less than symbol </ That is, you see a greater-than symbol, some text, and then a less-than symbol followed by a forward slash. You are not shown the stuff before > nor the stuff after </ What is it? Does the slice signify an element: the part before > is the start tag, the part after </ is its end tag, and
text is the content of the element? 2. You are shown another slice of an XML document: > whitespace <C C = letter of the alphabet, colon, or underscore. Does that slice signify the end of one element and the start of another element: the part before > is an end tag, the
C in <C is the first character of a start tag, and whitespace separates the end tag from the start tag? 3. Is an end tag always followed by a less-than symbol (possibly with whitespace separating them)? Scroll down to see the answers … 1. You are shown just a slice of an XML document: > some text (possibly whitespace) not containing the less than symbol </ That is, you see a greater-than symbol, some text, and then a less-than symbol followed by a forward slash. You are not shown the stuff before > nor the stuff after </ What is it? Does the slice signify an element: the part before > is the start tag, the part after </ is its end tag, and
text is the content of the element? Answer: It might signify an element (start tag, content, end tag), e.g., <greeting>Hello, world</greeting> But it might not. It might signify an end tag followed by another end tag, e.g., </D> </A> 2. You are shown another slice of an XML document: > whitespace <C C = letter of the alphabet, colon, or underscore. Does that slice signify the end of one element and the start of another element: the part before > is an end tag, the
C in <C is the first character of a start tag, and whitespace separates the end tag from the start tag? Answer: It might signify the end of one element and the start of another element (with some whitespace between them), e.g., </book> <magazine> But it might not. It might signify an element embedded in another element (with some whitespace between them), e.g., <document> <paragraph> 3. Is an end tag always followed by a less-than symbol (possibly with whitespace separating them)? Answer: Yes, with one exception: the end tag of the root element is not followed by a less-than symbol. |