Java Code Examples for com.sun.org.apache.xalan.internal.res.XSLMessages
The following examples show how to use
com.sun.org.apache.xalan.internal.res.XSLMessages.
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: JDKSourceCode1.8 Author: wupeixuan File: VariableStack.java License: MIT License | 6 votes |
/** * Get a local variable or parameter in the current stack frame. * * * @param xctxt The XPath context, which must be passed in order to * lazy evaluate variables. * * @param index Local variable index relative to the current stack * frame bottom. * * @return The value of the variable. * * @throws TransformerException */ public XObject getLocalVariable(XPathContext xctxt, int index) throws TransformerException { index += _currentFrameBottom; XObject val = _stackFrames[index]; if(null == val) throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VARIABLE_ACCESSED_BEFORE_BIND, null), xctxt.getSAXLocator()); // "Variable accessed before it is bound!", xctxt.getSAXLocator()); // Lazy execution of variables. if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE) return (_stackFrames[index] = val.execute(xctxt)); return val; }
Example #2
Source Project: jdk8u60 Author: chenghanpeng File: NodeSet.java License: GNU General Public License v2.0 | 6 votes |
/** * Copy NodeList members into this nodelist, adding in * document order. If a node is null, don't add it. * * @param nodelist List of nodes to be added * @param support The XPath runtime context. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public void addNodesInDocOrder(NodeList nodelist, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); int nChildren = nodelist.getLength(); for (int i = 0; i < nChildren; i++) { Node node = nodelist.item(i); if (null != node) { addNodeInDocOrder(node, support); } } }
Example #3
Source Project: jdk1.8-source-analysis Author: raysonfang File: XObject.java License: Apache License 2.0 | 6 votes |
/** * Tell the user of an error, and probably throw an * exception. * * @param msg Error message to issue * @param args Arguments to use in the message * * @throws javax.xml.transform.TransformerException */ protected void error(String msg, Object[] args) throws javax.xml.transform.TransformerException { String fmsg = XSLMessages.createXPATHMessage(msg, args); // boolean shouldThrow = support.problem(m_support.XPATHPROCESSOR, // m_support.ERROR, // null, // null, fmsg, 0, 0); // if(shouldThrow) { throw new XPathException(fmsg, this); } }
Example #4
Source Project: JDKSourceCode1.8 Author: wupeixuan File: XPath.java License: MIT License | 6 votes |
/** * Warn the user of an problem. * * @param xctxt The XPath runtime context. * @param sourceNode Not used. * @param msg An error msgkey that corresponds to one of the constants found * in {@link com.sun.org.apache.xpath.internal.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. */ public void warn( XPathContext xctxt, int sourceNode, String msg, Object[] args) throws javax.xml.transform.TransformerException { String fmsg = XSLMessages.createXPATHWarning(msg, args); ErrorListener ehandler = xctxt.getErrorListener(); if (null != ehandler) { // TO DO: Need to get stylesheet Locator from here. ehandler.warning(new TransformerException(fmsg, (SAXSourceLocator)xctxt.getSAXLocator())); } }
Example #5
Source Project: TencentKona-8 Author: Tencent File: NodeSet.java License: GNU General Public License v2.0 | 6 votes |
/** * Copy NodeList members into this nodelist, adding in * document order. If a node is null, don't add it. * * @param nodelist List of nodes which should now be referenced by * this NodeSet. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public void addNodes(NodeList nodelist) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null != nodelist) // defensive to fix a bug that Sanjiva reported. { int nChildren = nodelist.getLength(); for (int i = 0; i < nChildren; i++) { Node obj = nodelist.item(i); if (null != obj) { addElement(obj); } } } // checkDups(); }
Example #6
Source Project: jdk8u60 Author: chenghanpeng File: XObject.java License: GNU General Public License v2.0 | 6 votes |
/** * Tell the user of an error, and probably throw an * exception. * * @param msg Error message to issue * @param args Arguments to use in the message * * @throws javax.xml.transform.TransformerException */ protected void error(String msg, Object[] args) throws javax.xml.transform.TransformerException { String fmsg = XSLMessages.createXPATHMessage(msg, args); // boolean shouldThrow = support.problem(m_support.XPATHPROCESSOR, // m_support.ERROR, // null, // null, fmsg, 0, 0); // if(shouldThrow) { throw new XPathException(fmsg, this); } }
Example #7
Source Project: TencentKona-8 Author: Tencent File: VariableStack.java License: GNU General Public License v2.0 | 6 votes |
/** * Get a local variable or parameter in the current stack frame. * * * @param xctxt The XPath context, which must be passed in order to * lazy evaluate variables. * * @param index Local variable index relative to the current stack * frame bottom. * * @return The value of the variable. * * @throws TransformerException */ public XObject getLocalVariable(XPathContext xctxt, int index, boolean destructiveOK) throws TransformerException { index += _currentFrameBottom; XObject val = _stackFrames[index]; if(null == val) throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VARIABLE_ACCESSED_BEFORE_BIND, null), xctxt.getSAXLocator()); // "Variable accessed before it is bound!", xctxt.getSAXLocator()); // Lazy execution of variables. if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE) return (_stackFrames[index] = val.execute(xctxt)); return destructiveOK ? val : val.getFresh(); }
Example #8
Source Project: jdk1.8-source-analysis Author: raysonfang File: NodeSetDTM.java License: Apache License 2.0 | 6 votes |
/** * Copy NodeList members into this nodelist, adding in * document order. Null references are not added. * * @param iterator DTMIterator which yields the nodes to be added. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void addNodes(DTMIterator iterator) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); if (null != iterator) // defensive to fix a bug that Sanjiva reported. { int obj; while (DTM.NULL != (obj = iterator.nextNode())) { addElement(obj); } } // checkDups(); }
Example #9
Source Project: openjdk-jdk8u Author: AdoptOpenJDK File: JAXPExtensionsProvider.java License: GNU General Public License v2.0 | 6 votes |
/** * Is the extension function available? */ public boolean functionAvailable(String ns, String funcName) throws javax.xml.transform.TransformerException { try { if ( funcName == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"Function Name"} ); throw new NullPointerException ( fmsg ); } //Find the XPathFunction corresponding to namespace and funcName javax.xml.namespace.QName myQName = new QName( ns, funcName ); javax.xml.xpath.XPathFunction xpathFunction = resolver.resolveFunction ( myQName, 0 ); if ( xpathFunction == null ) { return false; } return true; } catch ( Exception e ) { return false; } }
Example #10
Source Project: jdk8u60 Author: chenghanpeng File: VariableStack.java License: GNU General Public License v2.0 | 6 votes |
/** * Get a local variable or parameter in the current stack frame. * * * @param xctxt The XPath context, which must be passed in order to * lazy evaluate variables. * * @param index Local variable index relative to the current stack * frame bottom. * * @return The value of the variable. * * @throws TransformerException */ public XObject getLocalVariable(XPathContext xctxt, int index, boolean destructiveOK) throws TransformerException { index += _currentFrameBottom; XObject val = _stackFrames[index]; if(null == val) throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VARIABLE_ACCESSED_BEFORE_BIND, null), xctxt.getSAXLocator()); // "Variable accessed before it is bound!", xctxt.getSAXLocator()); // Lazy execution of variables. if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE) return (_stackFrames[index] = val.execute(xctxt)); return destructiveOK ? val : val.getFresh(); }
Example #11
Source Project: JDKSourceCode1.8 Author: wupeixuan File: XPathParser.java License: MIT License | 6 votes |
/** * Warn the user of a problem. * * @param msg An error msgkey that corresponds to one of the constants found * in {@link com.sun.org.apache.xpath.internal.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. */ void warn(String msg, Object[] args) throws TransformerException { String fmsg = XSLMessages.createXPATHWarning(msg, args); ErrorListener ehandler = this.getErrorListener(); if (null != ehandler) { // TO DO: Need to get stylesheet Locator from here. ehandler.warning(new TransformerException(fmsg, m_sourceLocator)); } else { // Should never happen. System.err.println(fmsg); } }
Example #12
Source Project: jdk1.8-source-analysis Author: raysonfang File: NodeSet.java License: Apache License 2.0 | 6 votes |
/** * Copy NodeList members into this nodelist, adding in * document order. If a node is null, don't add it. * * @param nodelist List of nodes to be added * @param support The XPath runtime context. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public void addNodesInDocOrder(NodeList nodelist, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); int nChildren = nodelist.getLength(); for (int i = 0; i < nChildren; i++) { Node node = nodelist.item(i); if (null != node) { addNodeInDocOrder(node, support); } } }
Example #13
Source Project: TencentKona-8 Author: Tencent File: Compiler.java License: GNU General Public License v2.0 | 6 votes |
/** * Warn the user of an problem. * * @param msg An error msgkey that corresponds to one of the constants found * in {@link com.sun.org.apache.xpath.internal.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. */ public void warn(String msg, Object[] args) throws TransformerException { java.lang.String fmsg = XSLMessages.createXPATHWarning(msg, args); if (null != m_errorHandler) { m_errorHandler.warning(new TransformerException(fmsg, m_locator)); } else { System.out.println(fmsg +"; file "+m_locator.getSystemId() +"; line "+m_locator.getLineNumber() +"; column "+m_locator.getColumnNumber()); } }
Example #14
Source Project: jdk8u60 Author: chenghanpeng File: NodeSet.java License: GNU General Public License v2.0 | 6 votes |
/** * Copy NodeList members into this nodelist, adding in * document order. Null references are not added. * * @param iterator NodeIterator which yields the nodes to be added. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public void addNodes(NodeIterator iterator) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null != iterator) // defensive to fix a bug that Sanjiva reported. { Node obj; while (null != (obj = iterator.nextNode())) { addElement(obj); } } // checkDups(); }
Example #15
Source Project: JDKSourceCode1.8 Author: wupeixuan File: XObject.java License: MIT License | 6 votes |
/** * Tell the user of an error, and probably throw an * exception. * * @param msg Error message to issue * @param args Arguments to use in the message * * @throws javax.xml.transform.TransformerException */ protected void error(String msg, Object[] args) throws javax.xml.transform.TransformerException { String fmsg = XSLMessages.createXPATHMessage(msg, args); // boolean shouldThrow = support.problem(m_support.XPATHPROCESSOR, // m_support.ERROR, // null, // null, fmsg, 0, 0); // if(shouldThrow) { throw new XPathException(fmsg, this); } }
Example #16
Source Project: jdk1.8-source-analysis Author: raysonfang File: XPath.java License: Apache License 2.0 | 6 votes |
/** * Warn the user of an problem. * * @param xctxt The XPath runtime context. * @param sourceNode Not used. * @param msg An error msgkey that corresponds to one of the constants found * in {@link com.sun.org.apache.xpath.internal.res.XPATHErrorResources}, which is * a key for a format string. * @param args An array of arguments represented in the format string, which * may be null. * * @throws TransformerException if the current ErrorListoner determines to * throw an exception. */ public void warn( XPathContext xctxt, int sourceNode, String msg, Object[] args) throws javax.xml.transform.TransformerException { String fmsg = XSLMessages.createXPATHWarning(msg, args); ErrorListener ehandler = xctxt.getErrorListener(); if (null != ehandler) { // TO DO: Need to get stylesheet Locator from here. ehandler.warning(new TransformerException(fmsg, (SAXSourceLocator)xctxt.getSAXLocator())); } }
Example #17
Source Project: JDKSourceCode1.8 Author: wupeixuan File: FuncCurrent.java License: MIT License | 6 votes |
/** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { SubContextList subContextList = xctxt.getCurrentNodeList(); int currentNode = DTM.NULL; if (null != subContextList) { if (subContextList instanceof PredicatedNodeTest) { LocPathIterator iter = ((PredicatedNodeTest)subContextList) .getLocPathIterator(); currentNode = iter.getCurrentContextNode(); } else if(subContextList instanceof StepPattern) { throw new RuntimeException(XSLMessages.createMessage( XSLTErrorResources.ER_PROCESSOR_ERROR,null)); } } else { // not predicate => ContextNode == CurrentNode currentNode = xctxt.getContextNode(); } return new XNodeSet(currentNode, xctxt.getDTMManager()); }
Example #18
Source Project: JDKSourceCode1.8 Author: wupeixuan File: NodeSetDTM.java License: MIT License | 5 votes |
/** * Same as setElementAt. * * @param node The node to be set. * @param index The index of the node to be replaced. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void setItem(int node, int index) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.setElementAt(node, index); }
Example #19
Source Project: openjdk-jdk8u Author: AdoptOpenJDK File: NodeSetDTM.java License: GNU General Public License v2.0 | 5 votes |
/** * If an index is requested, NodeSetDTM will call this method * to run the iterator to the index. By default this sets * m_next to the index. If the index argument is -1, this * signals that the iterator should be run to the end. * * @param index Position to advance (or retreat) to, with * 0 requesting the reset ("fresh") position and -1 (or indeed * any out-of-bounds value) requesting the final position. * @throws RuntimeException thrown if this NodeSetDTM is not * one of the types which supports indexing/counting. */ public void runTo(int index) { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_INDEX, null)); //"This NodeSetDTM can not do indexing or counting functions!"); if ((index >= 0) && (m_next < m_firstFree)) m_next = index; else m_next = m_firstFree - 1; }
Example #20
Source Project: jdk8u60 Author: chenghanpeng File: NodeSetDTM.java License: GNU General Public License v2.0 | 5 votes |
/** * Copy NodeList members into this nodelist, adding in * document order. If a node is null, don't add it. * * @param iterator DTMIterator which yields the nodes to be added. * @param support The XPath runtime context. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void addNodesInDocOrder(DTMIterator iterator, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); int node; while (DTM.NULL != (node = iterator.nextNode())) { addNodeInDocOrder(node, support); } }
Example #21
Source Project: TencentKona-8 Author: Tencent File: NodeSetDTM.java License: GNU General Public License v2.0 | 5 votes |
/** * Same as setElementAt. * * @param node The node to be set. * @param index The index of the node to be replaced. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void setItem(int node, int index) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.setElementAt(node, index); }
Example #22
Source Project: jdk1.8-source-analysis Author: raysonfang File: Variable.java License: Apache License 2.0 | 5 votes |
/** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { m_fixUpWasCalled = true; int sz = vars.size(); for (int i = vars.size()-1; i >= 0; i--) { QName qn = (QName)vars.elementAt(i); // System.out.println("qn: "+qn); if(qn.equals(m_qname)) { if(i < globalsSize) { m_isGlobal = true; m_index = i; } else { m_index = i-globalsSize; } return; } } java.lang.String msg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_COULD_NOT_FIND_VAR, new Object[]{m_qname.toString()}); TransformerException te = new TransformerException(msg, this); throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(te); }
Example #23
Source Project: openjdk-jdk8u Author: AdoptOpenJDK File: NodeSetDTM.java License: GNU General Public License v2.0 | 5 votes |
/** * Append the nodes to the list. * * @param nodes The nodes to be appended to this node set. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void appendNodes(NodeVector nodes) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.appendNodes(nodes); }
Example #24
Source Project: jdk8u60 Author: chenghanpeng File: NodeSet.java License: GNU General Public License v2.0 | 5 votes |
/** * Set the current position in the node set. * @param i Must be a valid index. * @throws RuntimeException thrown if this NodeSet is not of * a cached type, and thus doesn't permit indexed access. */ public void setCurrentPos(int i) { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null)); //"This NodeSet can not do indexing or counting functions!"); m_next = i; }
Example #25
Source Project: TencentKona-8 Author: Tencent File: NodeSet.java License: GNU General Public License v2.0 | 5 votes |
/** * Sets the component at the specified index of this vector to be the * specified object. The previous component at that position is discarded. * * The index must be a value greater than or equal to 0 and less * than the current size of the vector. * * @param node Node to set * @param index Index of where to set the node */ public void setElementAt(Node node, int index) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null == m_map) { m_map = new Node[m_blocksize]; m_mapSize = m_blocksize; } m_map[index] = node; }
Example #26
Source Project: jdk8u60 Author: chenghanpeng File: NodeSet.java License: GNU General Public License v2.0 | 5 votes |
/** * Sets the component at the specified index of this vector to be the * specified object. The previous component at that position is discarded. * * The index must be a value greater than or equal to 0 and less * than the current size of the vector. * * @param node Node to set * @param index Index of where to set the node */ public void setElementAt(Node node, int index) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null == m_map) { m_map = new Node[m_blocksize]; m_mapSize = m_blocksize; } m_map[index] = node; }
Example #27
Source Project: jdk1.8-source-analysis Author: raysonfang File: NodeSetDTM.java License: Apache License 2.0 | 5 votes |
/** * If an index is requested, NodeSetDTM will call this method * to run the iterator to the index. By default this sets * m_next to the index. If the index argument is -1, this * signals that the iterator should be run to the end. * * @param index Position to advance (or retreat) to, with * 0 requesting the reset ("fresh") position and -1 (or indeed * any out-of-bounds value) requesting the final position. * @throws RuntimeException thrown if this NodeSetDTM is not * one of the types which supports indexing/counting. */ public void runTo(int index) { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_CANNOT_INDEX, null)); //"This NodeSetDTM can not do indexing or counting functions!"); if ((index >= 0) && (m_next < m_firstFree)) m_next = index; else m_next = m_firstFree - 1; }
Example #28
Source Project: TencentKona-8 Author: Tencent File: XPath.java License: GNU General Public License v2.0 | 5 votes |
/** * Tell the user of an assertion error, and probably throw an * exception. * * @param b If false, a runtime exception will be thrown. * @param msg The assertion message, which should be informative. * * @throws RuntimeException if the b argument is false. */ public void assertion(boolean b, String msg) { if (!b) { String fMsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[]{ msg }); throw new RuntimeException(fMsg); } }
Example #29
Source Project: jdk8u60 Author: chenghanpeng File: Variable.java License: GNU General Public License v2.0 | 5 votes |
/** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time. * @param vars List of QNames that correspond to variables. This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname. The position of the * QName in the vector from the start of the vector will be its position * in the stack frame (but variables above the globalsTop value will need * to be offset to the current stack frame). */ public void fixupVariables(java.util.Vector vars, int globalsSize) { m_fixUpWasCalled = true; int sz = vars.size(); for (int i = vars.size()-1; i >= 0; i--) { QName qn = (QName)vars.elementAt(i); // System.out.println("qn: "+qn); if(qn.equals(m_qname)) { if(i < globalsSize) { m_isGlobal = true; m_index = i; } else { m_index = i-globalsSize; } return; } } java.lang.String msg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_COULD_NOT_FIND_VAR, new Object[]{m_qname.toString()}); TransformerException te = new TransformerException(msg, this); throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(te); }
Example #30
Source Project: openjdk-jdk8u Author: AdoptOpenJDK File: XPath.java License: GNU General Public License v2.0 | 5 votes |
/** * Construct an XPath object. * * (Needs review -sc) This method initializes an XPathParser/ * Compiler and compiles the expression. * @param exprString The XPath expression. * @param locator The location of the expression, may be null. * @param prefixResolver A prefix resolver to use to resolve prefixes to * namespace URIs. * @param type one of {@link #SELECT} or {@link #MATCH}. * @param errorListener The error listener, or null if default should be used. * * @throws javax.xml.transform.TransformerException if syntax or other error. */ public XPath( String exprString, SourceLocator locator, PrefixResolver prefixResolver, int type, ErrorListener errorListener) throws javax.xml.transform.TransformerException { initFunctionTable(); if(null == errorListener) errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler(); m_patternString = exprString; XPathParser parser = new XPathParser(errorListener, locator); Compiler compiler = new Compiler(errorListener, locator, m_funcTable); if (SELECT == type) parser.initXPath(compiler, exprString, prefixResolver); else if (MATCH == type) parser.initMatchPattern(compiler, exprString, prefixResolver); else throw new RuntimeException(XSLMessages.createXPATHMessage( XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE, new Object[]{Integer.toString(type)})); // System.out.println("----------------"); Expression expr = compiler.compileExpression(0); // System.out.println("expr: "+expr); this.setExpression(expr); if((null != locator) && locator instanceof ExpressionNode) { expr.exprSetParent((ExpressionNode)locator); } }