com.sun.org.apache.xml.internal.utils.SystemIDResolver Java Examples
The following examples show how to use
com.sun.org.apache.xml.internal.utils.SystemIDResolver.
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 Bytecoder with Apache License 2.0 | 6 votes |
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 JDKSourceCode1.8 with MIT License | 6 votes |
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 jdk8u60 with GNU General Public License v2.0 | 6 votes |
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 openjdk-8-source with GNU General Public License v2.0 | 6 votes |
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 hottub with GNU General Public License v2.0 | 6 votes |
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 openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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 TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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-backup with GNU General Public License v2.0 | 6 votes |
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 openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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 #10
Source File: LoadDocument.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
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 #11
Source File: LoadDocument.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
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 #12
Source File: TransformerImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * This class should only be used as a DOMCache for the translet if the * URIResolver has been set. * * The method implements XSLTC's DOMCache interface, which is used to * plug in an external document loader into a translet. This method acts * as an adapter between TrAX's URIResolver interface and XSLTC's * DOMCache interface. This approach is simple, but removes the * possibility of using external document caches with XSLTC. * * @param baseURI The base URI used by the document call. * @param href The href argument passed to the document function. * @param translet A reference to the translet requesting the document */ @Override public DOM retrieveDocument(String baseURI, String href, Translet translet) { try { // Argument to document function was: document(''); if (href.length() == 0) { href = baseURI; } /* * Fix for bug 24188 * Incase the _uriResolver.resolve(href,base) is null * try to still retrieve the document before returning null * and throwing the FileNotFoundException in * com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument * */ Source resolvedSource = _uriResolver.resolve(href, baseURI); if (resolvedSource == null) { StreamSource streamSource = new StreamSource( SystemIDResolver.getAbsoluteURI(href, baseURI)); return getDOM(streamSource) ; } return getDOM(resolvedSource); } catch (TransformerException e) { if (_errorListener != null) postErrorToListener("File not found: " + e.getMessage()); return(null); } }
Example #13
Source File: TransformerImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * This class should only be used as a DOMCache for the translet if the * URIResolver has been set. * * The method implements XSLTC's DOMCache interface, which is used to * plug in an external document loader into a translet. This method acts * as an adapter between TrAX's URIResolver interface and XSLTC's * DOMCache interface. This approach is simple, but removes the * possibility of using external document caches with XSLTC. * * @param baseURI The base URI used by the document call. * @param href The href argument passed to the document function. * @param translet A reference to the translet requesting the document */ @Override public DOM retrieveDocument(String baseURI, String href, Translet translet) { try { // Argument to document function was: document(''); if (href.length() == 0) { href = baseURI; } /* * Fix for bug 24188 * Incase the _uriResolver.resolve(href,base) is null * try to still retrieve the document before returning null * and throwing the FileNotFoundException in * com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument * */ Source resolvedSource = _uriResolver.resolve(href, baseURI); if (resolvedSource == null) { StreamSource streamSource = new StreamSource( SystemIDResolver.getAbsoluteURI(href, baseURI)); return getDOM(streamSource) ; } return getDOM(resolvedSource); } catch (TransformerException e) { if (_errorListener != null) postErrorToListener("File not found: " + e.getMessage()); return(null); } }
Example #14
Source File: TransformerImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * This class should only be used as a DOMCache for the translet if the * URIResolver has been set. * * The method implements XSLTC's DOMCache interface, which is used to * plug in an external document loader into a translet. This method acts * as an adapter between TrAX's URIResolver interface and XSLTC's * DOMCache interface. This approach is simple, but removes the * possibility of using external document caches with XSLTC. * * @param baseURI The base URI used by the document call. * @param href The href argument passed to the document function. * @param translet A reference to the translet requesting the document */ @Override public DOM retrieveDocument(String baseURI, String href, Translet translet) { try { // Argument to document function was: document(''); if (href.length() == 0) { href = baseURI; } /* * Fix for bug 24188 * Incase the _uriResolver.resolve(href,base) is null * try to still retrieve the document before returning null * and throwing the FileNotFoundException in * com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument * */ Source resolvedSource = _uriResolver.resolve(href, baseURI); if (resolvedSource == null) { StreamSource streamSource = new StreamSource( SystemIDResolver.getAbsoluteURI(href, baseURI)); return getDOM(streamSource) ; } return getDOM(resolvedSource); } catch (TransformerException e) { if (_errorListener != null) postErrorToListener("File not found: " + e.getMessage()); return(null); } }
Example #15
Source File: LoadDocument.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * 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 #16
Source File: LoadDocument.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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 #17
Source File: LoadDocument.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * 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 #18
Source File: LoadDocument.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * 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 #19
Source File: SAX2DTM.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Receive notification of an unparsed entity declaration. * * <p>By default, do nothing. Application writers may override this * method in a subclass to keep track of the unparsed entities * declared in a document.</p> * * @param name The entity name. * @param publicId The entity public identifier, or null if not * available. * @param systemId The entity system identifier. * @param notationName The name of the associated notation. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see DTDHandler#unparsedEntityDecl * * @throws SAXException */ public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException { if (null == m_entities) { m_entities = new ArrayList<>(); } try { systemId = SystemIDResolver.getAbsoluteURI(systemId, getDocumentBaseURI()); } catch (Exception e) { throw new SAXException(e); } // private static final int ENTITY_FIELD_PUBLICID = 0; m_entities.add(publicId); // private static final int ENTITY_FIELD_SYSTEMID = 1; m_entities.add(systemId); // private static final int ENTITY_FIELD_NOTATIONNAME = 2; m_entities.add(notationName); // private static final int ENTITY_FIELD_NAME = 3; m_entities.add(name); }
Example #20
Source File: TransformerImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * This class should only be used as a DOMCache for the translet if the * URIResolver has been set. * * The method implements XSLTC's DOMCache interface, which is used to * plug in an external document loader into a translet. This method acts * as an adapter between TrAX's URIResolver interface and XSLTC's * DOMCache interface. This approach is simple, but removes the * possibility of using external document caches with XSLTC. * * @param baseURI The base URI used by the document call. * @param href The href argument passed to the document function. * @param translet A reference to the translet requesting the document */ @Override public DOM retrieveDocument(String baseURI, String href, Translet translet) { try { // Argument to document function was: document(''); if (href.length() == 0) { href = baseURI; } /* * Fix for bug 24188 * Incase the _uriResolver.resolve(href,base) is null * try to still retrieve the document before returning null * and throwing the FileNotFoundException in * com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument * */ Source resolvedSource = _uriResolver.resolve(href, baseURI); if (resolvedSource == null) { StreamSource streamSource = new StreamSource( SystemIDResolver.getAbsoluteURI(href, baseURI)); return getDOM(streamSource) ; } return getDOM(resolvedSource); } catch (TransformerException e) { if (_errorListener != null) postErrorToListener("File not found: " + e.getMessage()); return(null); } }
Example #21
Source File: TransformerImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * This class should only be used as a DOMCache for the translet if the * URIResolver has been set. * * The method implements XSLTC's DOMCache interface, which is used to * plug in an external document loader into a translet. This method acts * as an adapter between TrAX's URIResolver interface and XSLTC's * DOMCache interface. This approach is simple, but removes the * possibility of using external document caches with XSLTC. * * @param baseURI The base URI used by the document call. * @param href The href argument passed to the document function. * @param translet A reference to the translet requesting the document */ @Override public DOM retrieveDocument(String baseURI, String href, Translet translet) { try { // Argument to document function was: document(''); if (href.length() == 0) { href = baseURI; } /* * Fix for bug 24188 * Incase the _uriResolver.resolve(href,base) is null * try to still retrieve the document before returning null * and throwing the FileNotFoundException in * com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument * */ Source resolvedSource = _uriResolver.resolve(href, baseURI); if (resolvedSource == null) { StreamSource streamSource = new StreamSource( SystemIDResolver.getAbsoluteURI(href, baseURI)); return getDOM(streamSource) ; } return getDOM(resolvedSource); } catch (TransformerException e) { if (_errorListener != null) postErrorToListener("File not found: " + e.getMessage()); return(null); } }
Example #22
Source File: TransformerImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * This class should only be used as a DOMCache for the translet if the * URIResolver has been set. * * The method implements XSLTC's DOMCache interface, which is used to * plug in an external document loader into a translet. This method acts * as an adapter between TrAX's URIResolver interface and XSLTC's * DOMCache interface. This approach is simple, but removes the * possibility of using external document caches with XSLTC. * * @param baseURI The base URI used by the document call. * @param href The href argument passed to the document function. * @param translet A reference to the translet requesting the document */ @Override public DOM retrieveDocument(String baseURI, String href, Translet translet) { try { // Argument to document function was: document(''); if (href.length() == 0) { href = baseURI; } /* * Fix for bug 24188 * Incase the _uriResolver.resolve(href,base) is null * try to still retrieve the document before returning null * and throwing the FileNotFoundException in * com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument * */ Source resolvedSource = _uriResolver.resolve(href, baseURI); if (resolvedSource == null) { StreamSource streamSource = new StreamSource( SystemIDResolver.getAbsoluteURI(href, baseURI)); return getDOM(streamSource) ; } return getDOM(resolvedSource); } catch (TransformerException e) { if (_errorListener != null) postErrorToListener("File not found: " + e.getMessage()); return(null); } }
Example #23
Source File: LoadDocument.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * 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 #24
Source File: LoadDocument.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * 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 #25
Source File: TransformerImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * This class should only be used as a DOMCache for the translet if the * URIResolver has been set. * * The method implements XSLTC's DOMCache interface, which is used to * plug in an external document loader into a translet. This method acts * as an adapter between TrAX's URIResolver interface and XSLTC's * DOMCache interface. This approach is simple, but removes the * possibility of using external document caches with XSLTC. * * @param baseURI The base URI used by the document call. * @param href The href argument passed to the document function. * @param translet A reference to the translet requesting the document */ @Override public DOM retrieveDocument(String baseURI, String href, Translet translet) { try { // Argument to document function was: document(''); if (href.length() == 0) { href = baseURI; } /* * Fix for bug 24188 * Incase the _uriResolver.resolve(href,base) is null * try to still retrieve the document before returning null * and throwing the FileNotFoundException in * com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument * */ Source resolvedSource = _uriResolver.resolve(href, baseURI); if (resolvedSource == null) { StreamSource streamSource = new StreamSource( SystemIDResolver.getAbsoluteURI(href, baseURI)); return getDOM(streamSource) ; } return getDOM(resolvedSource); } catch (TransformerException e) { if (_errorListener != null) postErrorToListener("File not found: " + e.getMessage()); return(null); } }
Example #26
Source File: TransformerImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * This class should only be used as a DOMCache for the translet if the * URIResolver has been set. * * The method implements XSLTC's DOMCache interface, which is used to * plug in an external document loader into a translet. This method acts * as an adapter between TrAX's URIResolver interface and XSLTC's * DOMCache interface. This approach is simple, but removes the * possibility of using external document caches with XSLTC. * * @param baseURI The base URI used by the document call. * @param href The href argument passed to the document function. * @param translet A reference to the translet requesting the document */ @Override public DOM retrieveDocument(String baseURI, String href, Translet translet) { try { // Argument to document function was: document(''); if (href.length() == 0) { href = baseURI; } /* * Fix for bug 24188 * Incase the _uriResolver.resolve(href,base) is null * try to still retrieve the document before returning null * and throwing the FileNotFoundException in * com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument * */ Source resolvedSource = _uriResolver.resolve(href, baseURI); if (resolvedSource == null) { StreamSource streamSource = new StreamSource( SystemIDResolver.getAbsoluteURI(href, baseURI)); return getDOM(streamSource) ; } return getDOM(resolvedSource); } catch (TransformerException e) { if (_errorListener != null) postErrorToListener("File not found: " + e.getMessage()); return(null); } }
Example #27
Source File: LoadDocument.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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 #28
Source File: SAX2DTM.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Receive notification of an unparsed entity declaration. * * <p>By default, do nothing. Application writers may override this * method in a subclass to keep track of the unparsed entities * declared in a document.</p> * * @param name The entity name. * @param publicId The entity public identifier, or null if not * available. * @param systemId The entity system identifier. * @param notationName The name of the associated notation. * @throws SAXException Any SAX exception, possibly * wrapping another exception. * @see DTDHandler#unparsedEntityDecl * * @throws SAXException */ public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException { if (null == m_entities) { m_entities = new ArrayList<>(); } try { systemId = SystemIDResolver.getAbsoluteURI(systemId, getDocumentBaseURI()); } catch (Exception e) { throw new SAXException(e); } // private static final int ENTITY_FIELD_PUBLICID = 0; m_entities.add(publicId); // private static final int ENTITY_FIELD_SYSTEMID = 1; m_entities.add(systemId); // private static final int ENTITY_FIELD_NOTATIONNAME = 2; m_entities.add(notationName); // private static final int ENTITY_FIELD_NAME = 3; m_entities.add(name); }
Example #29
Source File: LoadDocument.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * 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 #30
Source File: LoadDocument.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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); } }