Java Code Examples for org.w3c.dom.ls.LSInput#getByteStream()
The following examples show how to use
org.w3c.dom.ls.LSInput#getByteStream() .
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: ValidatorHandlerImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Resolves the given resource and adapts the <code>LSInput</code> * returned into an <code>InputSource</code>. */ public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { if (fEntityResolver != null) { LSInput lsInput = fEntityResolver.resolveResource(XML_TYPE, null, publicId, systemId, baseURI); if (lsInput != null) { final String pubId = lsInput.getPublicId(); final String sysId = lsInput.getSystemId(); final String baseSystemId = lsInput.getBaseURI(); final Reader charStream = lsInput.getCharacterStream(); final InputStream byteStream = lsInput.getByteStream(); final String data = lsInput.getStringData(); final String encoding = lsInput.getEncoding(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. For consistency * with the DOM Level 3 Load and Save Recommendation * use the same lookup order here. */ InputSource inputSource = new InputSource(); inputSource.setPublicId(pubId); inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(systemId, baseSystemId) : systemId); if (charStream != null) { inputSource.setCharacterStream(charStream); } else if (byteStream != null) { inputSource.setByteStream(byteStream); } else if (data != null && data.length() != 0) { inputSource.setCharacterStream(new StringReader(data)); } inputSource.setEncoding(encoding); return inputSource; } } return null; }
Example 2
Source File: ValidatorHandlerImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Resolves the given resource and adapts the <code>LSInput</code> * returned into an <code>InputSource</code>. */ public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { if (fEntityResolver != null) { LSInput lsInput = fEntityResolver.resolveResource(XML_TYPE, null, publicId, systemId, baseURI); if (lsInput != null) { final String pubId = lsInput.getPublicId(); final String sysId = lsInput.getSystemId(); final String baseSystemId = lsInput.getBaseURI(); final Reader charStream = lsInput.getCharacterStream(); final InputStream byteStream = lsInput.getByteStream(); final String data = lsInput.getStringData(); final String encoding = lsInput.getEncoding(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. For consistency * with the DOM Level 3 Load and Save Recommendation * use the same lookup order here. */ InputSource inputSource = new InputSource(); inputSource.setPublicId(pubId); inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(systemId, baseSystemId) : systemId); if (charStream != null) { inputSource.setCharacterStream(charStream); } else if (byteStream != null) { inputSource.setByteStream(byteStream); } else if (data != null && data.length() != 0) { inputSource.setCharacterStream(new StringReader(data)); } inputSource.setEncoding(encoding); return inputSource; } } return null; }
Example 3
Source File: MetsLSResolverTest.java From proarc with GNU General Public License v3.0 | 5 votes |
@Test public void testResolveResource() throws Exception { MetsLSResolver resolver = MetsLSResolver.getInstance(); LSInput input = resolver.resolveResource(null, null, null, "http://www.openarchives.org/OAI/2.0/oai_dc.xsd", null); assertNotNull(input); InputStream stream = input.getByteStream(); assertNotNull(stream); stream.close(); }
Example 4
Source File: ValidatorHandlerImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Resolves the given resource and adapts the <code>LSInput</code> * returned into an <code>InputSource</code>. */ public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { if (fEntityResolver != null) { LSInput lsInput = fEntityResolver.resolveResource(XML_TYPE, null, publicId, systemId, baseURI); if (lsInput != null) { final String pubId = lsInput.getPublicId(); final String sysId = lsInput.getSystemId(); final String baseSystemId = lsInput.getBaseURI(); final Reader charStream = lsInput.getCharacterStream(); final InputStream byteStream = lsInput.getByteStream(); final String data = lsInput.getStringData(); final String encoding = lsInput.getEncoding(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. For consistency * with the DOM Level 3 Load and Save Recommendation * use the same lookup order here. */ InputSource inputSource = new InputSource(); inputSource.setPublicId(pubId); inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(systemId, baseSystemId) : systemId); if (charStream != null) { inputSource.setCharacterStream(charStream); } else if (byteStream != null) { inputSource.setByteStream(byteStream); } else if (data != null && data.length() != 0) { inputSource.setCharacterStream(new StringReader(data)); } inputSource.setEncoding(encoding); return inputSource; } } return null; }
Example 5
Source File: ValidatorHandlerImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Resolves the given resource and adapts the <code>LSInput</code> * returned into an <code>InputSource</code>. */ public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { if (fEntityResolver != null) { LSInput lsInput = fEntityResolver.resolveResource(XML_TYPE, null, publicId, systemId, baseURI); if (lsInput != null) { final String pubId = lsInput.getPublicId(); final String sysId = lsInput.getSystemId(); final String baseSystemId = lsInput.getBaseURI(); final Reader charStream = lsInput.getCharacterStream(); final InputStream byteStream = lsInput.getByteStream(); final String data = lsInput.getStringData(); final String encoding = lsInput.getEncoding(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. For consistency * with the DOM Level 3 Load and Save Recommendation * use the same lookup order here. */ InputSource inputSource = new InputSource(); inputSource.setPublicId(pubId); inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(systemId, baseSystemId) : systemId); if (charStream != null) { inputSource.setCharacterStream(charStream); } else if (byteStream != null) { inputSource.setByteStream(byteStream); } else if (data != null && data.length() != 0) { inputSource.setCharacterStream(new StringReader(data)); } inputSource.setEncoding(encoding); return inputSource; } } return null; }
Example 6
Source File: ValidatorHandlerImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Resolves the given resource and adapts the <code>LSInput</code> * returned into an <code>InputSource</code>. */ public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { if (fEntityResolver != null) { LSInput lsInput = fEntityResolver.resolveResource(XML_TYPE, null, publicId, systemId, baseURI); if (lsInput != null) { final String pubId = lsInput.getPublicId(); final String sysId = lsInput.getSystemId(); final String baseSystemId = lsInput.getBaseURI(); final Reader charStream = lsInput.getCharacterStream(); final InputStream byteStream = lsInput.getByteStream(); final String data = lsInput.getStringData(); final String encoding = lsInput.getEncoding(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. For consistency * with the DOM Level 3 Load and Save Recommendation * use the same lookup order here. */ InputSource inputSource = new InputSource(); inputSource.setPublicId(pubId); inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(systemId, baseSystemId) : systemId); if (charStream != null) { inputSource.setCharacterStream(charStream); } else if (byteStream != null) { inputSource.setByteStream(byteStream); } else if (data != null && data.length() != 0) { inputSource.setCharacterStream(new StringReader(data)); } inputSource.setEncoding(encoding); return inputSource; } } return null; }
Example 7
Source File: ValidatorHandlerImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Resolves the given resource and adapts the <code>LSInput</code> * returned into an <code>InputSource</code>. */ public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { if (fEntityResolver != null) { LSInput lsInput = fEntityResolver.resolveResource(XML_TYPE, null, publicId, systemId, baseURI); if (lsInput != null) { final String pubId = lsInput.getPublicId(); final String sysId = lsInput.getSystemId(); final String baseSystemId = lsInput.getBaseURI(); final Reader charStream = lsInput.getCharacterStream(); final InputStream byteStream = lsInput.getByteStream(); final String data = lsInput.getStringData(); final String encoding = lsInput.getEncoding(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. For consistency * with the DOM Level 3 Load and Save Recommendation * use the same lookup order here. */ InputSource inputSource = new InputSource(); inputSource.setPublicId(pubId); inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(systemId, baseSystemId) : systemId); if (charStream != null) { inputSource.setCharacterStream(charStream); } else if (byteStream != null) { inputSource.setByteStream(byteStream); } else if (data != null && data.length() != 0) { inputSource.setCharacterStream(new StringReader(data)); } inputSource.setEncoding(encoding); return inputSource; } } return null; }
Example 8
Source File: ValidatorHandlerImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Resolves the given resource and adapts the <code>LSInput</code> * returned into an <code>InputSource</code>. */ public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { if (fEntityResolver != null) { LSInput lsInput = fEntityResolver.resolveResource(XML_TYPE, null, publicId, systemId, baseURI); if (lsInput != null) { final String pubId = lsInput.getPublicId(); final String sysId = lsInput.getSystemId(); final String baseSystemId = lsInput.getBaseURI(); final Reader charStream = lsInput.getCharacterStream(); final InputStream byteStream = lsInput.getByteStream(); final String data = lsInput.getStringData(); final String encoding = lsInput.getEncoding(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. For consistency * with the DOM Level 3 Load and Save Recommendation * use the same lookup order here. */ InputSource inputSource = new InputSource(); inputSource.setPublicId(pubId); inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(systemId, baseSystemId) : systemId); if (charStream != null) { inputSource.setCharacterStream(charStream); } else if (byteStream != null) { inputSource.setByteStream(byteStream); } else if (data != null && data.length() != 0) { inputSource.setCharacterStream(new StringReader(data)); } inputSource.setEncoding(encoding); return inputSource; } } return null; }
Example 9
Source File: ValidatorHandlerImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Resolves the given resource and adapts the <code>LSInput</code> * returned into an <code>InputSource</code>. */ public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { if (fEntityResolver != null) { LSInput lsInput = fEntityResolver.resolveResource(XML_TYPE, null, publicId, systemId, baseURI); if (lsInput != null) { final String pubId = lsInput.getPublicId(); final String sysId = lsInput.getSystemId(); final String baseSystemId = lsInput.getBaseURI(); final Reader charStream = lsInput.getCharacterStream(); final InputStream byteStream = lsInput.getByteStream(); final String data = lsInput.getStringData(); final String encoding = lsInput.getEncoding(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. For consistency * with the DOM Level 3 Load and Save Recommendation * use the same lookup order here. */ InputSource inputSource = new InputSource(); inputSource.setPublicId(pubId); inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(systemId, baseSystemId) : systemId); if (charStream != null) { inputSource.setCharacterStream(charStream); } else if (byteStream != null) { inputSource.setByteStream(byteStream); } else if (data != null && data.length() != 0) { inputSource.setCharacterStream(new StringReader(data)); } inputSource.setEncoding(encoding); return inputSource; } } return null; }
Example 10
Source File: ValidatorHandlerImpl.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Resolves the given resource and adapts the <code>LSInput</code> * returned into an <code>InputSource</code>. */ public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { if (fEntityResolver != null) { LSInput lsInput = fEntityResolver.resolveResource(XML_TYPE, null, publicId, systemId, baseURI); if (lsInput != null) { final String pubId = lsInput.getPublicId(); final String sysId = lsInput.getSystemId(); final String baseSystemId = lsInput.getBaseURI(); final Reader charStream = lsInput.getCharacterStream(); final InputStream byteStream = lsInput.getByteStream(); final String data = lsInput.getStringData(); final String encoding = lsInput.getEncoding(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. For consistency * with the DOM Level 3 Load and Save Recommendation * use the same lookup order here. */ InputSource inputSource = new InputSource(); inputSource.setPublicId(pubId); inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(sysId, baseSystemId) : sysId); if (charStream != null) { inputSource.setCharacterStream(charStream); } else if (byteStream != null) { inputSource.setByteStream(byteStream); } else if (data != null && data.length() != 0) { inputSource.setCharacterStream(new StringReader(data)); } inputSource.setEncoding(encoding); return inputSource; } } return null; }
Example 11
Source File: ValidatorHandlerImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Resolves the given resource and adapts the <code>LSInput</code> * returned into an <code>InputSource</code>. */ public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException { if (fEntityResolver != null) { LSInput lsInput = fEntityResolver.resolveResource(XML_TYPE, null, publicId, systemId, baseURI); if (lsInput != null) { final String pubId = lsInput.getPublicId(); final String sysId = lsInput.getSystemId(); final String baseSystemId = lsInput.getBaseURI(); final Reader charStream = lsInput.getCharacterStream(); final InputStream byteStream = lsInput.getByteStream(); final String data = lsInput.getStringData(); final String encoding = lsInput.getEncoding(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. For consistency * with the DOM Level 3 Load and Save Recommendation * use the same lookup order here. */ InputSource inputSource = new InputSource(); inputSource.setPublicId(pubId); inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(sysId, baseSystemId) : sysId); if (charStream != null) { inputSource.setCharacterStream(charStream); } else if (byteStream != null) { inputSource.setByteStream(byteStream); } else if (data != null && data.length() != 0) { inputSource.setCharacterStream(new StringReader(data)); } inputSource.setEncoding(encoding); return inputSource; } } return null; }
Example 12
Source File: DOMEntityResolverWrapper.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. * * @param resourceIdentifier description of the resource to be revsoved * @throws XNIException Thrown on general error. * @throws IOException Thrown if resolved entity stream cannot be * opened or some other i/o error occurs. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { // resolve entity using DOM entity resolver if (fEntityResolver != null) { // For entity resolution the type of the resource would be XML TYPE // DOM L3 LS spec mention only the XML 1.0 recommendation right now LSInput inputSource = resourceIdentifier == null ? fEntityResolver.resolveResource( null, null, null, null, null) : fEntityResolver.resolveResource( getType(resourceIdentifier), resourceIdentifier.getNamespace(), resourceIdentifier.getPublicId(), resourceIdentifier.getLiteralSystemId(), resourceIdentifier.getBaseSystemId()); if (inputSource != null) { String publicId = inputSource.getPublicId(); String systemId = inputSource.getSystemId(); String baseSystemId = inputSource.getBaseURI(); InputStream byteStream = inputSource.getByteStream(); Reader charStream = inputSource.getCharacterStream(); String encoding = inputSource.getEncoding(); String data = inputSource.getStringData(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. */ XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, baseSystemId); if (charStream != null) { xmlInputSource.setCharacterStream(charStream); } else if (byteStream != null) { xmlInputSource.setByteStream((InputStream) byteStream); } else if (data != null && data.length() != 0) { xmlInputSource.setCharacterStream(new StringReader(data)); } xmlInputSource.setEncoding(encoding); return xmlInputSource; } } // unable to resolve entity return null; }
Example 13
Source File: DOMEntityResolverWrapper.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. * * @param resourceIdentifier description of the resource to be revsoved * @throws XNIException Thrown on general error. * @throws IOException Thrown if resolved entity stream cannot be * opened or some other i/o error occurs. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { // resolve entity using DOM entity resolver if (fEntityResolver != null) { // For entity resolution the type of the resource would be XML TYPE // DOM L3 LS spec mention only the XML 1.0 recommendation right now LSInput inputSource = resourceIdentifier == null ? fEntityResolver.resolveResource( null, null, null, null, null) : fEntityResolver.resolveResource( getType(resourceIdentifier), resourceIdentifier.getNamespace(), resourceIdentifier.getPublicId(), resourceIdentifier.getLiteralSystemId(), resourceIdentifier.getBaseSystemId()); if (inputSource != null) { String publicId = inputSource.getPublicId(); String systemId = inputSource.getSystemId(); String baseSystemId = inputSource.getBaseURI(); InputStream byteStream = inputSource.getByteStream(); Reader charStream = inputSource.getCharacterStream(); String encoding = inputSource.getEncoding(); String data = inputSource.getStringData(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. */ XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, baseSystemId); if (charStream != null) { xmlInputSource.setCharacterStream(charStream); } else if (byteStream != null) { xmlInputSource.setByteStream((InputStream) byteStream); } else if (data != null && data.length() != 0) { xmlInputSource.setCharacterStream(new StringReader(data)); } xmlInputSource.setEncoding(encoding); return xmlInputSource; } } // unable to resolve entity return null; }
Example 14
Source File: DOMEntityResolverWrapper.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. * * @param resourceIdentifier description of the resource to be revsoved * @throws XNIException Thrown on general error. * @throws IOException Thrown if resolved entity stream cannot be * opened or some other i/o error occurs. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { // resolve entity using DOM entity resolver if (fEntityResolver != null) { // For entity resolution the type of the resource would be XML TYPE // DOM L3 LS spec mention only the XML 1.0 recommendation right now LSInput inputSource = resourceIdentifier == null ? fEntityResolver.resolveResource( null, null, null, null, null) : fEntityResolver.resolveResource( getType(resourceIdentifier), resourceIdentifier.getNamespace(), resourceIdentifier.getPublicId(), resourceIdentifier.getLiteralSystemId(), resourceIdentifier.getBaseSystemId()); if (inputSource != null) { String publicId = inputSource.getPublicId(); String systemId = inputSource.getSystemId(); String baseSystemId = inputSource.getBaseURI(); InputStream byteStream = inputSource.getByteStream(); Reader charStream = inputSource.getCharacterStream(); String encoding = inputSource.getEncoding(); String data = inputSource.getStringData(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. */ XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, baseSystemId, true); if (charStream != null) { xmlInputSource.setCharacterStream(charStream); } else if (byteStream != null) { xmlInputSource.setByteStream((InputStream) byteStream); } else if (data != null && data.length() != 0) { xmlInputSource.setCharacterStream(new StringReader(data)); } xmlInputSource.setEncoding(encoding); return xmlInputSource; } } // unable to resolve entity return null; }
Example 15
Source File: DOMEntityResolverWrapper.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. * * @param resourceIdentifier description of the resource to be revsoved * @throws XNIException Thrown on general error. * @throws IOException Thrown if resolved entity stream cannot be * opened or some other i/o error occurs. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { // resolve entity using DOM entity resolver if (fEntityResolver != null) { // For entity resolution the type of the resource would be XML TYPE // DOM L3 LS spec mention only the XML 1.0 recommendation right now LSInput inputSource = resourceIdentifier == null ? fEntityResolver.resolveResource( null, null, null, null, null) : fEntityResolver.resolveResource( getType(resourceIdentifier), resourceIdentifier.getNamespace(), resourceIdentifier.getPublicId(), resourceIdentifier.getLiteralSystemId(), resourceIdentifier.getBaseSystemId()); if (inputSource != null) { String publicId = inputSource.getPublicId(); String systemId = inputSource.getSystemId(); String baseSystemId = inputSource.getBaseURI(); InputStream byteStream = inputSource.getByteStream(); Reader charStream = inputSource.getCharacterStream(); String encoding = inputSource.getEncoding(); String data = inputSource.getStringData(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. */ XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, baseSystemId, true); if (charStream != null) { xmlInputSource.setCharacterStream(charStream); } else if (byteStream != null) { xmlInputSource.setByteStream(byteStream); } else if (data != null && data.length() != 0) { xmlInputSource.setCharacterStream(new StringReader(data)); } xmlInputSource.setEncoding(encoding); return xmlInputSource; } } // unable to resolve entity return null; }
Example 16
Source File: DOMEntityResolverWrapper.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. * * @param resourceIdentifier description of the resource to be revsoved * @throws XNIException Thrown on general error. * @throws IOException Thrown if resolved entity stream cannot be * opened or some other i/o error occurs. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { // resolve entity using DOM entity resolver if (fEntityResolver != null) { // For entity resolution the type of the resource would be XML TYPE // DOM L3 LS spec mention only the XML 1.0 recommendation right now LSInput inputSource = resourceIdentifier == null ? fEntityResolver.resolveResource( null, null, null, null, null) : fEntityResolver.resolveResource( getType(resourceIdentifier), resourceIdentifier.getNamespace(), resourceIdentifier.getPublicId(), resourceIdentifier.getLiteralSystemId(), resourceIdentifier.getBaseSystemId()); if (inputSource != null) { String publicId = inputSource.getPublicId(); String systemId = inputSource.getSystemId(); String baseSystemId = inputSource.getBaseURI(); InputStream byteStream = inputSource.getByteStream(); Reader charStream = inputSource.getCharacterStream(); String encoding = inputSource.getEncoding(); String data = inputSource.getStringData(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. */ XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, baseSystemId); if (charStream != null) { xmlInputSource.setCharacterStream(charStream); } else if (byteStream != null) { xmlInputSource.setByteStream((InputStream) byteStream); } else if (data != null && data.length() != 0) { xmlInputSource.setCharacterStream(new StringReader(data)); } xmlInputSource.setEncoding(encoding); return xmlInputSource; } } // unable to resolve entity return null; }
Example 17
Source File: DOMEntityResolverWrapper.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. * * @param resourceIdentifier description of the resource to be revsoved * @throws XNIException Thrown on general error. * @throws IOException Thrown if resolved entity stream cannot be * opened or some other i/o error occurs. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { // resolve entity using DOM entity resolver if (fEntityResolver != null) { // For entity resolution the type of the resource would be XML TYPE // DOM L3 LS spec mention only the XML 1.0 recommendation right now LSInput inputSource = resourceIdentifier == null ? fEntityResolver.resolveResource( null, null, null, null, null) : fEntityResolver.resolveResource( getType(resourceIdentifier), resourceIdentifier.getNamespace(), resourceIdentifier.getPublicId(), resourceIdentifier.getLiteralSystemId(), resourceIdentifier.getBaseSystemId()); if (inputSource != null) { String publicId = inputSource.getPublicId(); String systemId = inputSource.getSystemId(); String baseSystemId = inputSource.getBaseURI(); InputStream byteStream = inputSource.getByteStream(); Reader charStream = inputSource.getCharacterStream(); String encoding = inputSource.getEncoding(); String data = inputSource.getStringData(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. */ XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, baseSystemId); if (charStream != null) { xmlInputSource.setCharacterStream(charStream); } else if (byteStream != null) { xmlInputSource.setByteStream((InputStream) byteStream); } else if (data != null && data.length() != 0) { xmlInputSource.setCharacterStream(new StringReader(data)); } xmlInputSource.setEncoding(encoding); return xmlInputSource; } } // unable to resolve entity return null; }
Example 18
Source File: DOMEntityResolverWrapper.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. * * @param resourceIdentifier description of the resource to be revsoved * @throws XNIException Thrown on general error. * @throws IOException Thrown if resolved entity stream cannot be * opened or some other i/o error occurs. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { // resolve entity using DOM entity resolver if (fEntityResolver != null) { // For entity resolution the type of the resource would be XML TYPE // DOM L3 LS spec mention only the XML 1.0 recommendation right now LSInput inputSource = resourceIdentifier == null ? fEntityResolver.resolveResource( null, null, null, null, null) : fEntityResolver.resolveResource( getType(resourceIdentifier), resourceIdentifier.getNamespace(), resourceIdentifier.getPublicId(), resourceIdentifier.getLiteralSystemId(), resourceIdentifier.getBaseSystemId()); if (inputSource != null) { String publicId = inputSource.getPublicId(); String systemId = inputSource.getSystemId(); String baseSystemId = inputSource.getBaseURI(); InputStream byteStream = inputSource.getByteStream(); Reader charStream = inputSource.getCharacterStream(); String encoding = inputSource.getEncoding(); String data = inputSource.getStringData(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. */ XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, baseSystemId); if (charStream != null) { xmlInputSource.setCharacterStream(charStream); } else if (byteStream != null) { xmlInputSource.setByteStream((InputStream) byteStream); } else if (data != null && data.length() != 0) { xmlInputSource.setCharacterStream(new StringReader(data)); } xmlInputSource.setEncoding(encoding); return xmlInputSource; } } // unable to resolve entity return null; }
Example 19
Source File: DOMEntityResolverWrapper.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. * * @param resourceIdentifier description of the resource to be revsoved * @throws XNIException Thrown on general error. * @throws IOException Thrown if resolved entity stream cannot be * opened or some other i/o error occurs. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { // resolve entity using DOM entity resolver if (fEntityResolver != null) { // For entity resolution the type of the resource would be XML TYPE // DOM L3 LS spec mention only the XML 1.0 recommendation right now LSInput inputSource = resourceIdentifier == null ? fEntityResolver.resolveResource( null, null, null, null, null) : fEntityResolver.resolveResource( getType(resourceIdentifier), resourceIdentifier.getNamespace(), resourceIdentifier.getPublicId(), resourceIdentifier.getLiteralSystemId(), resourceIdentifier.getBaseSystemId()); if (inputSource != null) { String publicId = inputSource.getPublicId(); String systemId = inputSource.getSystemId(); String baseSystemId = inputSource.getBaseURI(); InputStream byteStream = inputSource.getByteStream(); Reader charStream = inputSource.getCharacterStream(); String encoding = inputSource.getEncoding(); String data = inputSource.getStringData(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. */ XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, baseSystemId); if (charStream != null) { xmlInputSource.setCharacterStream(charStream); } else if (byteStream != null) { xmlInputSource.setByteStream((InputStream) byteStream); } else if (data != null && data.length() != 0) { xmlInputSource.setCharacterStream(new StringReader(data)); } xmlInputSource.setEncoding(encoding); return xmlInputSource; } } // unable to resolve entity return null; }
Example 20
Source File: DOMEntityResolverWrapper.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * Resolves an external parsed entity. If the entity cannot be * resolved, this method should return null. * * @param resourceIdentifier description of the resource to be revsoved * @throws XNIException Thrown on general error. * @throws IOException Thrown if resolved entity stream cannot be * opened or some other i/o error occurs. */ public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException { // resolve entity using DOM entity resolver if (fEntityResolver != null) { // For entity resolution the type of the resource would be XML TYPE // DOM L3 LS spec mention only the XML 1.0 recommendation right now LSInput inputSource = resourceIdentifier == null ? fEntityResolver.resolveResource( null, null, null, null, null) : fEntityResolver.resolveResource( getType(resourceIdentifier), resourceIdentifier.getNamespace(), resourceIdentifier.getPublicId(), resourceIdentifier.getLiteralSystemId(), resourceIdentifier.getBaseSystemId()); if (inputSource != null) { String publicId = inputSource.getPublicId(); String systemId = inputSource.getSystemId(); String baseSystemId = inputSource.getBaseURI(); InputStream byteStream = inputSource.getByteStream(); Reader charStream = inputSource.getCharacterStream(); String encoding = inputSource.getEncoding(); String data = inputSource.getStringData(); /** * An LSParser looks at inputs specified in LSInput in * the following order: characterStream, byteStream, * stringData, systemId, publicId. */ XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, baseSystemId); if (charStream != null) { xmlInputSource.setCharacterStream(charStream); } else if (byteStream != null) { xmlInputSource.setByteStream((InputStream) byteStream); } else if (data != null && data.length() != 0) { xmlInputSource.setCharacterStream(new StringReader(data)); } xmlInputSource.setEncoding(encoding); return xmlInputSource; } } // unable to resolve entity return null; }