## org.apache.xalan.xsltc.compiler
Class Parser

    java.lang.Object
      org.apache.xalan.xsltc.compiler.Parser

All Implemented Interfaces:
  org.apache.bcel.generic.InstructionConstants, Constants, org.xml.sax.ContentHandler

    public class Parser

extends java.lang.Object
implements Constants, org.xml.sax.ContentHandler

Author:
  Jacek Ambroziak, Santiago Pericas-Geertsen, G. Todd Miller, Morten Jorgensen, Erwin Bolwidt <ejb@klomp.org>

Nested Class Summary

Nested classes/interfaces inherited from interface org.apache.bcel.generic.InstructionConstants
`org.apache.bcel.generic.InstructionConstants.Clinit`

Field Summary

Fields inherited from interface org.apache.xalan.xsltc.compiler.Constants

`ABSOLUTE_ITERATOR, ACC_FINAL, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_SUPER, ADD_ATTRIBUTE, ADD_ATTRIBUTE_SIG, ADD_ITERATOR, ADD_ITERATOR_SIG, ADD_PARAMETER, ADD_PARAMETER_SIG, APPLY_TEMPLATES, ATTR_SET_SIG, ATTRIBUTE_LIST_FIELD, ATTRIBUTE_LIST_IMPL_CLASS, ATTRIBUTE_LIST_IMPL_SIG, ATTRIBUTES_SIG, BASIS_LIBRARY_CLASS, BOOLEAN_CLASS, BOOLEAN_VALUE, BOOLEAN_VALUE_SIG, CACHED_NODE_LIST_ITERATOR_CLASS, CALL_FUNCTION_CLASS, CHARACTERS, CHARACTERS_SIG, CHARACTERSW, CHARACTERSW_SIG, CLEAR_ATTRIBUTES, CLEAR_ATTRIBUTES_SIG, COLLATOR_CLASS, COLLATOR_SIG, COMPILER_PACKAGE, CURRENT_NODE_LIST_FILTER, CURRENT_NODE_LIST_FILTER_SIG, CURRENT_NODE_LIST_ITERATOR, CURRENT_NODE_LIST_ITERATOR_SIG, DEFAULT_NODE_COUNTER, DEFAULT_NODE_COUNTER_SIG, DOCUMENT_PNAME, DOM_ADAPTER_CLASS, DOM_ADAPTER_SIG, DOM_FIELD, DOM_IMPL, DOM_IMPL_CLASS, DOM_IMPL_SIG, DOM_INTF, DOM_INTF_SIG, DOM_PNAME, DOUBLE_CLASS, DOUBLE_SIG, DOUBLE_VALUE, DOUBLE_VALUE_SIG, DUP_FILTERED_ITERATOR, EMPTYATTR_FIELD, EMPTYSTRING, ERROR, FALLBACK_CLASS, FATAL, FILTER_INTERFACE, FILTER_INTERFACE_SIG, FILTER_ITERATOR, FILTER_STEP_ITERATOR, FORMAT_SYMBOLS_FIELD, GET_ATTRIBUTE_VALUE, GET_ATTRIBUTE_VALUE_SIG, GET_CHILDREN, GET_CHILDREN_SIG, GET_ELEMENT_VALUE, GET_ELEMENT_VALUE_SIG, GET_ITERATOR_SIG, GET_NODE_NAME, GET_NODE_NAME_SIG, GET_NODE_TYPE, GET_NODE_TYPE_SIG, GET_NODE_VALUE, GET_NODE_VALUE_ITERATOR, GET_NODE_VALUE_ITERATOR_SIG, GET_NODE_VALUE_SIG, GET_PARAMETER, GET_PARAMETER_SIG, GET_PARENT, GET_PARENT_SIG, GET_TYPED_CHILDREN, GET_TYPED_CHILDREN_SIG, GET_UNPARSED_ENTITY_URI, GET_UNPARSED_ENTITY_URI_SIG, HAS_ATTRIBUTE, HAS_ATTRIBUTE_SIG, HASIDCALL_INDEX, HASIDCALL_INDEX_SIG, INT_VALUE, INT_VALUE_SIG, INTEGER_CLASS, INTEGER_SIG, INTERNAL, INVOKE_METHOD, ITERATOR_FIELD_SIG, ITERATOR_PNAME, KEY_INDEX_CLASS, KEY_INDEX_SIG, LAST_INDEX, LOAD_DOCUMENT_CLASS, LOCALE_CLASS, LOCALE_SIG, MAKE_NODE, MAKE_NODE_LIST, MAKE_NODE_LIST_SIG, MAKE_NODE_LIST_SIG2, MAKE_NODE_SIG, MAKE_NODE_SIG2, MATCHING_ITERATOR, MATH_CLASS, MULTI_DOM_CLASS, MULTI_DOM_SIG, NAMES_INDEX, NAMES_INDEX_SIG, NAMESPACE_FEATURE, NAMESPACE_INDEX, NAMESPACE_INDEX_SIG, NEXT, NEXT_SIG, NEXTID, NODE, NODE_COUNTER, NODE_COUNTER_SIG, NODE_FIELD, NODE_FIELD_SIG, NODE_ITERATOR, NODE_ITERATOR_BASE, NODE_ITERATOR_SIG, NODE_PNAME, NODE_SIG, NODE_SORT_FACTORY, NODE_SORT_FACTORY_SIG, NODE_SORT_RECORD, NODE_SORT_RECORD_SIG, NTH_ITERATOR_CLASS, OBJECT_CLASS, OBJECT_SIG, ORDER_ITERATOR, ORDER_ITERATOR_SIG, OUTPUT_BASE, OUTPUT_HANDLER, OUTPUT_HANDLER_SIG, POP_PARAM_FRAME, POP_PARAM_FRAME_SIG, POSITION_INDEX, PUSH_PARAM_FRAME, PUSH_PARAM_FRAME_SIG, REDIRECT_URI, RESET, RESET_SIG, RTF_INITIAL_SIZE, RUNTIME_NODE_CLASS, RUNTIME_PACKAGE, SAX_IMPL, SAX_IMPL_CLASS, SAX_IMPL_SIG, SET_START_NODE, SET_START_NODE_SIG, SINGLETON_ITERATOR, SORT_ITERATOR, SORT_ITERATOR_SIG, STATIC_CHAR_DATA_FIELD, STATIC_CHAR_DATA_FIELD_SIG, STATIC_NAMES_ARRAY_FIELD, STATIC_NAMESPACE_ARRAY_FIELD, STATIC_TYPES_ARRAY_FIELD, STATIC_URIS_ARRAY_FIELD, STEP_ITERATOR_CLASS, STREAM_XML_OUTPUT, STRING, STRING_BUFFER_CLASS, STRING_BUFFER_SIG, STRING_CLASS, STRING_SIG, STRING_TO_INT, STRING_TO_INT_SIG, STRING_TO_REAL, STRING_TO_REAL_SIG, STRING_VALUE_HANDLER, STRING_VALUE_HANDLER_SIG, STRING_WRITER, STRIP_SPACE, STRIP_SPACE_INTF, STRIP_SPACE_PARAMS, STRIP_SPACE_SIG, TRANSLET_CLASS, TRANSLET_FIELD, TRANSLET_FIELD_SIG, TRANSLET_INTF, TRANSLET_INTF_SIG, TRANSLET_OUTPUT_BASE, TRANSLET_OUTPUT_INTERFACE, TRANSLET_OUTPUT_PNAME, TRANSLET_OUTPUT_SIG, TRANSLET_PNAME, TRANSLET_SIG, TRANSLET_URI, TRANSLET_VERSION_INDEX, TRANSLET_VERSION_INDEX_SIG, TYPES_INDEX, TYPES_INDEX_SIG, UNION_ITERATOR_CLASS, UNION_ITERATOR_SIG, UNSUPPORTED, URIS_INDEX, URIS_INDEX_SIG, WARNING, WRITER_SIG, XHTML_URI, XMLNS_PREFIX, XMLNS_STRING, XMLNS_URI, XSLT_PACKAGE, XSLT_URI`

