apache > cocoon
 
Font size:      

Parser Transformer (2.1 legacy document)

Warning
This document was copied as is from the Cocoon 2.1 documentation, but has not yet been fully reviewed or moved to its new home.

Parser Transformer

The parser transformer builds a syntax tree of a list of lexemes (tokens), by using a grammar file.

  • Name: parser
  • Class: org.apache.cocoon.transformation.ParserTransformer
  • Cacheable: yes - uses the last modification date of the grammar document for validation.

The parser uses the following elements from the SAX stream, and replaces them through a syntax tree.

<lexemes xmlns="http://chaperon.sourceforge.net/schema/lexemes/1.0">
 <lexeme symbol="word" text="..."/>
 <lexeme symbol="word" text="..."/>
 <lexeme symbol="word" text="..."/>
 <lexeme symbol="punctation" text="..."/>
</lexemes>

The parser transformer will replace those elements with a syntax tree.

<paragraph xmlns="http://chaperon.sourceforge.net/schema/syntaxtree/1.0">
 <sentence>
  <word>...</word>
  <word>...</word>
  <word>...</word>
  <punctation>...</punctation>
 </sentence>
</paragraph>

A detailed explanation of function and the grammar format can be found at Chaperon.

Comments

add your comments