xsdMainResource.load(in, options); } finally { Long timeStamp = (Long) response.get(URIConverter.RESPONSE_TIME_STAMP_PROPERTY);
final XSDResourceImpl rsrc = new XSDResourceImpl(URI.createFileURI(xsdFileWithPath)); rsrc.load(new HashMap()); final XSDSchema schema = rsrc.getSchema(); for (Object content : schema.getContents()) { if (content instanceof XSDImport) { XSDImport xsdImport = (XSDImport) content; xsdImport.resolveTypeDefinition(xsdImport.getNamespace(), ""); } }
public static final XSDSchema parse(String location, List locators, List resolvers) throws IOException { //check for case of file url, make sure it is an absolute reference if (new File(location).exists()) { location = new File(location).getCanonicalFile().toURI().toString(); //location = new File(location).getCanonicalPath(); } URI uri = URI.createURI(location); final ResourceSet resourceSet = new ResourceSetImpl(); //add the specialized schema location resolvers if ((resolvers != null) && !resolvers.isEmpty()) { AdapterFactory adapterFactory = new SchemaLocationResolverAdapterFactory(resolvers); resourceSet.getAdapterFactories().add(adapterFactory); } //add the specialized schema locators as adapters if ((locators != null) && !locators.isEmpty()) { AdapterFactory adapterFactory = new SchemaLocatorAdapterFactory(locators); resourceSet.getAdapterFactories().add(adapterFactory); } XSDResourceImpl xsdMainResource = (XSDResourceImpl) resourceSet.createResource(URI.createURI( ".xsd")); xsdMainResource.setURI(uri); xsdMainResource.load(resourceSet.getLoadOptions()); return xsdMainResource.getSchema(); }
public static final XSDSchema parse(String location, List locators, List resolvers) throws IOException { //check for case of file url, make sure it is an absolute reference if (new File(location).exists()) { location = new File(location).getCanonicalFile().toURI().toString(); //location = new File(location).getCanonicalPath(); } URI uri = URI.createURI(location); final ResourceSet resourceSet = new ResourceSetImpl(); //add the specialized schema location resolvers if ((resolvers != null) && !resolvers.isEmpty()) { AdapterFactory adapterFactory = new SchemaLocationResolverAdapterFactory(resolvers); resourceSet.getAdapterFactories().add(adapterFactory); } //add the specialized schema locators as adapters if ((locators != null) && !locators.isEmpty()) { AdapterFactory adapterFactory = new SchemaLocatorAdapterFactory(locators); resourceSet.getAdapterFactories().add(adapterFactory); } XSDResourceImpl xsdMainResource = (XSDResourceImpl) resourceSet.createResource(URI.createURI( ".xsd")); xsdMainResource.setURI(uri); xsdMainResource.load(resourceSet.getLoadOptions()); return xsdMainResource.getSchema(); }
public static final XSDSchema parse( String location, List locators, List resolvers ) throws IOException { //check for case of file url, make sure it is an absolute reference if (new File(location).exists()) { location = new File( location ).getCanonicalFile().toURI().toString(); //location = new File(location).getCanonicalPath(); } URI uri = URI.createURI(location); final ResourceSet resourceSet = new ResourceSetImpl(); //add the specialized schema location resolvers if ((resolvers != null) && !resolvers.isEmpty()) { AdapterFactory adapterFactory = new SchemaLocationResolverAdapterFactory(resolvers); resourceSet.getAdapterFactories().add(adapterFactory); } //add the specialized schema locators as adapters if ((locators != null) && !locators.isEmpty()) { AdapterFactory adapterFactory = new SchemaLocatorAdapterFactory(locators); resourceSet.getAdapterFactories().add(adapterFactory); } XSDResourceImpl xsdMainResource = (XSDResourceImpl) resourceSet .createResource(URI.createURI(".xsd")); // LOGGER.info("About to parse xsd schema: " + uri); xsdMainResource.setURI(uri); xsdMainResource.load(resourceSet.getLoadOptions()); return xsdMainResource.getSchema(); }