org.apache.xalan.xsltc.compiler

Class Parser

public class Parser extends Object implements Constants, ContentHandler

Author: Jacek Ambroziak Santiago Pericas-Geertsen G. Todd Miller Morten Jorgensen Erwin Bolwidt

Constructor Summary
Parser(XSLTC xsltc)
Method Summary
voidaddParameter(Param param)
voidaddVariable(Variable var)
voidcharacters(char[] ch, int start, int length)
SAX2: Receive notification of character data.
voidcreateAST(Stylesheet stylesheet)
Instanciates a SAX2 parser and generate the AST from the input.
booleanelementSupported(String namespace, String localName)
voidendDocument()
SAX2: Receive notification of the end of a document.
voidendElement(String uri, String localname, String qname)
SAX2: Receive notification of the end of an element.
voidendPrefixMapping(String prefix)
SAX2: End the scope of a prefix-URI Namespace mapping.
booleanerrorsFound()
Returns true if there were any errors during compilation
booleanfunctionSupported(String fname)
intgetCurrentImportPrecedence()
StylesheetgetCurrentStylesheet()
SyntaxTreeNodegetDocumentRoot()
VectorgetErrors()
QNamegetExcludeResultPrefixes()
QNamegetExtensionElementPrefixes()
intgetNextImportPrecedence()
OutputgetOutput()
PropertiesgetOutputProperties()
QNamegetQName(String stringRep)
QNamegetQName(String stringRep, boolean reportError)
QNamegetQName(String namespace, String prefix, String localname)
QNamegetQName(String scope, String name)
QNamegetQName(QName scope, QName name)
QNamegetQNameIgnoreDefaultNs(String stringRep)
QNamegetQNameSafe(String stringRep)
SymbolTablegetSymbolTable()
TemplategetTemplate()
intgetTemplateIndex()
StylesheetgetTopLevelStylesheet()
QNamegetUseAttributeSets()
VectorgetWarnings()
XSLTCgetXSLTC()
voidignorableWhitespace(char[] ch, int start, int length)
IGNORED - all ignorable whitespace is ignored
voidinit()
VariableBaselookupVariable(QName name)
SyntaxTreeNodemakeInstance(String uri, String prefix, String local, Attributes attributes)
StylesheetmakeStylesheet(SyntaxTreeNode element)
Create an instance of the Stylesheet class, and then parse, typecheck and compile the instance.
SyntaxTreeNodeparse(XMLReader reader, InputSource input)
Parses a stylesheet and builds the internal abstract syntax tree
SyntaxTreeNodeparse(InputSource input)
Parses a stylesheet and builds the internal abstract syntax tree
ExpressionparseExpression(SyntaxTreeNode parent, String exp)
Parse an XPath expression:
ExpressionparseExpression(SyntaxTreeNode parent, String attr, String def)
Parse an XPath expression:
PatternparsePattern(SyntaxTreeNode parent, String pattern)
Parse an XPath pattern:
PatternparsePattern(SyntaxTreeNode parent, String attr, String def)
Parse an XPath pattern:
voidprintErrors()
Prints all compile-time errors
voidprintWarnings()
Prints all compile-time warnings
voidprocessingInstruction(String name, String value)
SAX2: Receive notification of a processing instruction.
voidremoveVariable(QName name)
voidreportError(int category, ErrorMsg error)
Common error/warning message handler
voidsetCurrentStylesheet(Stylesheet stylesheet)
voidsetDocumentLocator(Locator locator)
Store the document locator to later retrieve line numbers of all elements from the stylesheet
voidsetOutput(Output output)
voidsetTemplate(Template template)
voidsetXSLTC(XSLTC xsltc)
voidskippedEntity(String name)
IGNORED - we do not have to do anything with skipped entities
voidstartDocument()
SAX2: Receive notification of the beginning of a document.
voidstartElement(String uri, String localname, String qname, Attributes attributes)
SAX2: Receive notification of the beginning of an element.
voidstartPrefixMapping(String prefix, String uri)
SAX2: Begin the scope of a prefix-URI Namespace mapping.

Constructor Detail

Parser

public Parser(XSLTC xsltc)

Method Detail

addParameter

public void addParameter(Param param)

addVariable

public void addVariable(Variable var)

characters

public void characters(char[] ch, int start, int length)
SAX2: Receive notification of character data.

createAST

public void createAST(Stylesheet stylesheet)
Instanciates a SAX2 parser and generate the AST from the input.

elementSupported

public boolean elementSupported(String namespace, String localName)

endDocument

public void endDocument()
SAX2: Receive notification of the end of a document.

endElement

public void endElement(String uri, String localname, String qname)
SAX2: Receive notification of the end of an element.

endPrefixMapping

public void endPrefixMapping(String prefix)
SAX2: End the scope of a prefix-URI Namespace mapping. This has to be passed on to the symbol table!

errorsFound

