Java Code Examples for com.sun.org.apache.xml.internal.utils.SystemIDResolver#getAbsoluteURIFromRelative()

The following examples show how to use com.sun.org.apache.xml.internal.utils.SystemIDResolver#getAbsoluteURIFromRelative() . 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: LoadDocument.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example 2
Source File: LoadDocument.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example 3
Source File: LoadDocument.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example 4
Source File: LoadDocument.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example 5
Source File: LoadDocument.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example 6
Source File: LoadDocument.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example 7
Source File: LoadDocument.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example 8
Source File: LoadDocument.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static DTMAxisIterator document(DTMAxisIterator arg1,
                                        String baseURI,
                                        AbstractTranslet translet, DOM dom)
throws Exception
{
    UnionIterator union = new UnionIterator(dom);
    int node = DTM.NULL;

    while ((node = arg1.next()) != DTM.NULL) {
        String uri = dom.getStringValueX(node);
        //document(node-set) if true;  document(node-set,node-set) if false
        if (baseURI  == null) {
           baseURI = dom.getDocumentURI(node);
           if (!SystemIDResolver.isAbsoluteURI(baseURI))
                baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
        }
        union.addIterator(document(uri, baseURI, translet, dom));
    }
    return(union);
}
 
Example 9
Source File: LoadDocument.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 2 arguments arg1 and arg2.  document(Obj, node-set) call
 */
public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2,
                        String xslURI, AbstractTranslet translet, DOM dom)
