com.sun.org.apache.xml.internal.dtm.DTMManager

Here are the examples of the java api class com.sun.org.apache.xml.internal.dtm.DTMManager taken from open source projects.

1. VariableSafeAbsRef#execute()

Project: openjdk
File: VariableSafeAbsRef.java
/**
   * 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;
}

2. LoadDocument#document()

Project: openjdk
File: LoadDocument.java
/**
     * Create a DTMAxisIterator for the newdom. This is currently only
     * used to create an iterator for the cached stylesheet DOM.
     *
     * @param newdom the cached stylesheet DOM
     * @param translet the translet
     * @param the main dom (should be a MultiDOM)
     * @return a DTMAxisIterator from the document root
     */
private static DTMAxisIterator document(DOM newdom, AbstractTranslet translet, DOM dom) throws Exception {
    DTMManager dtmManager = ((MultiDOM) dom).getDTMManager();
    // Need to migrate the cached DTM to the new DTMManager
    if (dtmManager != null && newdom instanceof DTM) {
        ((DTM) newdom).migrateTo(dtmManager);
    }
    translet.prepassDocument(newdom);
    // Wrap the DOM object in a DOM adapter and add to multiplexer
    final DOMAdapter domAdapter = translet.makeDOMAdapter(newdom);
    ((MultiDOM) dom).addDOMAdapter(domAdapter);
    // Create index for any key elements
    translet.buildKeys(domAdapter, null, null, newdom.getDocument());
    // Return a singleton iterator containing the root node
    return new SingletonIterator(newdom.getDocument(), true);
}

3. NodeSequence#getDTM()

Project: openjdk
File: NodeSequence.java
/**
   * @see DTMIterator#getDTM(int)
   */
public DTM getDTM(int nodeHandle) {
    DTMManager mgr = getDTMManager();
    if (null != mgr)
        return getDTMManager().getDTM(nodeHandle);
    else {
        assertion(false, "Can not get a DTM Unless a DTMManager has been set!");
        return null;
    }
}

4. BasisLibrary#nodeList2IteratorUsingHandleFromNode()

Project: openjdk
File: BasisLibrary.java
/**
     * In a perfect world, this would be the implementation for
     * nodeList2Iterator. In reality, though, this causes a
     * ClassCastException in getDTMHandleFromNode because SAXImpl is
     * not an instance of DOM2DTM. So we use the more lengthy
     * implementation below until this issue has been addressed.
     *
     * @see org.apache.xml.dtm.ref.DTMManagerDefault#getDTMHandleFromNode
     */
private static DTMAxisIterator nodeList2IteratorUsingHandleFromNode(org.w3c.dom.NodeList nodeList, Translet translet, DOM dom) {
    final int n = nodeList.getLength();
    final int[] dtmHandles = new int[n];
    DTMManager dtmManager = null;
    if (dom instanceof MultiDOM)
        dtmManager = ((MultiDOM) dom).getDTMManager();
    for (int i = 0; i < n; ++i) {
        org.w3c.dom.Node node = nodeList.item(i);
        int handle;
        if (dtmManager != null) {
            handle = dtmManager.getDTMHandleFromNode(node);
        } else if (node instanceof DTMNodeProxy && ((DTMNodeProxy) node).getDTM() == dom) {
            handle = ((DTMNodeProxy) node).getDTMNodeNumber();
        } else {
            runTimeError(RUN_TIME_INTERNAL_ERR, "need MultiDOM");
            return null;
        }
        dtmHandles[i] = handle;
        System.out.println("Node " + i + " has handle 0x" + Integer.toString(handle, 16));
    }
    return new ArrayNodeListIterator(dtmHandles);
}