Java Code Examples for com.sun.org.apache.xpath.internal.objects.XObject#detach()
The following examples show how to use
com.sun.org.apache.xpath.internal.objects.XObject#detach() .
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: Operation.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); XObject result = operate(left, right); left.detach(); right.detach(); return result; }
Example 2
Source File: Operation.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); XObject result = operate(left, right); left.detach(); right.detach(); return result; }
Example 3
Source File: Equals.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); boolean result = left.equals(right) ? true : false; left.detach(); right.detach(); return result; }
Example 4
Source File: Operation.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); XObject result = operate(left, right); left.detach(); right.detach(); return result; }
Example 5
Source File: Operation.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); XObject result = operate(left, right); left.detach(); right.detach(); return result; }
Example 6
Source File: Operation.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); XObject result = operate(left, right); left.detach(); right.detach(); return result; }
Example 7
Source File: Equals.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); boolean result = left.equals(right) ? true : false; left.detach(); right.detach(); return result; }
Example 8
Source File: Operation.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); XObject result = operate(left, right); left.detach(); right.detach(); return result; }
Example 9
Source File: Equals.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public boolean bool(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); boolean result = left.equals(right) ? true : false; left.detach(); right.detach(); return result; }
Example 10
Source File: Operation.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); XObject result = operate(left, right); left.detach(); right.detach(); return result; }
Example 11
Source File: Operation.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Execute a binary operation by calling execute on each of the operands, * and then calling the operate method on the derived class. * * * @param xctxt The runtime execution context. * * @return The XObject result of the operation. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject left = m_left.execute(xctxt, true); XObject right = m_right.execute(xctxt, true); XObject result = operate(left, right); left.detach(); right.detach(); return result; }
Example 12
Source File: StepPattern.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * New Method to check whether the current node satisfies a position predicate * * @param xctxt The XPath runtime context. * @param predPos Which predicate we're evaluating of foo[1][2][3]. * @param dtm The DTM of the current node. * @param context The currentNode. * @param pos The position being requested, i.e. the value returned by * m_predicates[predPos].execute(xctxt). * * @return true of the position of the context matches pos, false otherwise. */ private final boolean checkProximityPosition(XPathContext xctxt, int predPos, DTM dtm, int context, int pos) { try { DTMAxisTraverser traverser = dtm.getAxisTraverser(Axis.PRECEDINGSIBLING); for (int child = traverser.first(context); DTM.NULL != child; child = traverser.next(context, child)) { try { xctxt.pushCurrentNode(child); if (NodeTest.SCORE_NONE != super.execute(xctxt, child)) { boolean pass = true; try { xctxt.pushSubContextList(this); for (int i = 0; i < predPos; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { throw new Error("Why: Should never have been called"); } else if (!pred.boolWithSideEffects()) { pass = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } if (pass) pos--; if (pos < 1) return false; } } finally { xctxt.popCurrentNode(); } } } catch (javax.xml.transform.TransformerException se) { // TODO: should keep throw sax exception... throw new java.lang.RuntimeException(se.getMessage()); } return (pos == 1); }
Example 13
Source File: StepPattern.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Execute the predicates on this step to determine if the current node * should be filtered or accepted. * * @param xctxt The XPath runtime context. * @param dtm The DTM of the current node. * @param currentNode The current node context. * * @return true if the node should be accepted, false otherwise. * * @throws javax.xml.transform.TransformerException */ protected final boolean executePredicates( XPathContext xctxt, DTM dtm, int currentNode) throws javax.xml.transform.TransformerException { boolean result = true; boolean positionAlreadySeen = false; int n = getPredicateCount(); try { xctxt.pushSubContextList(this); for (int i = 0; i < n; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { int pos = (int) pred.num(); if (positionAlreadySeen) { result = (pos == 1); break; } else { positionAlreadySeen = true; if (!checkProximityPosition(xctxt, i, dtm, currentNode, pos)) { result = false; break; } } } else if (!pred.boolWithSideEffects()) { result = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } return result; }
Example 14
Source File: StepPattern.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Execute the predicates on this step to determine if the current node * should be filtered or accepted. * * @param xctxt The XPath runtime context. * @param dtm The DTM of the current node. * @param currentNode The current node context. * * @return true if the node should be accepted, false otherwise. * * @throws javax.xml.transform.TransformerException */ protected final boolean executePredicates( XPathContext xctxt, DTM dtm, int currentNode) throws javax.xml.transform.TransformerException { boolean result = true; boolean positionAlreadySeen = false; int n = getPredicateCount(); try { xctxt.pushSubContextList(this); for (int i = 0; i < n; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { int pos = (int) pred.num(); if (positionAlreadySeen) { result = (pos == 1); break; } else { positionAlreadySeen = true; if (!checkProximityPosition(xctxt, i, dtm, currentNode, pos)) { result = false; break; } } } else if (!pred.boolWithSideEffects()) { result = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } return result; }
Example 15
Source File: StepPattern.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Execute the predicates on this step to determine if the current node * should be filtered or accepted. * * @param xctxt The XPath runtime context. * @param dtm The DTM of the current node. * @param currentNode The current node context. * * @return true if the node should be accepted, false otherwise. * * @throws javax.xml.transform.TransformerException */ protected final boolean executePredicates( XPathContext xctxt, DTM dtm, int currentNode) throws javax.xml.transform.TransformerException { boolean result = true; boolean positionAlreadySeen = false; int n = getPredicateCount(); try { xctxt.pushSubContextList(this); for (int i = 0; i < n; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { int pos = (int) pred.num(); if (positionAlreadySeen) { result = (pos == 1); break; } else { positionAlreadySeen = true; if (!checkProximityPosition(xctxt, i, dtm, currentNode, pos)) { result = false; break; } } } else if (!pred.boolWithSideEffects()) { result = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } return result; }
Example 16
Source File: StepPattern.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Execute the predicates on this step to determine if the current node * should be filtered or accepted. * * @param xctxt The XPath runtime context. * @param dtm The DTM of the current node. * @param currentNode The current node context. * * @return true if the node should be accepted, false otherwise. * * @throws javax.xml.transform.TransformerException */ protected final boolean executePredicates( XPathContext xctxt, DTM dtm, int currentNode) throws javax.xml.transform.TransformerException { boolean result = true; boolean positionAlreadySeen = false; int n = getPredicateCount(); try { xctxt.pushSubContextList(this); for (int i = 0; i < n; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { int pos = (int) pred.num(); if (positionAlreadySeen) { result = (pos == 1); break; } else { positionAlreadySeen = true; if (!checkProximityPosition(xctxt, i, dtm, currentNode, pos)) { result = false; break; } } } else if (!pred.boolWithSideEffects()) { result = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } return result; }
Example 17
Source File: StepPattern.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * New Method to check whether the current node satisfies a position predicate * * @param xctxt The XPath runtime context. * @param predPos Which predicate we're evaluating of foo[1][2][3]. * @param dtm The DTM of the current node. * @param context The currentNode. * @param pos The position being requested, i.e. the value returned by * m_predicates[predPos].execute(xctxt). * * @return true of the position of the context matches pos, false otherwise. */ private final boolean checkProximityPosition(XPathContext xctxt, int predPos, DTM dtm, int context, int pos) { try { DTMAxisTraverser traverser = dtm.getAxisTraverser(Axis.PRECEDINGSIBLING); for (int child = traverser.first(context); DTM.NULL != child; child = traverser.next(context, child)) { try { xctxt.pushCurrentNode(child); if (NodeTest.SCORE_NONE != super.execute(xctxt, child)) { boolean pass = true; try { xctxt.pushSubContextList(this); for (int i = 0; i < predPos; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { throw new Error("Why: Should never have been called"); } else if (!pred.boolWithSideEffects()) { pass = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } if (pass) pos--; if (pos < 1) return false; } } finally { xctxt.popCurrentNode(); } } } catch (javax.xml.transform.TransformerException se) { // TODO: should keep throw sax exception... throw new java.lang.RuntimeException(se.getMessage()); } return (pos == 1); }
Example 18
Source File: StepPattern.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Execute the predicates on this step to determine if the current node * should be filtered or accepted. * * @param xctxt The XPath runtime context. * @param dtm The DTM of the current node. * @param currentNode The current node context. * * @return true if the node should be accepted, false otherwise. * * @throws javax.xml.transform.TransformerException */ protected final boolean executePredicates( XPathContext xctxt, DTM dtm, int currentNode) throws javax.xml.transform.TransformerException { boolean result = true; boolean positionAlreadySeen = false; int n = getPredicateCount(); try { xctxt.pushSubContextList(this); for (int i = 0; i < n; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { int pos = (int) pred.num(); if (positionAlreadySeen) { result = (pos == 1); break; } else { positionAlreadySeen = true; if (!checkProximityPosition(xctxt, i, dtm, currentNode, pos)) { result = false; break; } } } else if (!pred.boolWithSideEffects()) { result = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } return result; }
Example 19
Source File: StepPattern.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * New Method to check whether the current node satisfies a position predicate * * @param xctxt The XPath runtime context. * @param predPos Which predicate we're evaluating of foo[1][2][3]. * @param dtm The DTM of the current node. * @param context The currentNode. * @param pos The position being requested, i.e. the value returned by * m_predicates[predPos].execute(xctxt). * * @return true of the position of the context matches pos, false otherwise. */ private final boolean checkProximityPosition(XPathContext xctxt, int predPos, DTM dtm, int context, int pos) { try { DTMAxisTraverser traverser = dtm.getAxisTraverser(Axis.PRECEDINGSIBLING); for (int child = traverser.first(context); DTM.NULL != child; child = traverser.next(context, child)) { try { xctxt.pushCurrentNode(child); if (NodeTest.SCORE_NONE != super.execute(xctxt, child)) { boolean pass = true; try { xctxt.pushSubContextList(this); for (int i = 0; i < predPos; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { throw new Error("Why: Should never have been called"); } else if (!pred.boolWithSideEffects()) { pass = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } if (pass) pos--; if (pos < 1) return false; } } finally { xctxt.popCurrentNode(); } } } catch (javax.xml.transform.TransformerException se) { // TODO: should keep throw sax exception... throw new java.lang.RuntimeException(se.getMessage()); } return (pos == 1); }
Example 20
Source File: Expression.java From TencentKona-8 with GNU General Public License v2.0 | 3 votes |
/** * Execute an expression in the XPath runtime context, and return the * result of the expression. * * * @param xctxt The XPath runtime context. * NEEDSDOC @param handler * * @return The result of the expression in the form of a <code>XObject</code>. * * @throws javax.xml.transform.TransformerException if a runtime exception * occurs. * @throws org.xml.sax.SAXException */ public void executeCharsToContentHandler( XPathContext xctxt, ContentHandler handler) throws javax.xml.transform.TransformerException, org.xml.sax.SAXException { XObject obj = execute(xctxt); obj.dispatchCharactersEvents(handler); obj.detach(); }