public boolean errorsFound()
Returns true if there were any errors during compilation

functionSupported

public boolean functionSupported(String fname)

getCurrentImportPrecedence

public int getCurrentImportPrecedence()

getCurrentStylesheet

public Stylesheet getCurrentStylesheet()

getDocumentRoot

public SyntaxTreeNode getDocumentRoot()

getErrors

public Vector getErrors()

getExcludeResultPrefixes

public QName getExcludeResultPrefixes()

getExtensionElementPrefixes

public QName getExtensionElementPrefixes()

getNextImportPrecedence

public int getNextImportPrecedence()

getOutput

public Output getOutput()

getOutputProperties

public Properties getOutputProperties()

getQName

public QName getQName(String stringRep)

getQName

public QName getQName(String stringRep, boolean reportError)

getQName

public QName getQName(String namespace, String prefix, String localname)

getQName

public QName getQName(String scope, String name)

getQName

public QName getQName(QName scope, QName name)

getQNameIgnoreDefaultNs

public QName getQNameIgnoreDefaultNs(String stringRep)

getQNameSafe

public QName getQNameSafe(String stringRep)

getSymbolTable

public SymbolTable getSymbolTable()

getTemplate

public Template getTemplate()

getTemplateIndex

public int getTemplateIndex()

getTopLevelStylesheet

public Stylesheet getTopLevelStylesheet()

getUseAttributeSets

public QName getUseAttributeSets()

getWarnings

public Vector getWarnings()

getXSLTC

public XSLTC getXSLTC()

ignorableWhitespace

public void ignorableWhitespace(char[] ch, int start, int length)
IGNORED - all ignorable whitespace is ignored

init

public void init()

lookupVariable

public VariableBase lookupVariable(QName name)

makeInstance

public SyntaxTreeNode makeInstance(String uri, String prefix, String local, Attributes attributes)

makeStylesheet

public Stylesheet makeStylesheet(SyntaxTreeNode element)
Create an instance of the Stylesheet class, and then parse, typecheck and compile the instance. Must be called after parse().

parse

public SyntaxTreeNode parse(XMLReader reader, InputSource input)
Parses a stylesheet and builds the internal abstract syntax tree

Parameters: reader A SAX2 SAXReader (parser) input A SAX2 InputSource can be passed to a SAX reader

Returns: The root of the abstract syntax tree

parse

public SyntaxTreeNode parse(InputSource input)
Parses a stylesheet and builds the internal abstract syntax tree

Parameters: input A SAX2 InputSource can be passed to a SAX reader

Returns: The root of the abstract syntax tree

parseExpression

public Expression parseExpression(SyntaxTreeNode parent, String exp)
Parse an XPath expression:

Parameters: parent - XSL element where the expression occured exp - textual representation of the expression

parseExpression

public Expression parseExpression(SyntaxTreeNode parent, String attr, String def)
Parse an XPath expression:

Parameters: parent - XSL element where the expression occured attr - name of this element's attribute to get expression from def - default expression (if the attribute was not found)

parsePattern

public Pattern parsePattern(SyntaxTreeNode parent, String pattern)
Parse an XPath pattern:

Parameters: parent - XSL element where the pattern occured pattern - textual representation of the pattern

parsePattern

public Pattern parsePattern(SyntaxTreeNode parent, String attr, String def)
Parse an XPath pattern:

Parameters: parent - XSL element where the pattern occured attr - name of this element's attribute to get pattern from def - default pattern (if the attribute was not found)

printErrors

public void printErrors()
Prints all compile-time errors

printWarnings

public void printWarnings()
Prints all compile-time warnings

processingInstruction

public void processingInstruction(String name, String value)
SAX2: Receive notification of a processing instruction. These require special handling for stylesheet PIs.

removeVariable

public void removeVariable(QName name)

reportError

public void reportError(int category, ErrorMsg error)
Common error/warning message handler

setCurrentStylesheet

public void setCurrentStylesheet(Stylesheet stylesheet)

setDocumentLocator

public void setDocumentLocator(Locator locator)
Store the document locator to later retrieve line numbers of all elements from the stylesheet

setOutput

public void setOutput(Output output)

setTemplate

public void setTemplate(Template template)

setXSLTC

public void setXSLTC(XSLTC xsltc)

skippedEntity

public void skippedEntity(String name)
IGNORED - we do not have to do anything with skipped entities

startDocument

public void startDocument()
SAX2: Receive notification of the beginning of a document.

startElement

public void startElement(String uri, String localname, String qname, Attributes attributes)
SAX2: Receive notification of the beginning of an element. The parser may re-use the attribute list that we're passed so we clone the attributes in our own Attributes implementation

startPrefixMapping

public void startPrefixMapping(String prefix, String uri)
SAX2: Begin the scope of a prefix-URI Namespace mapping. This has to be passed on to the symbol table!
Copyright B) 2006 Apache XML Project. All Rights Reserved.