Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Schema locations
Schema locations [message #586275] Thu, 29 April 2004 11:03
Mike Lischke is currently offline Mike LischkeFriend
Messages: 78
Registered: July 2009
Hi group,

Currently I'm trying to find a consistent solution to load an XML schema
together will all its imported, included and redefined schemas. Until now
I have two versions to load schemas. One loads a schema fine when it is
located in an Eclipse project (with relative path name). It can also load
the schema from the file system when given with absolute path.

XSDResourceImpl xsdSchemaResource = new XSDResourceImpl();
InputStream stream =
if (stream == null)
stream = new FileInputStream(schemaName);

if (stream != null)
xsdSchemaResource.load(stream, null);
catch(Exception e)

The second one can load schemas from the file system when I specify the
file:// protocol.

URI uri = URI.createURI(schemaLocation);
ResourceSet resourceSet = new ResourceSetImpl();
XSDResourceImpl xsdResource =
(XSDResourceImpl)resourceSet.getResource(uri, true);

My problem is now: the second version also loads all included etc. schemas
so I have the full hierarchy (which is the final goal for me). But it does
only so when given an absolute file (or another valid URI I suppose,
haven't tried). It cannot load schemas from the resource of an Eclipse
project. The first version in contrast does not load included schemas, but
only loads the main file.

So my question is: How can I make a combined version so that regardless of
the actual location of the schema (URL, local file, resouce file -> maybe
in jar) the main schema file and all those, which are referenced by it (or
recursively by the others) are loaded successfully?

I already looked at the traceLoading sample code, which uses an URI map,
however this does not help for resource files. I would need stream support
for a generic solution, but I have not found any stream reference in the

Previous Topic:Re: EMF, SDO & XSD Update Site (was Re: EMF Update Site)
Next Topic:Annotation appinfo troubles
Goto Forum:

Current Time: Sat Nov 28 23:07:42 GMT 2020

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

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

Back to the top