/** * Get an instance of the DTMManager. Since a node * iterator may be passed without a DTMManager, this allows the * caller to easily get the DTMManager using just the iterator. * * @return a non-null DTMManager reference. */ public DTMManager getDTMManager() { return m_execContext.getDTMManager(); }
/** * Get an instance of the DTMManager. Since a node * iterator may be passed without a DTMManager, this allows the * caller to easily get the DTMManager using just the iterator. * * @return a non-null DTMManager reference. */ public DTMManager getDTMManager() { return m_execContext.getDTMManager(); }
/** * Cast result object to a DTMIterator. * dml - modified to return an RTFIterator for * benefit of EXSLT object-type function in * {@code org.apache.xalan.lib.ExsltCommon}. * @return The document fragment as a DTMIterator */ public DTMIterator asNodeIterator() { return new RTFIterator(m_dtmRoot, m_DTMXRTreeFrag.getXPathContext().getDTMManager()); }
/** * Create a NodeSetDTM, and copy the members of the * given DTMIterator into it. * */ public NodeSetDTM(NodeList nodeList, XPathContext xctxt) { super(); m_manager = xctxt.getDTMManager(); int n = nodeList.getLength(); for (int i = 0; i < n; i++) { Node node = nodeList.item(i); int handle = xctxt.getDTMHandleFromNode(node); // Do not reorder or strip duplicate nodes from the given DOM nodelist addNode(handle); // addNodeInDocOrder(handle, xctxt); } }
/** * Create a NodeSetDTM, and copy the members of the * given DTMIterator into it. * */ public NodeSetDTM(NodeList nodeList, XPathContext xctxt) { super(); m_manager = xctxt.getDTMManager(); int n = nodeList.getLength(); for (int i = 0; i < n; i++) { Node node = nodeList.item(i); int handle = xctxt.getDTMHandleFromNode(node); // Do not reorder or strip duplicate nodes from the given DOM nodelist addNode(handle); // addNodeInDocOrder(handle, xctxt); } }
/** * Cast result object to a DTMIterator. * dml - modified to return an RTFIterator for * benefit of EXSLT object-type function in * {@link org.apache.xalan.lib.ExsltCommon}. * @return The document fragment as a DTMIterator */ public DTMIterator asNodeIterator() { return new RTFIterator(m_dtmRoot, m_DTMXRTreeFrag.getXPathContext().getDTMManager()); }
public XNodeSetForDOM(NodeIterator nodeIter, XPathContext xctxt) { m_dtmMgr = xctxt.getDTMManager(); m_origObj = nodeIter; // JKESS 20020514: Longer-term solution is to force // folks to request length through an accessor, so we can defer this // retrieval... but that requires an API change. // m_obj = new org.apache.xpath.NodeSetDTM(nodeIter, xctxt); org.apache.xpath.NodeSetDTM nsdtm=new org.apache.xpath.NodeSetDTM(nodeIter, xctxt); m_last=nsdtm.getLength(); setObject(nsdtm); }
public XNodeSetForDOM(NodeList nodeList, XPathContext xctxt) { m_dtmMgr = xctxt.getDTMManager(); m_origObj = nodeList; // JKESS 20020514: Longer-term solution is to force // folks to request length through an accessor, so we can defer this // retrieval... but that requires an API change. // m_obj=new org.apache.xpath.NodeSetDTM(nodeList, xctxt); org.apache.xpath.NodeSetDTM nsdtm=new org.apache.xpath.NodeSetDTM(nodeList, xctxt); m_last=nsdtm.getLength(); setObject(nsdtm); }
public XNodeSetForDOM(NodeList nodeList, XPathContext xctxt) { m_dtmMgr = xctxt.getDTMManager(); m_origObj = nodeList; // JKESS 20020514: Longer-term solution is to force // folks to request length through an accessor, so we can defer this // retrieval... but that requires an API change. // m_obj=new org.apache.xpath.NodeSetDTM(nodeList, xctxt); org.apache.xpath.NodeSetDTM nsdtm=new org.apache.xpath.NodeSetDTM(nodeList, xctxt); m_last=nsdtm.getLength(); setObject(nsdtm); }
public XNodeSetForDOM(NodeIterator nodeIter, XPathContext xctxt) { m_dtmMgr = xctxt.getDTMManager(); m_origObj = nodeIter; // JKESS 20020514: Longer-term solution is to force // folks to request length through an accessor, so we can defer this // retrieval... but that requires an API change. // m_obj = new org.apache.xpath.NodeSetDTM(nodeIter, xctxt); org.apache.xpath.NodeSetDTM nsdtm=new org.apache.xpath.NodeSetDTM(nodeIter, xctxt); m_last=nsdtm.getLength(); setObject(nsdtm); }
/** * Create a NodeSetDTM, and copy the members of the * given DTMIterator into it. * * @param iterator Iterator which yields Nodes to be made members of the new set. */ public NodeSetDTM(NodeIterator iterator, XPathContext xctxt) { super(); Node node; m_manager = xctxt.getDTMManager(); while (null != (node = iterator.nextNode())) { int handle = xctxt.getDTMHandleFromNode(node); addNodeInDocOrder(handle, xctxt); } }
/** * Create a NodeSetDTM, and copy the members of the * given DTMIterator into it. * * @param iterator Iterator which yields Nodes to be made members of the new set. */ public NodeSetDTM(NodeIterator iterator, XPathContext xctxt) { super(); Node node; m_manager = xctxt.getDTMManager(); while (null != (node = iterator.nextNode())) { int handle = xctxt.getDTMHandleFromNode(node); addNodeInDocOrder(handle, xctxt); } }
/** * 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(); } } } }
/** * 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()); }
/** * Return a java object that's closest to the representation * that should be handed to an extension. * * @return The object that this class wraps */ public Object object() { if (m_DTMXRTreeFrag.getXPathContext() != null) return new org.apache.xml.dtm.ref.DTMNodeIterator((DTMIterator)(new org.apache.xpath.NodeSetDTM(m_dtmRoot, m_DTMXRTreeFrag.getXPathContext().getDTMManager()))); else return super.object(); }
/** * Return a java object that's closest to the representation * that should be handed to an extension. * * @return The object that this class wraps */ public Object object() { if (m_DTMXRTreeFrag.getXPathContext() != null) return new org.apache.xml.dtm.ref.DTMNodeIterator((DTMIterator)(new org.apache.xpath.NodeSetDTM(m_dtmRoot, m_DTMXRTreeFrag.getXPathContext().getDTMManager()))); else return super.object(); }
/** * @see DTMIterator#setRoot(int, Object) */ public void setRoot(int nodeHandle, Object environment) { if(null != m_iter) { XPathContext xctxt = (XPathContext)environment; m_dtmMgr = xctxt.getDTMManager(); m_iter.setRoot(nodeHandle, environment); if(!m_iter.isDocOrdered()) { if(!hasCache()) setShouldCacheNodes(true); runTo(-1); m_next=0; } } else assertion(false, "Can not setRoot on a non-iterated NodeSequence!"); }
/** * @see DTMIterator#setRoot(int, Object) */ public void setRoot(int nodeHandle, Object environment) { if(null != m_iter) { XPathContext xctxt = (XPathContext)environment; m_dtmMgr = xctxt.getDTMManager(); m_iter.setRoot(nodeHandle, environment); if(!m_iter.isDocOrdered()) { if(!hasCache()) setShouldCacheNodes(true); runTo(-1); m_next=0; } } else assertion(false, "Can not setRoot on a non-iterated NodeSequence!"); }
/** * Construct a TransformerImpl. * * @param stylesheet The root of the stylesheet tree. */ public TransformerImpl(StylesheetRoot stylesheet) // throws javax.xml.transform.TransformerException { m_optimizer = stylesheet.getOptimizer(); m_incremental = stylesheet.getIncremental(); m_source_location = stylesheet.getSource_location(); setStylesheet(stylesheet); XPathContext xPath = new XPathContext(this); xPath.setIncremental(m_incremental); xPath.getDTMManager().setIncremental(m_incremental); xPath.setSource_location(m_source_location); xPath.getDTMManager().setSource_location(m_source_location); if (stylesheet.isSecureProcessing()) xPath.setSecureProcessing(true); setXPathContext(xPath); getXPathContext().setNamespaceContext(stylesheet); }
/** * Dereference the variable, and return the reference value. Note that lazy * evaluation will occur. If a variable within scope is not found, a warning * will be sent to the error listener, and an empty nodeset will be returned. * * * @param xctxt The runtime execution context. * * @return The evaluated variable, or an empty nodeset if not found. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt, boolean destructiveOK) throws javax.xml.transform.TransformerException { XNodeSet xns = (XNodeSet)super.execute(xctxt, destructiveOK); DTMManager dtmMgr = xctxt.getDTMManager(); int context = xctxt.getContextNode(); if(dtmMgr.getDTM(xns.getRoot()).getDocument() != dtmMgr.getDTM(context).getDocument()) { Expression expr = (Expression)xns.getContainedIter(); xns = (XNodeSet)expr.asIterator(xctxt, context); } return xns; }