Fields inherited from interface org.apache.bcel.generic.InstructionConstants

`AALOAD, AASTORE, ACONST_NULL, ALOAD_0, ALOAD_1, ALOAD_2, ARETURN, ARRAYLENGTH, ASTORE_0, ASTORE_1, ASTORE_2, ATHROW, BALOAD, BASTORE, bla, CALOAD, CASTORE, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DMUL, DNEG, DREM, DRETURN, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FMUL, FNEG, FREM, FRETURN, FSUB, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, ILOAD_0, ILOAD_1, ILOAD_2, IMUL, INEG, INSTRUCTIONS, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE_0, ISTORE_1, ISTORE_2, ISUB, IUSHR, IXOR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDIV, LMUL, LNEG, LOR, LREM, LRETURN, LSHL, LSHR, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, NOP, POP, POP2, RETURN, SALOAD, SASTORE, SWAP, THIS`

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, org.xml.sax.Attributes attributes)`
`Stylesheet` `makeStylesheet(SyntaxTreeNode element)` Create an instance of the `Stylesheet` class, and then parse, typecheck and compile the instance.
`SyntaxTreeNode` `parse(org.xml.sax.InputSource input)` Parses a stylesheet and builds the internal abstract syntax tree
`SyntaxTreeNode` `parse(org.xml.sax.XMLReader reader, org.xml.sax.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(org.xml.sax.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, org.xml.sax.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()`.

  Throws:
    `CompilerException`

### createAST

    public void createAST(Stylesheet stylesheet)

  Instanciates a SAX2 parser and generate the AST from the input.

### parse

    public SyntaxTreeNode parse(org.xml.sax.XMLReader reader,
                                org.xml.sax.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(org.xml.sax.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,
                                       org.xml.sax.Attributes attributes)

### parseExpression

    public org.apache.xalan.xsltc.compiler.Expression parseExpression(SyntaxTreeNode parent,
                                                                      java.lang.String exp)

  Parse an XPath expression:

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

### parseExpression

    public org.apache.xalan.xsltc.compiler.Expression parseExpression(SyntaxTreeNode parent,
                                                                      java.lang.String attr,
                                                                      java.lang.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,
                                java.lang.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,
                                java.lang.String attr,
                                java.lang.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)

### 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 `org.xml.sax.ContentHandler`

### endDocument

    public void endDocument()

  SAX2: Receive notification of the end of a document.

  Specified by:
    `endDocument` in interface `org.xml.sax.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 `org.xml.sax.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 `org.xml.sax.ContentHandler`

### startElement

    public void startElement(java.lang.String uri,
                             java.lang.String localname,
                             java.lang.String qname,
                             org.xml.sax.Attributes attributes)
                      throws org.xml.sax.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 `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### 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 `org.xml.sax.ContentHandler`

### characters

    public void characters(char[] ch,
                           int start,
                           int length)

  SAX2: Receive notification of character data.

  Specified by:
    `characters` in interface `org.xml.sax.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 `org.xml.sax.ContentHandler`

### ignorableWhitespace

    public void ignorableWhitespace(char[] ch,
                                    int start,
                                    int length)

  IGNORED - all ignorable whitespace is ignored

  Specified by:
    `ignorableWhitespace` in interface `org.xml.sax.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 `org.xml.sax.ContentHandler`

### setDocumentLocator

    public void setDocumentLocator(org.xml.sax.Locator locator)

  Store the document locator to later retrieve line numbers of all elements from the stylesheet

  Specified by:
    `setDocumentLocator` in interface `org.xml.sax.ContentHandler`

Copyright © 2005 Apache XML Project. All Rights Reserved.