XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] XML Quiz

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@mitre.org> 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.




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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS