org.apache.xalan.xsltc.compiler
Class Parser

java.lang.Object
  |
  +--org.apache.xalan.xsltc.compiler.Parser

public class Parser
extends java.lang.Object
implements Constants, ContentHandler


Constructor Summary
Parser(XSLTC xsltc)
           
 
Method Summary
 void addParameter(org.apache.xalan.xsltc.compiler.Param param)
           
 void addVariable(org.apache.xalan.xsltc.compiler.Variable var)
           
 void characters(char[] ch, int start, int length)
          SAX2: Receive notification of character data.
 void createAST(Stylesheet stylesheet)
          Instanciates a SAX2 parser and generate the AST from the input.
 boolean elementSupported(java.lang.String namespace, java.lang.String localName)
           
 void endDocument()
          SAX2: Receive notification of the end of a document.
 void endElement(java.lang.String uri, java.lang.String localname, java.lang.String qname)
          SAX2: Receive notification of the end of an element.
 void endPrefixMapping(java.lang.String prefix)
          SAX2: End the scope of a prefix-URI Namespace mapping.
 boolean errorsFound()
          Returns true if there were any errors during compilation
 boolean functionSupported(java.lang.String fname)
           
 int getCurrentImportPrecedence()
           
 Stylesheet getCurrentStylesheet()
           
 SyntaxTreeNode getDocumentRoot()
           
 java.util.Vector getErrors()
           
 org.apache.xalan.xsltc.compiler.QName getExcludeResultPrefixes()
           
 org.apache.xalan.xsltc.compiler.QName getExtensionElementPrefixes()
           
 int getNextImportPrecedence()
           
 org.apache.xalan.xsltc.compiler.Output getOutput()
           
 java.util.Properties getOutputProperties()
           
 org.apache.xalan.xsltc.compiler.QName getQName(org.apache.xalan.xsltc.compiler.QName scope, org.apache.xalan.xsltc.compiler.QName name)
           
 org.apache.xalan.xsltc.compiler.QName getQName(java.lang.String stringRep)
           
 org.apache.xalan.xsltc.compiler.QName getQName(java.lang.String stringRep, boolean reportError)
           
 org.apache.xalan.xsltc.compiler.QName getQName(java.lang.String scope, java.lang.String name)
           
 org.apache.xalan.xsltc.compiler.QName getQName(java.lang.String namespace, java.lang.String prefix, java.lang.String localname)
           
 org.apache.xalan.xsltc.compiler.QName getQNameIgnoreDefaultNs(java.lang.String stringRep)
           
 org.apache.xalan.xsltc.compiler.QName getQNameSafe(java.lang.String stringRep)
           
 org.apache.xalan.xsltc.compiler.SymbolTable getSymbolTable()
           
 Template getTemplate()
           
 int getTemplateIndex()
           
 Stylesheet getTopLevelStylesheet()
           
 org.apache.xalan.xsltc.compiler.QName getUseAttributeSets()
           
 java.util.Vector getWarnings()
           
 XSLTC getXSLTC()
           
 void ignorableWhitespace(char[] ch, int start, int length)
          IGNORED - all ignorable whitespace is ignored
 void init()
           
 org.apache.xalan.xsltc.compiler.VariableBase lookupVariable(org.apache.xalan.xsltc.compiler.QName name)
           
 SyntaxTreeNode makeInstance(java.lang.String uri, java.lang.String prefix, java.lang.String local, Attributes attributes)
           
 Stylesheet makeStylesheet(SyntaxTreeNode element)
          Create an instance of the Stylesheet class, and then parse, typecheck and compile the instance.
 SyntaxTreeNode parse(InputSource input)
          Parses a stylesheet and builds the internal abstract syntax tree
 SyntaxTreeNode parse(XMLReader reader, InputSource input)
          Parses a stylesheet and builds the internal abstract syntax tree
 org.apache.xalan.xsltc.compiler.Expression parseExpression(SyntaxTreeNode parent, java.lang.String exp)
          Parse an XPath expression:
 org.apache.xalan.xsltc.compiler.Expression parseExpression(SyntaxTreeNode parent, java.lang.String attr, java.lang.String def)
          Parse an XPath expression:
 Pattern parsePattern(SyntaxTreeNode parent, java.lang.String pattern)
          Parse an XPath pattern:
 Pattern parsePattern(SyntaxTreeNode parent, java.lang.String attr, java.lang.String def)
          Parse an XPath pattern:
 void printErrors()
          Prints all compile-time errors
 void printWarnings()
          Prints all compile-time warnings
 void processingInstruction(java.lang.String name, java.lang.String value)
          SAX2: Receive notification of a processing instruction.
 void removeVariable(org.apache.xalan.xsltc.compiler.QName name)
           
 void reportError(int category, ErrorMsg error)
          Common error/warning message handler
 void setCurrentStylesheet(Stylesheet stylesheet)
           
 void setDocumentLocator(Locator locator)
          Store the document locator to later retrieve line numbers of all elements from the stylesheet
 void setOutput(org.apache.xalan.xsltc.compiler.Output output)
           
 void setTemplate(Template template)
           
 void setXSLTC(XSLTC xsltc)
           
 void skippedEntity(java.lang.String name)
          IGNORED - we do not have to do anything with skipped entities
 void startDocument()
          SAX2: Receive notification of the beginning of a document.
 void startElement(java.lang.String uri, java.lang.String localname, java.lang.String qname, Attributes attributes)
          SAX2: Receive notification of the beginning of an element.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          SAX2: Begin the scope of a prefix-URI Namespace mapping.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser(XSLTC xsltc)
Method Detail

init

public void init()

setOutput

public void setOutput(org.apache.xalan.xsltc.compiler.Output output)

getOutput

public org.apache.xalan.xsltc.compiler.Output getOutput()

getOutputProperties

public java.util.Properties getOutputProperties()

addVariable

public void addVariable(org.apache.xalan.xsltc.compiler.Variable var)

addParameter

public void addParameter(org.apache.xalan.xsltc.compiler.Param param)

removeVariable

public void removeVariable(org.apache.xalan.xsltc.compiler.QName name)

lookupVariable

public org.apache.xalan.xsltc.compiler.VariableBase lookupVariable(org.apache.xalan.xsltc.compiler.QName name)

setXSLTC

public void setXSLTC(XSLTC xsltc)

getXSLTC

public XSLTC getXSLTC()

getCurrentImportPrecedence

public int getCurrentImportPrecedence()

getNextImportPrecedence

public int getNextImportPrecedence()

setCurrentStylesheet

public void setCurrentStylesheet(Stylesheet stylesheet)

getCurrentStylesheet

public Stylesheet getCurrentStylesheet()

getTopLevelStylesheet

public Stylesheet getTopLevelStylesheet()

getQNameSafe

public org.apache.xalan.xsltc.compiler.QName getQNameSafe(java.lang.String stringRep)

getQName

public org.apache.xalan.xsltc.compiler.QName getQName(java.lang.String stringRep)

getQNameIgnoreDefaultNs

public org.apache.xalan.xsltc.compiler.QName getQNameIgnoreDefaultNs(java.lang.String stringRep)

getQName

public org.apache.xalan.xsltc.compiler.QName getQName(java.lang.String stringRep,
                                                      boolean reportError)

getQName

public org.apache.xalan.xsltc.compiler.QName getQName(java.lang.String namespace,
                                                      java.lang.String prefix,
                                                      java.lang.String localname)

getQName

public org.apache.xalan.xsltc.compiler.QName getQName(java.lang.String scope,
                                                      java.lang.String name)

getQName

public org.apache.xalan.xsltc.compiler.QName getQName(org.apache.xalan.xsltc.compiler.QName scope,
                                                      org.apache.xalan.xsltc.compiler.QName name)

getUseAttributeSets

public org.apache.xalan.xsltc.compiler.QName getUseAttributeSets()

getExtensionElementPrefixes

public org.apache.xalan.xsltc.compiler.QName getExtensionElementPrefixes()

getExcludeResultPrefixes

public org.apache.xalan.xsltc.compiler.QName getExcludeResultPrefixes()

makeStylesheet

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

createAST

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

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

getDocumentRoot

public SyntaxTreeNode getDocumentRoot()

elementSupported

public boolean elementSupported(java.lang.String namespace,
                                java.lang.String localName)

functionSupported

public boolean functionSupported(java.lang.String fname)

getSymbolTable

public org.apache.xalan.xsltc.compiler.SymbolTable getSymbolTable()

getTemplate

public Template getTemplate()

setTemplate

public void setTemplate(Template template)

getTemplateIndex

public int getTemplateIndex()

makeInstance

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

parseExpression

public org.apache.xalan.xsltc.compiler.Expression parseExpression(SyntaxTreeNode parent,
                                                                  java.lang.String exp)
Parse an XPath expression:

parseExpression

public org.apache.xalan.xsltc.compiler.Expression parseExpression(SyntaxTreeNode parent,
                                                                  java.lang.String attr,
                                                                  java.lang.String def)
Parse an XPath expression:

parsePattern

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

parsePattern

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

errorsFound

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

printErrors

public void printErrors()
Prints all compile-time errors

printWarnings

public void printWarnings()
Prints all compile-time warnings

reportError

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

getErrors

public java.util.Vector getErrors()

getWarnings

public java.util.Vector getWarnings()

startDocument

public void startDocument()
SAX2: Receive notification of the beginning of a document.
Specified by:
startDocument in interface ContentHandler

endDocument

public void endDocument()
SAX2: Receive notification of the end of a document.
Specified by:
endDocument in interface ContentHandler

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
SAX2: Begin the scope of a prefix-URI Namespace mapping. This has to be passed on to the symbol table!
Specified by:
startPrefixMapping in interface ContentHandler

endPrefixMapping

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

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localname,
                         java.lang.String qname,
                         Attributes attributes)
                  throws SAXException
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
Specified by:
startElement in interface ContentHandler

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localname,
                       java.lang.String qname)
SAX2: Receive notification of the end of an element.
Specified by:
endElement in interface ContentHandler

characters

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

processingInstruction

public void processingInstruction(java.lang.String name,
                                  java.lang.String value)
SAX2: Receive notification of a processing instruction. These require special handling for stylesheet PIs.
Specified by:
processingInstruction in interface ContentHandler

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
IGNORED - all ignorable whitespace is ignored
Specified by:
ignorableWhitespace in interface ContentHandler

skippedEntity

public void skippedEntity(java.lang.String name)
IGNORED - we do not have to do anything with skipped entities
Specified by:
skippedEntity in interface ContentHandler

setDocumentLocator

public void setDocumentLocator(Locator locator)
Store the document locator to later retrieve line numbers of all elements from the stylesheet
Specified by:
setDocumentLocator in interface ContentHandler


Copyright © 2003 Apache XML Project. All Rights Reserved.