[Home] [By Thread] [By Date] [Recent Entries]

  • From: Michael Kay <mike@s...>
  • To: Roger L Costello <costello@m...>
  • Date: Fri, 28 Jan 2022 00:14:36 +0000

You've overlooked that the ">" (in (1) and (2) might simply be an ordinary character in text. ">" doesn't need to be escaped unless it's part of a "]]>" sequence.

In (3) it's not clear what you mean by "followed", but obviously in <p>Mixed <i>content</i> documents</p> the closing i tag is not immediately followed by "<".

Michael Kay
Saxonica

On 27 Jan 2022, at 23:58, Roger L Costello <costello@m...> wrote:

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.



  • References:
    • XML Quiz
      • From: Roger L Costello <costello@m...>

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member