Java Code Examples for com.sun.org.apache.xalan.internal.res.XSLMessages#createXPATHMessage()
The following examples show how to use
com.sun.org.apache.xalan.internal.res.XSLMessages#createXPATHMessage() .
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 File: VariableStack.java From jdk8u60 with 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 2
Source File: Compiler.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Tell the user of an error, and probably throw an * exception. * * @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 error(String msg, Object[] args) throws TransformerException { java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args); if (null != m_errorHandler) { m_errorHandler.fatalError(new TransformerException(fmsg, m_locator)); } else { // System.out.println(te.getMessage() // +"; file "+te.getSystemId() // +"; line "+te.getLineNumber() // +"; column "+te.getColumnNumber()); throw new TransformerException(fmsg, (SAXSourceLocator)m_locator); } }
Example 3
Source File: Compiler.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Tell the user of an error, and probably throw an * exception. * * @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 error(String msg, Object[] args) throws TransformerException { java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args); if (null != m_errorHandler) { m_errorHandler.fatalError(new TransformerException(fmsg, m_locator)); } else { // System.out.println(te.getMessage() // +"; file "+te.getSystemId() // +"; line "+te.getLineNumber() // +"; column "+te.getColumnNumber()); throw new TransformerException(fmsg, (SAXSourceLocator)m_locator); } }
Example 4
Source File: NodeSet.java From TencentKona-8 with 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 5
Source File: NodeSet.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * Returns the previous node in the set and moves the position of the * iterator backwards in the set. * @return The previous <code>Node</code> in the set being iterated over, * or<code>null</code> if there are no more members in that set. * @throws DOMException * INVALID_STATE_ERR: Raised if this method is called after the * <code>detach</code> method was invoked. * @throws RuntimeException thrown if this NodeSet is not of * a cached type, and hence doesn't know what the previous node was. */ public Node previousNode() throws DOMException { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_ITERATE, null)); //"This NodeSet can not iterate to a previous node!"); if ((m_next - 1) > 0) { m_next--; return this.elementAt(m_next); } else return null; }
Example 6
Source File: NodeSet.java From JDKSourceCode1.8 with MIT License | 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 7
Source File: NodeSet.java From jdk8u60 with 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 NodeIterator which yields the 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(NodeIterator iterator, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); Node node; while (null != (node = iterator.nextNode())) { addNodeInDocOrder(node, support); } }
Example 8
Source File: XPathImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * <p>Establishes a namespace context.</p> * * @param nsContext Namespace context to use */ public void setNamespaceContext(NamespaceContext nsContext) { if ( nsContext == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"NamespaceContext"} ); throw new NullPointerException( fmsg ); } this.namespaceContext = nsContext; this.prefixResolver = new JAXPPrefixResolver ( nsContext ); }
Example 9
Source File: OpMap.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Given a location step position, return the end position, i.e. the * beginning of the next step. * * @param opPos the position of a location step. * @return the position of the next location step. */ public int getNextStepPos(int opPos) { int stepType = getOp(opPos); if ((stepType >= OpCodes.AXES_START_TYPES) && (stepType <= OpCodes.AXES_END_TYPES)) { return getNextOpPos(opPos); } else if ((stepType >= OpCodes.FIRST_NODESET_OP) && (stepType <= OpCodes.LAST_NODESET_OP)) { int newOpPos = getNextOpPos(opPos); while (OpCodes.OP_PREDICATE == getOp(newOpPos)) { newOpPos = getNextOpPos(newOpPos); } stepType = getOp(newOpPos); if (!((stepType >= OpCodes.AXES_START_TYPES) && (stepType <= OpCodes.AXES_END_TYPES))) { return OpCodes.ENDOP; } return newOpPos; } else { throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_UNKNOWN_STEP, new Object[]{String.valueOf(stepType)})); //"Programmer's assertion in getNextStepPos: unknown stepType: " + stepType); } }
Example 10
Source File: OpMap.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Given a location step position, return the end position, i.e. the * beginning of the next step. * * @param opPos the position of a location step. * @return the position of the next location step. */ public int getNextStepPos(int opPos) { int stepType = getOp(opPos); if ((stepType >= OpCodes.AXES_START_TYPES) && (stepType <= OpCodes.AXES_END_TYPES)) { return getNextOpPos(opPos); } else if ((stepType >= OpCodes.FIRST_NODESET_OP) && (stepType <= OpCodes.LAST_NODESET_OP)) { int newOpPos = getNextOpPos(opPos); while (OpCodes.OP_PREDICATE == getOp(newOpPos)) { newOpPos = getNextOpPos(newOpPos); } stepType = getOp(newOpPos); if (!((stepType >= OpCodes.AXES_START_TYPES) && (stepType <= OpCodes.AXES_END_TYPES))) { return OpCodes.ENDOP; } return newOpPos; } else { throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_UNKNOWN_STEP, new Object[]{String.valueOf(stepType)})); //"Programmer's assertion in getNextStepPos: unknown stepType: " + stepType); } }
Example 11
Source File: XPathImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * <p>Establishes a function resolver.</p> * * @param resolver XPath function resolver */ public void setXPathFunctionResolver(XPathFunctionResolver resolver) { if ( resolver == null ) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_ARG_CANNOT_BE_NULL, new Object[] {"XPathFunctionResolver"} ); throw new NullPointerException( fmsg ); } this.functionResolver = resolver; }
Example 12
Source File: NodeSet.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Return the last fetched node. Needed to support the UnionPathIterator. * * @return the last fetched node. * @throws RuntimeException thrown if this NodeSet is not of * a cached type, and thus doesn't permit indexed access. */ public Node getCurrentNode() { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null)); //"This NodeSet can not do indexing or counting functions!"); int saved = m_next; Node n = (m_next < m_firstFree) ? elementAt(m_next) : null; m_next = saved; // HACK: I think this is a bit of a hack. -sb return n; }
Example 13
Source File: NodeSet.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Return the last fetched node. Needed to support the UnionPathIterator. * * @return the last fetched node. * @throws RuntimeException thrown if this NodeSet is not of * a cached type, and thus doesn't permit indexed access. */ public Node getCurrentNode() { if (!m_cacheNodes) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null)); //"This NodeSet can not do indexing or counting functions!"); int saved = m_next; Node n = (m_next < m_firstFree) ? elementAt(m_next) : null; m_next = saved; // HACK: I think this is a bit of a hack. -sb return n; }
Example 14
Source File: NodeSetDTM.java From openjdk-jdk8u with GNU General Public License v2.0 | 3 votes |
/** * Insert a node at a given position. * * @param n Node to be added * @param pos Offset at which the node is to be inserted, * with 0 being the first position. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public void insertNode(int n, int pos) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); insertElementAt(n, pos); }
Example 15
Source File: NodeSet.java From openjdk-jdk8u with GNU General Public License v2.0 | 3 votes |
/** * Add the node into a vector of nodes where it should occur in * document order. * @param node The node to be added. * @param support The XPath runtime context. * * @return The index where it was inserted. * @throws RuntimeException thrown if this NodeSet is not of * a mutable type. */ public int addNodeInDocOrder(Node node, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); return addNodeInDocOrder(node, true, support); }
Example 16
Source File: NodeSetDTM.java From jdk1.8-source-analysis with Apache License 2.0 | 3 votes |
/** * Add the node into a vector of nodes where it should occur in * document order. * @param node The node to be added. * @param support The XPath runtime context. * * @return The index where it was inserted. * @throws RuntimeException thrown if this NodeSetDTM is not of * a mutable type. */ public int addNodeInDocOrder(int node, XPathContext support) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); return addNodeInDocOrder(node, true, support); }
Example 17
Source File: Expression.java From jdk8u60 with GNU General Public License v2.0 | 3 votes |
/** * Tell the user of an error, and probably throw an * exception. * * @param xctxt The XPath runtime context. * @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. * * @throws javax.xml.transform.TransformerException */ public void error(XPathContext xctxt, String msg, Object[] args) throws javax.xml.transform.TransformerException { java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args); if (null != xctxt) { ErrorListener eh = xctxt.getErrorListener(); TransformerException te = new TransformerException(fmsg, this); eh.fatalError(te); } }
Example 18
Source File: NodeSet.java From jdk8u60 with GNU General Public License v2.0 | 3 votes |
/** * If setShouldCacheNodes(true) is called, then nodes will * be cached. They are not cached by default. This switch must * be set before the first call to nextNode is made, to ensure * that all nodes are cached. * * @param b true if this node set should be cached. * @throws RuntimeException thrown if an attempt is made to * request caching after we've already begun stepping through the * nodes in this set. */ public void setShouldCacheNodes(boolean b) { if (!isFresh()) throw new RuntimeException( XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CANNOT_CALL_SETSHOULDCACHENODE, null)); //"Can not call setShouldCacheNodes after nextNode has been called!"); m_cacheNodes = b; m_mutable = true; }
Example 19
Source File: FuncConcat.java From openjdk-jdk8u with GNU General Public License v2.0 | 2 votes |
/** * Constructs and throws a WrongNumberArgException with the appropriate * message for this function object. * * @throws WrongNumberArgsException */ protected void reportWrongNumberArgs() throws WrongNumberArgsException { throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("gtone", null)); }
Example 20
Source File: XRTreeFragSelectWrapper.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * Cast result object to a DTMIterator. * * @return The document fragment as a DTMIterator */ public DTMIterator asNodeIterator() { throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER, null)); //"asNodeIterator() not supported by XRTreeFragSelectWrapper!"); }