PPT Slide
private void print_root_start_tag(String s) {
System.out.print("<" + s + ">");
private void print_root_end_tag(String s) {
System.out.print("</" + s + ">");
{Title} { print_root_start_tag("BookCatalogue");
print_start_tag("Title");
print_element_data(yytext());
{Field} { print_start_tag("Field");
print_element_data(yytext());
{Slash} { print_new_line(); }
{LineTerminator} { print_end_tag("Book");
<<EOF>> { print_root_end_tag("BookCatalogue");
At every Title we invoke this method.
However, this method only does the
output the first time it's invoked.
<Title>"My Life and Times"</Title>
<Field>Paul McCartney</Field>
<Field>July, 1998</Field>
<Field-12021-43892</Field>
<Field>McMillin Publishing</Field>
<Title>"Illusions…"</Title>
<Field>Richard Bach</Field>