private LSInputImpl createInput(String newId, byte[] value) { LSInputImpl impl = new LSInputImpl(); impl.setSystemId(newId); impl.setBaseURI(newId); impl.setByteStream(new ByteArrayInputStream(value)); return impl; } }
InputSource source = resolver.resolve(systemId, baseURI); if (source != null) { impl = new LSInputImpl(); impl.setByteStream(source.getByteStream()); impl.setSystemId(source.getSystemId()); impl.setPublicId(source.getPublicId());
private LSInput loadLSInput(String ns) { String path = ToolConstants.CXF_SCHEMAS_DIR_INJAR + NSFILEMAP.get(ns); URL url = getClass().getClassLoader().getResource(path); LSInput lsin = new LSInputImpl(); lsin.setSystemId(url.toString()); try { lsin.setByteStream(url.openStream()); } catch (IOException e) { return null; } return lsin; }
InputSource source = resolver.resolve(systemId, baseURI); if (source != null) { impl = new LSInputImpl(); impl.setByteStream(source.getByteStream()); impl.setSystemId(source.getSystemId()); impl.setPublicId(source.getPublicId());
private LSInput loadLSInput(String ns) { String path = ToolConstants.CXF_SCHEMAS_DIR_INJAR + NSFILEMAP.get(ns); URL url = getClass().getClassLoader().getResource(path); LSInput lsin = new LSInputImpl(); lsin.setSystemId(url.toString()); try { lsin.setByteStream(url.openStream()); } catch (IOException e) { return null; } return lsin; }
private LSInputImpl createInput(String newId, byte[] value) { LSInputImpl impl = new LSInputImpl(); impl.setSystemId(newId); impl.setBaseURI(newId); impl.setByteStream(new ByteArrayInputStream(value)); return impl; } }
InputSource source = resolver.resolve(systemId, baseURI); if (source != null) { impl = new LSInputImpl(); impl.setByteStream(source.getByteStream()); impl.setSystemId(source.getSystemId()); impl.setPublicId(source.getPublicId());
String pathHistory = ""; @Override public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { systemId = systemId.replace("./", "");// we dont need this since getResourceAsStream cannot understand it InputStream resourceAsStream = Message.class.getClassLoader().getResourceAsStream(systemId); if (resourceAsStream == null) { resourceAsStream = Message.class.getClassLoader().getResourceAsStream(pathHistory + systemId); } else { pathHistory = getNormalizedPath(systemId); } Scanner s = new Scanner(resourceAsStream).useDelimiter("\\A"); String s1 = s.next() .replaceAll("\\n"," ") //the parser cannot understand elements broken down multiple lines e.g. (<xs:element \n name="buxing">) .replace("\\t", " ") //these two about whitespaces is only for decoration .replaceAll("\\s+", " ") .replaceAll("[^\\x20-\\x7e]", ""); //some files has a special character as a first character indicating utf-8 file InputStream is = new ByteArrayInputStream(s1.getBytes()); return new LSInputImpl(publicId, systemId, is); } private String getNormalizedPath(String baseURI) { return baseURI.substring(0, baseURI.lastIndexOf(System.getProperty("file.separator"))+ 1) ; }
private LSInputImpl createInput(String newId, byte[] value) { LSInputImpl impl = new LSInputImpl(); impl.setSystemId(newId); impl.setBaseURI(newId); impl.setByteStream(new ByteArrayInputStream(value)); return impl; } }
InputSource source = resolver.resolve(systemId, baseURI); if (source != null) { impl = new LSInputImpl(); impl.setByteStream(source.getByteStream()); impl.setSystemId(source.getSystemId()); impl.setPublicId(source.getPublicId());
LSInput input = new LSInputImpl();
private LSInputImpl createInput(String newId, byte[] value) { LSInputImpl impl = new LSInputImpl(); impl.setSystemId(newId); impl.setBaseURI(newId); impl.setByteStream(new ByteArrayInputStream(value)); return impl; } }
InputStream is = new ByteArrayInputStream(s1.getBytes()); return new LSInputImpl(publicId, systemId, is);
LSInput resource = new LSInputImpl(); resource.setSystemId(actualSchemaURL); resource.setPublicId(publicId);
urlCon = url.openConnection(); urlCon.setUseCaches(false); lsin = new LSInputImpl(); lsin.setSystemId(resURL); lsin.setByteStream(urlCon.getInputStream()); lsin = new LSInputImpl(); lsin.setSystemId(localFile); lsin.setByteStream(resolver.getInputStream());
urlCon = url.openConnection(); urlCon.setUseCaches(false); lsin = new LSInputImpl(); lsin.setSystemId(resURL); lsin.setByteStream(urlCon.getInputStream()); lsin = new LSInputImpl(); lsin.setSystemId(localFile); lsin.setByteStream(resolver.getInputStream());
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { try { String resolvedLocation = catalogResolver.resolveSystem(systemId); if (resolvedLocation == null) { resolvedLocation = catalogResolver.resolveURI(namespaceURI); } if (resolvedLocation == null) { resolvedLocation = catalogResolver.resolvePublic(publicId, systemId); } if (resolvedLocation != null) { InputStream resourceStream = ResourceUtils.getResourceStream(resolvedLocation, bus); if (resourceStream != null) { return new LSInputImpl(publicId, systemId, resourceStream); } } } catch (Exception ex) { // ignore } return null; }
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { try { String resolvedLocation = catalogResolver.resolveSystem(systemId); if (resolvedLocation == null) { resolvedLocation = catalogResolver.resolveURI(namespaceURI); } if (resolvedLocation == null) { resolvedLocation = catalogResolver.resolvePublic( publicId != null ? publicId : namespaceURI, systemId); } if (resolvedLocation != null) { InputStream resourceStream = ResourceUtils.getResourceStream(resolvedLocation, bus); if (resourceStream != null) { return new LSInputImpl(publicId, systemId, resourceStream); } } } catch (Exception ex) { // ignore } return null; }