/** * Cast result object to a nodelist. Always issues an error. * * @return null * * @throws javax.xml.transform.TransformerException */ public NodeList nodelist() throws javax.xml.transform.TransformerException { return (m_origObj instanceof NodeList) ? (NodeList)m_origObj : super.nodelist(); }
/** * Add an association between a ref and a node in the m_refsTable. * Requires that m_refsTable != null * @param xctxt XPath context * @param ref the value of the use clause of the current key for the given node * @param node the node to reference */ private void addValueInRefsTable(XPathContext xctxt, XMLString ref, int node) { XNodeSet nodes = (XNodeSet) m_refsTable.get(ref); if (nodes == null) { nodes = new XNodeSet(node, xctxt.getDTMManager()); nodes.nextNode(); m_refsTable.put(ref, nodes); } else { // Nodes are passed to this method in document order. Since we need to // suppress duplicates, we only need to check against the last entry // in each nodeset. We use nodes.nextNode after each entry so we can // easily compare node against the current node. if (nodes.getCurrentNode() != node) { nodes.mutableNodeset().addNode(node); nodes.nextNode(); } } } }
/** * Cast result object to a mutableNodeset. * * @return The nodeset as a mutableNodeset */ public NodeSetDTM mutableNodeset() { NodeSetDTM mnl; if(m_obj instanceof NodeSetDTM) { mnl = (NodeSetDTM) m_obj; } else { mnl = new NodeSetDTM(iter()); setObject(mnl); setCurrentPos(0); } return mnl; }
/** * Cast result object to an XMLString. * * @return The document fragment node data or the empty string. */ public XMLString xstr() { int node = item(0); return (node != DTM.NULL) ? getStringFromNode(node) : XString.EMPTYSTRING; }
/** * Cast result object to a number. * * @return numeric value of the string conversion from the * next node in the NodeSetDTM, or NAN if no node was found */ public double num() { int node = item(0); return (node != DTM.NULL) ? getNumberFromNode(node) : Double.NaN; }
/** * Cast result object to a number, but allow side effects, such as the * incrementing of an iterator. * * @return numeric value of the string conversion from the * next node in the NodeSetDTM, or NAN if no node was found */ public double numWithSideEffects() { int node = nextNode(); return (node != DTM.NULL) ? getNumberFromNode(node) : Double.NaN; }
DTMIterator list1 = iterRaw(); DTMIterator list2 = ((XNodeSet) obj2).iterRaw(); int node1; java.util.Vector node2Strings = null; XMLString s1 = getStringFromNode(node1); XMLString s2 = getStringFromNode(node2); double num1 = bool() ? 1.0 : 0.0; double num2 = obj2.num(); DTMIterator list1 = iterRaw(); double num2 = obj2.num(); int node; double num1 = getNumberFromNode(node); XMLString s2 = obj2.xstr(); DTMIterator list1 = iterRaw(); int node; XMLString s1 = getStringFromNode(node); XMLString s2 = obj2.xstr(); DTMIterator list1 = iterRaw(); int node; XMLString s1 = getStringFromNode(node);
m_refsTable = new Hashtable(89); KeyIterator ki = (KeyIterator) (m_keyNodes).getContainedIter(); XPathContext xctxt = ki.getXPathContext(); int nKeyDecls = keyDecls.size(); m_keyNodes.reset(); while (DTM.NULL != (currentNode = m_keyNodes.nextNode())) (KeyDeclaration) keyDecls.elementAt(keyDeclIdx); XObject xuse = keyDeclaration.getUse().execute(xctxt, ki.getPrefixResolver()); if (xuse.getType() != xuse.CLASS_NODESET) { XMLString exprResult = xuse.xstr(); addValueInRefsTable(xctxt, exprResult, currentNode); } else { DTMIterator i = ((XNodeSet)xuse).iterRaw(); int currentNodeInUseClause; throw new WrappedRuntimeException(te);
ns.setShouldCacheNodes(true); int len = ns.getLength(); if(len <= 1) argIsNodeSetDTM = false; dtm = xctxt.getDTM(pos); XMLString ref = dtm.getStringValue(pos); usedrefs = new Hashtable(); if (usedrefs.get(ref) != null) usedrefs.put(ref, ISTRUE); xctxt.getNamespaceContext()); nl.setRoot(xctxt.getCurrentNode(), xctxt); upi.setRoot(current, xctxt); nodes = new XNodeSet(upi); ref, xctxt.getNamespaceContext()); nodes.setRoot(xctxt.getCurrentNode(), xctxt);
int arity = argVec.size(); Object argument = argVec.elementAt( i ); argList.add ( i, ((XNodeSet)argument).nodelist() ); } else if ( argument instanceof XObject ) { Object passedArgument = ((XObject)argument).object(); argList.add ( i, passedArgument ); } else { throw new org.apache.xml.utils.WrappedRuntimeException ( xfe ); } catch ( Exception e ) { throw new javax.xml.transform.TransformerException ( e );
if (!m_keys.isEmpty()) NodeSortKey k1 = (NodeSortKey) m_keys.elementAt(0); XObject r = k1.m_selectPat.execute(m_execContext, node, k1.m_namespaceContext); d = r.num(); m_key1Value = k1.m_col.getCollationKey(r.str()); if (r.getType() == XObject.CLASS_NODESET) DTMIterator ni = ((XNodeSet)r).iterRaw(); int current = ni.getCurrentNode(); if(DTM.NULL == current) if (m_keys.size() > 1) NodeSortKey k2 = (NodeSortKey) m_keys.elementAt(1);
/** * Add an association between a ref and a node in the m_refsTable. * Requires that m_refsTable != null * @param xctxt XPath context * @param ref the value of the use clause of the current key for the given node * @param node the node to reference */ private void addValueInRefsTable(XPathContext xctxt, XMLString ref, int node) { XNodeSet nodes = (XNodeSet) m_refsTable.get(ref); if (nodes == null) { nodes = new XNodeSet(node, xctxt.getDTMManager()); nodes.nextNode(); m_refsTable.put(ref, nodes); } else { // Nodes are passed to this method in document order. Since we need to // suppress duplicates, we only need to check against the last entry // in each nodeset. We use nodes.nextNode after each entry so we can // easily compare node against the current node. if (nodes.getCurrentNode() != node) { nodes.mutableNodeset().addNode(node); nodes.nextNode(); } } } }
KeyIterator ki = (KeyIterator)(((XNodeSet)m_keysNodes).getContainedIter()); org.apache.xpath.XPathContext xctxt = ki.getXPathContext(); int nDeclarations = keys.size(); KeyDeclaration kd = (KeyDeclaration) keys.elementAt(i); if (xuse.getType() != xuse.CLASS_NODESET) XMLString exprResult = xuse.xstr(); DTMIterator nl = ((XNodeSet)xuse).iterRaw(); int useNode; XMLString exprResult = dtm.getStringValue(useNode); if ((null != exprResult) && lookupKey.equals(exprResult)) return DTMIterator.FILTER_ACCEPT; throw new org.apache.xml.utils.WrappedRuntimeException(te);
int handle = xctxt.getDTMHandleFromNode((DocumentFragment)obj); iterator.setRoot(dtm.getDocument(), xctxt); value = new XNodeSet(iterator); value = new XNodeSet(iterator); value = new XNodeSet((DTMIterator) obj); value = new XNodeSet(new org.apache.xpath.NodeSetDTM(((NodeIterator)obj), xctxt)); new XNodeSet(xctxt.getDTMHandleFromNode((org.w3c.dom.Node) obj), xctxt.getDTMManager()); int type = value.getType(); String s; case XObject.CLASS_NUMBER : case XObject.CLASS_STRING : s = value.str(); DTMIterator nl = value.iter(); ClonerToResultTree.cloneToResultTree(pos, dtm.getNodeType(pos), dtm, rtreeHandler, true); int nextNode = dtm.getFirstChild(pos);
Node xpathOwnerNode = (Node) xctxt.getOwnerObject(); int xpathOwnerNodeDTM = xctxt.getDTMHandleFromNode(xpathOwnerNode); int currentNode = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(currentNode); int docContext = dtm.getDocument(); XMLUtils.getOwnerDocument(dtm.getNode(currentNode)); Document xpathOwnerDoc = XMLUtils.getOwnerDocument(xpathOwnerNode); XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); switch (dtm.getNodeType(xpathOwnerNodeDTM)) {
int context = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(context); int docContext = dtm.getDocument(); int argType = arg.getType(); XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM nodeSet = nodes.mutableNodeset(); DTMIterator ni = arg.iter(); StringVector usedrefs = null; int pos = ni.nextNode(); String refval = ndtm.getStringValue(pos).toString(); String refval = arg.str();
int context = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(context); int docContext = dtm.getDocumentRoot(context); XObject arg = (XObject) this.getArg0().execute(xctxt); if (XObject.CLASS_NODESET == arg2.getType()) int baseNode = arg2.iter().nextNode(); XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); return nodes; } else{ DTM baseDTM = xctxt.getDTM(baseNode); base = baseDTM.getDocumentBaseURI(); arg2.iter(); XNodeSet nodes = new XNodeSet(xctxt.getDTMManager()); NodeSetDTM mnl = nodes.mutableNodeset(); DTMIterator iterator = (XObject.CLASS_NODESET == arg.getType()) ? arg.iter() : null; ? xctxt.getDTM(pos).getStringValue(pos) : arg.xstr();
xctxt.pushContextNodeList(contextNodes); xctxt.pushCurrentNode(contextNode); XPath dynamicXPath = new XPath(expr, xctxt.getSAXLocator(), xctxt.getNamespaceContext(), XPath.SELECT); nodelist = ((XNodeSet)object).nodelist(); element = lDoc.createElementNS(EXSL_URI, "exsl:string"); Text textNode = lDoc.createTextNode(object.str()); element.appendChild(textNode); resultSet.addNode(element);
try int dtmRoot = dtm.getDocument(); DTMAxisIterator iter = dtm.getAxisIterator(Axis.SELF); iter.setStartNode(dtmRoot); DTMIterator iterator = new OneStepIterator(iter, Axis.SELF); iterator.setRoot(dtmRoot, xctxt); result = new XNodeSet(iterator); throw new org.apache.xml.utils.WrappedRuntimeException(ex); result = new XNodeSet(iterator); throw new org.apache.xml.utils.WrappedRuntimeException(ex); result = new XNodeSet((DTMIterator) val); result = new XObject(val);
/** * 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()); }