throws TransletException {
    String baseURI = null;
    final int arg2FirstNode = arg2.next();
    if (arg2FirstNode == DTMAxisIterator.END) {
        //  the second argument node-set is empty
        return EmptyIterator.getInstance();
    } else {
        //System.err.println("arg2FirstNode name: "
        //                   + dom.getNodeName(arg2FirstNode )+"["
        //                   +Integer.toHexString(arg2FirstNode )+"]");
        baseURI = dom.getDocumentURI(arg2FirstNode);
        if (!SystemIDResolver.isAbsoluteURI(baseURI))
           baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
    }

    try {
        if (arg1 instanceof String) {
            if (((String)arg1).length() == 0) {
                return document(xslURI, "", translet, dom);
            } else {
                return document((String)arg1, baseURI, translet, dom);
            }
        } else if (arg1 instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg1, baseURI, translet, dom);
        } else {
            final String err = "document("+arg1.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example 10
Source File: LoadDocument.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 2 arguments arg1 and arg2.  document(Obj, node-set) call
 */
public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2,
                        String xslURI, AbstractTranslet translet, DOM dom)
throws TransletException {
    String baseURI = null;
    final int arg2FirstNode = arg2.next();
    if (arg2FirstNode == DTMAxisIterator.END) {
        //  the second argument node-set is empty
        return EmptyIterator.getInstance();
    } else {
        //System.err.println("arg2FirstNode name: "
        //                   + dom.getNodeName(arg2FirstNode )+"["
        //                   +Integer.toHexString(arg2FirstNode )+"]");
        baseURI = dom.getDocumentURI(arg2FirstNode);
        if (!SystemIDResolver.isAbsoluteURI(baseURI))
           baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
    }

    try {
        if (arg1 instanceof String) {
            if (((String)arg1).length() == 0) {
                return document(xslURI, "", translet, dom);
            } else {
                return document((String)arg1, baseURI, translet, dom);
            }
        } else if (arg1 instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg1, baseURI, translet, dom);
        } else {
            final String err = "document("+arg1.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example 11
Source File: LoadDocument.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 2 arguments arg1 and arg2.  document(Obj, node-set) call
 */
public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2,
                        String xslURI, AbstractTranslet translet, DOM dom)
throws TransletException {
    String baseURI = null;
    final int arg2FirstNode = arg2.next();
    if (arg2FirstNode == DTMAxisIterator.END) {
        //  the second argument node-set is empty
        return EmptyIterator.getInstance();
    } else {
        //System.err.println("arg2FirstNode name: "
        //                   + dom.getNodeName(arg2FirstNode )+"["
        //                   +Integer.toHexString(arg2FirstNode )+"]");
        baseURI = dom.getDocumentURI(arg2FirstNode);
        if (!SystemIDResolver.isAbsoluteURI(baseURI))
           baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
    }

    try {
        if (arg1 instanceof String) {
            if (((String)arg1).length() == 0) {
                return document(xslURI, "", translet, dom);
            } else {
                return document((String)arg1, baseURI, translet, dom);
            }
        } else if (arg1 instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg1, baseURI, translet, dom);
        } else {
            final String err = "document("+arg1.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example 12
Source File: LoadDocument.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 2 arguments arg1 and arg2.  document(Obj, node-set) call
 */
public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2,
                        String xslURI, AbstractTranslet translet, DOM dom)
throws TransletException {
    String baseURI = null;
    final int arg2FirstNode = arg2.next();
    if (arg2FirstNode == DTMAxisIterator.END) {
        //  the second argument node-set is empty
        return EmptyIterator.getInstance();
    } else {
        //System.err.println("arg2FirstNode name: "
        //                   + dom.getNodeName(arg2FirstNode )+"["
        //                   +Integer.toHexString(arg2FirstNode )+"]");
        baseURI = dom.getDocumentURI(arg2FirstNode);
        if (!SystemIDResolver.isAbsoluteURI(baseURI))
           baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
    }

    try {
        if (arg1 instanceof String) {
            if (((String)arg1).length() == 0) {
                return document(xslURI, "", translet, dom);
            } else {
                return document((String)arg1, baseURI, translet, dom);
            }
        } else if (arg1 instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg1, baseURI, translet, dom);
        } else {
            final String err = "document("+arg1.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example 13
Source File: LoadDocument.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 2 arguments arg1 and arg2.  document(Obj, node-set) call
 */
public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2,
                        String xslURI, AbstractTranslet translet, DOM dom)
throws TransletException {
    String baseURI = null;
    final int arg2FirstNode = arg2.next();
    if (arg2FirstNode == DTMAxisIterator.END) {
        //  the second argument node-set is empty
        return EmptyIterator.getInstance();
    } else {
        //System.err.println("arg2FirstNode name: "
        //                   + dom.getNodeName(arg2FirstNode )+"["
        //                   +Integer.toHexString(arg2FirstNode )+"]");
        baseURI = dom.getDocumentURI(arg2FirstNode);
        if (!SystemIDResolver.isAbsoluteURI(baseURI))
           baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
    }

    try {
        if (arg1 instanceof String) {
            if (((String)arg1).length() == 0) {
                return document(xslURI, "", translet, dom);
            } else {
                return document((String)arg1, baseURI, translet, dom);
            }
        } else if (arg1 instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg1, baseURI, translet, dom);
        } else {
            final String err = "document("+arg1.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example 14
Source File: LoadDocument.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 2 arguments arg1 and arg2.  document(Obj, node-set) call
 */
public static DTMAxisIterator documentF(Object arg1, DTMAxisIterator arg2,
                        String xslURI, AbstractTranslet translet, DOM dom)
throws TransletException {
    String baseURI = null;
    final int arg2FirstNode = arg2.next();
    if (arg2FirstNode == DTMAxisIterator.END) {
        //  the second argument node-set is empty
        return EmptyIterator.getInstance();
    } else {
        //System.err.println("arg2FirstNode name: "
        //                   + dom.getNodeName(arg2FirstNode )+"["
        //                   +Integer.toHexString(arg2FirstNode )+"]");
        baseURI = dom.getDocumentURI(arg2FirstNode);
        if (!SystemIDResolver.isAbsoluteURI(baseURI))
           baseURI = SystemIDResolver.getAbsoluteURIFromRelative(baseURI);
    }

    try {
        if (arg1 instanceof String) {
            if (((String)arg1).length() == 0) {
                return document(xslURI, "", translet, dom);
            } else {
                return document((String)arg1, baseURI, translet, dom);
            }
        } else if (arg1 instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg1, baseURI, translet, dom);
        } else {
            final String err = "document("+arg1.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example 15
Source File: LoadDocument.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 1 arguments arg.  document(Obj) call
 */
public static DTMAxisIterator documentF(Object arg, String xslURI,
                AbstractTranslet translet, DOM dom)
throws TransletException {
    try {
        if (arg instanceof String) {
            if (xslURI == null )
                xslURI = "";

            String baseURI = xslURI;
            if (!SystemIDResolver.isAbsoluteURI(xslURI))
               baseURI = SystemIDResolver.getAbsoluteURIFromRelative(xslURI);

            String href = (String)arg;
            if (href.length() == 0) {
                href = "";
                // %OPT% Optimization to cache the stylesheet DOM.
                // The stylesheet DOM is built once and cached
                // in the Templates object.
                TemplatesImpl templates = (TemplatesImpl)translet.getTemplates();
                DOM sdom = null;
                if (templates != null) {
                    sdom = templates.getStylesheetDOM();
                }

                // If the cached dom exists, we need to migrate it
                // to the new DTMManager and create a DTMAxisIterator
                // for the document.
                if (sdom != null) {
                    return document(sdom, translet, dom);
                }
                else {
                    return document(href, baseURI, translet, dom, true);
                }
            }
            else {
                return document(href, baseURI, translet, dom);
            }
        } else if (arg instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg, null, translet, dom);
        } else {
            final String err = "document("+arg.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example 16
Source File: LoadDocument.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 1 arguments arg.  document(Obj) call
 */
public static DTMAxisIterator documentF(Object arg, String xslURI,
                AbstractTranslet translet, DOM dom)
throws TransletException {
    try {
        if (arg instanceof String) {
            if (xslURI == null )
                xslURI = "";

            String baseURI = xslURI;
            if (!SystemIDResolver.isAbsoluteURI(xslURI))
               baseURI = SystemIDResolver.getAbsoluteURIFromRelative(xslURI);

            String href = (String)arg;
            if (href.length() == 0) {
                href = "";
                // %OPT% Optimization to cache the stylesheet DOM.
                // The stylesheet DOM is built once and cached
                // in the Templates object.
                TemplatesImpl templates = (TemplatesImpl)translet.getTemplates();
                DOM sdom = null;
                if (templates != null) {
                    sdom = templates.getStylesheetDOM();
                }

                // If the cached dom exists, we need to migrate it
                // to the new DTMManager and create a DTMAxisIterator
                // for the document.
                if (sdom != null) {
                    return document(sdom, translet, dom);
                }
                else {
                    return document(href, baseURI, translet, dom, true);
                }
            }
            else {
                return document(href, baseURI, translet, dom);
            }
        } else if (arg instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg, null, translet, dom);
        } else {
            final String err = "document("+arg.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example 17
Source File: LoadDocument.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 1 arguments arg.  document(Obj) call
 */
public static DTMAxisIterator documentF(Object arg, String xslURI,
                AbstractTranslet translet, DOM dom)
throws TransletException {
    try {
        if (arg instanceof String) {
            if (xslURI == null )
                xslURI = "";

            String baseURI = xslURI;
            if (!SystemIDResolver.isAbsoluteURI(xslURI))
               baseURI = SystemIDResolver.getAbsoluteURIFromRelative(xslURI);

            String href = (String)arg;
            if (href.length() == 0) {
                href = "";
                // %OPT% Optimization to cache the stylesheet DOM.
                // The stylesheet DOM is built once and cached
                // in the Templates object.
                TemplatesImpl templates = (TemplatesImpl)translet.getTemplates();
                DOM sdom = null;
                if (templates != null) {
                    sdom = templates.getStylesheetDOM();
                }

                // If the cached dom exists, we need to migrate it
                // to the new DTMManager and create a DTMAxisIterator
                // for the document.
                if (sdom != null) {
                    return document(sdom, translet, dom);
                }
                else {
                    return document(href, baseURI, translet, dom, true);
                }
            }
            else {
                return document(href, baseURI, translet, dom);
            }
        } else if (arg instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg, null, translet, dom);
        } else {
            final String err = "document("+arg.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example 18
Source File: LoadDocument.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 1 arguments arg.  document(Obj) call
 */
public static DTMAxisIterator documentF(Object arg, String xslURI,
                AbstractTranslet translet, DOM dom)
throws TransletException {
    try {
        if (arg instanceof String) {
            if (xslURI == null )
                xslURI = "";

            String baseURI = xslURI;
            if (!SystemIDResolver.isAbsoluteURI(xslURI))
               baseURI = SystemIDResolver.getAbsoluteURIFromRelative(xslURI);

            String href = (String)arg;
            if (href.length() == 0) {
                href = "";
                // %OPT% Optimization to cache the stylesheet DOM.
                // The stylesheet DOM is built once and cached
                // in the Templates object.
                TemplatesImpl templates = (TemplatesImpl)translet.getTemplates();
                DOM sdom = null;
                if (templates != null) {
                    sdom = templates.getStylesheetDOM();
                }

                // If the cached dom exists, we need to migrate it
                // to the new DTMManager and create a DTMAxisIterator
                // for the document.
                if (sdom != null) {
                    return document(sdom, translet, dom);
                }
                else {
                    return document(href, baseURI, translet, dom, true);
                }
            }
            else {
                return document(href, baseURI, translet, dom);
            }
        } else if (arg instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg, null, translet, dom);
        } else {
            final String err = "document("+arg.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example 19
Source File: LoadDocument.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 1 arguments arg.  document(Obj) call
 */
public static DTMAxisIterator documentF(Object arg, String xslURI,
                AbstractTranslet translet, DOM dom)
throws TransletException {
    try {
        if (arg instanceof String) {
            if (xslURI == null )
                xslURI = "";

            String baseURI = xslURI;
            if (!SystemIDResolver.isAbsoluteURI(xslURI))
               baseURI = SystemIDResolver.getAbsoluteURIFromRelative(xslURI);

            String href = (String)arg;
            if (href.length() == 0) {
                href = "";
                // %OPT% Optimization to cache the stylesheet DOM.
                // The stylesheet DOM is built once and cached
                // in the Templates object.
                TemplatesImpl templates = (TemplatesImpl)translet.getTemplates();
                DOM sdom = null;
                if (templates != null) {
                    sdom = templates.getStylesheetDOM();
                }

                // If the cached dom exists, we need to migrate it
                // to the new DTMManager and create a DTMAxisIterator
                // for the document.
                if (sdom != null) {
                    return document(sdom, translet, dom);
                }
                else {
                    return document(href, baseURI, translet, dom, true);
                }
            }
            else {
                return document(href, baseURI, translet, dom);
            }
        } else if (arg instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg, null, translet, dom);
        } else {
            final String err = "document("+arg.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
Example 20
Source File: LoadDocument.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Interprets the arguments passed from the document() function (see
 * com/sun/org/apache/xalan/internal/xsltc/compiler/DocumentCall.java) and returns an
 * iterator containing the requested nodes. Builds a union-iterator if
 * several documents are requested.
 * 1 arguments arg.  document(Obj) call
 */
public static DTMAxisIterator documentF(Object arg, String xslURI,
                AbstractTranslet translet, DOM dom)
throws TransletException {
    try {
        if (arg instanceof String) {
            if (xslURI == null )
                xslURI = "";

            String baseURI = xslURI;
            if (!SystemIDResolver.isAbsoluteURI(xslURI))
               baseURI = SystemIDResolver.getAbsoluteURIFromRelative(xslURI);

            String href = (String)arg;
            if (href.length() == 0) {
                href = "";
                // %OPT% Optimization to cache the stylesheet DOM.
                // The stylesheet DOM is built once and cached
                // in the Templates object.
                TemplatesImpl templates = (TemplatesImpl)translet.getTemplates();
                DOM sdom = null;
                if (templates != null) {
                    sdom = templates.getStylesheetDOM();
                }

                // If the cached dom exists, we need to migrate it
                // to the new DTMManager and create a DTMAxisIterator
                // for the document.
                if (sdom != null) {
                    return document(sdom, translet, dom);
                }
                else {
                    return document(href, baseURI, translet, dom, true);
                }
            }
            else {
                return document(href, baseURI, translet, dom);
            }
        } else if (arg instanceof DTMAxisIterator) {
            return document((DTMAxisIterator)arg, null, translet, dom);
        } else {
            final String err = "document("+arg.toString()+")";
            throw new IllegalArgumentException(err);
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}