Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Problem reading imported schemas with absolute path
Problem reading imported schemas with absolute path [message #602753] Wed, 12 December 2007 22:48
Eclipse UserFriend
Originally posted by: sdjuricic.galdosinc.com

Hello,

I have a problem when loading imported schemas that have schemaLocation
set with an absolute path without the file protocol prefix. The main
schema will be loaded but the imported schemas will not be loaded. All
the xsd files are located on my file system. If I change the
schemaLocation to be a relative path to the main schema then I do not have
an issue. The only way how all schemas will be loaded with absolute path
is if schemaLocation contains the file protocol prefix
example. file://C:/folderA/A.xsd

Is there a way to load all resources when the schemaLocation contains only
the absolute path without the file:// prefix? When loading without the
file:// even though schemas do not get loaded I don't get any error
messages about not being able to load imported schemas. Is there a way to
specify an error listener or to check for error if a particular imported
resource was not loaded.

I am using the following method to load the schemas. This method was just
copied from the example given.

URI uri;
String filePath = "C:/projects/test.xsd"
File file = new File(filePath);
if (file.isFile()) {
uri = URI.createFileURI(file.getCanonicalFile().toString());
} else {
uri = URI.createURI(filePath);
}
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( )
.put("xsd", new XSDResourceFactoryImpl());
ResourceSet resourceSet = new ResourceSetImpl();
XSDResourceImpl xsdMainResource =
(XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd "));
xsdMainResource.setURI(uri);
xsdMainResource.load(resourceSet.getLoadOptions());

for (Iterator resources = resourceSet.getResources().iterator();
resources.hasNext(); ) {
Object resource = resources.next();
if (resource instanceof XSDResourceImpl) {
XSDResourceImpl xsdResource = (XSDResourceImpl)resource;
XSDSchema xsdSchema = xsdResource.getSchema();
}
Previous Topic:How to update imported schema files
Next Topic:Problem reading imported schemas with absolute path
Goto Forum:
  


Current Time: Fri Nov 28 00:30:54 GMT 2014

Powered by FUDForum. Page generated in 0.03718 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software