go to previous page   go to home page   go to next page

What are the tokens in the following section of a HTML file?

<h1>Important Heading</h1>
<p>
<span style="color:blue">Many words</span>
</p>

Answer:

<h1>
Important 
Heading
</h1>
<p>
<span style="color:blue">
Many 
words
</span>
</p>


Example Application

Depending on the application, the tokens might be different than those above. Say that our application is a HTML text formatter (perhaps part of a web browser). For this example application the tokens are:

A word token can be delimited by a character from a tag or by white space. For example, in the following:

<h1>Important Heading</h1>

The word token "Heading" is delimited on the right by <.


QUESTION 2:

Pretend that a scanner is building the token "Heading" character by character. When has it reached the end of the token?