Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Using ResourceSet with InputStream rather than URI
Using ResourceSet with InputStream rather than URI [message #65463] Wed, 21 December 2005 06:25 Go to next message
Eclipse User
Originally posted by: seely_place.yahoo.com

Hi,

I would like to load multiple schemas into a ResourceSet
so that I can follow include, import, and redefine
directives and resolve cross-references seamlessly.
The ResourceSet class seems to be based on schemaLocation URIs.
However, I am using schemas where the optional schemaLocation
attribute is not present, nor does the namespace attribute provide
a location for the schema. For example:

<xsd:import namespace="http://example.com/library" />

In this case, my application interacts with the user, locates
the schemas using data supplied by the user, and has each of the
schemas in memory as a separate ByteArrayInputStream.

How can I create a ResourceSet using these in-memory InputStreams?
(and still maintain the seamless cross-referencing capability)

Any guidance would be appreciated!

Thanks,
Seely.
Re: Using ResourceSet with InputStream rather than URI [message #65485 is a reply to message #65463] Wed, 21 December 2005 11:23 Go to previous messageGo to next message
Eclipse User
Originally posted by: merks.ca.ibm.com

Seely,

XSDSchemaLocator and XSDSchemaLocationResolver might be useful for doing
fancier things. But, in general, the resource set's URI converter will
be called to create all input streams and when no schema location is
provided the namespace will be used directly as the location, so an
override of the URI converter to map logical namespaces to physical
locations or to synthesized streams will likely be sufficient.


Seely Place wrote:

> Hi,
>
> I would like to load multiple schemas into a ResourceSet
> so that I can follow include, import, and redefine
> directives and resolve cross-references seamlessly.
> The ResourceSet class seems to be based on schemaLocation URIs.
> However, I am using schemas where the optional schemaLocation
> attribute is not present, nor does the namespace attribute provide
> a location for the schema. For example:
>
> <xsd:import namespace="http://example.com/library" />
>
> In this case, my application interacts with the user, locates
> the schemas using data supplied by the user, and has each of the
> schemas in memory as a separate ByteArrayInputStream.
>
> How can I create a ResourceSet using these in-memory InputStreams?
> (and still maintain the seamless cross-referencing capability)
>
> Any guidance would be appreciated!
>
> Thanks,
> Seely.
>
Re: Using ResourceSet with InputStream rather than URI [message #65504 is a reply to message #65485] Wed, 21 December 2005 19:42 Go to previous messageGo to next message
Eclipse User
Originally posted by: seely_place.yahoo.com

Hi Ed,

Thanks for the quick reply! :)

I am fairly new to EMF and XSD. Can you please explain in more detail what
the URIConverter currently does, how the overridden method on a new
subclass
would work, and how I would register that new subclass with the system so
that my overridden method is called instead of the URIConverter?

Sorry for all the questions.

Thanks,
Seely "newbie" Place
Re: Using ResourceSet with InputStream rather than URI [message #65524 is a reply to message #65504] Wed, 21 December 2005 20:05 Go to previous message
Eclipse User
Originally posted by: merks.ca.ibm.com

Seely,

I'm supposed to be on holidays, so I'm not feeling quite as helpful as I
should.

You can create a new derived URIConverterImpl and use
ResourceSet.setURIConverter. If you set a breakpoint in
URIConverterImpl.createInputStream you'll quickly see what's going on.


Seely Place wrote:

> Hi Ed,
>
> Thanks for the quick reply! :)
>
> I am fairly new to EMF and XSD. Can you please explain in more detail
> what
> the URIConverter currently does, how the overridden method on a new
> subclass
> would work, and how I would register that new subclass with the system so
> that my overridden method is called instead of the URIConverter?
>
> Sorry for all the questions.
>
> Thanks,
> Seely "newbie" Place
>
Re: Using ResourceSet with InputStream rather than URI [message #597373 is a reply to message #65463] Wed, 21 December 2005 11:23 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26152
Registered: July 2009
Senior Member
Seely,

XSDSchemaLocator and XSDSchemaLocationResolver might be useful for doing
fancier things. But, in general, the resource set's URI converter will
be called to create all input streams and when no schema location is
provided the namespace will be used directly as the location, so an
override of the URI converter to map logical namespaces to physical
locations or to synthesized streams will likely be sufficient.


Seely Place wrote:

> Hi,
>
> I would like to load multiple schemas into a ResourceSet
> so that I can follow include, import, and redefine
> directives and resolve cross-references seamlessly.
> The ResourceSet class seems to be based on schemaLocation URIs.
> However, I am using schemas where the optional schemaLocation
> attribute is not present, nor does the namespace attribute provide
> a location for the schema. For example:
>
> <xsd:import namespace="http://example.com/library" />
>
> In this case, my application interacts with the user, locates
> the schemas using data supplied by the user, and has each of the
> schemas in memory as a separate ByteArrayInputStream.
>
> How can I create a ResourceSet using these in-memory InputStreams?
> (and still maintain the seamless cross-referencing capability)
>
> Any guidance would be appreciated!
>
> Thanks,
> Seely.
>
Re: Using ResourceSet with InputStream rather than URI [message #597377 is a reply to message #65485] Wed, 21 December 2005 19:42 Go to previous message
Eclipse User
Originally posted by: seely_place.yahoo.com

Hi Ed,

Thanks for the quick reply! :)

I am fairly new to EMF and XSD. Can you please explain in more detail what
the URIConverter currently does, how the overridden method on a new
subclass
would work, and how I would register that new subclass with the system so
that my overridden method is called instead of the URIConverter?

Sorry for all the questions.

Thanks,
Seely "newbie" Place
Re: Using ResourceSet with InputStream rather than URI [message #597382 is a reply to message #65504] Wed, 21 December 2005 20:05 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26152
Registered: July 2009
Senior Member
Seely,

I'm supposed to be on holidays, so I'm not feeling quite as helpful as I
should.

You can create a new derived URIConverterImpl and use
ResourceSet.setURIConverter. If you set a breakpoint in
URIConverterImpl.createInputStream you'll quickly see what's going on.


Seely Place wrote:

> Hi Ed,
>
> Thanks for the quick reply! :)
>
> I am fairly new to EMF and XSD. Can you please explain in more detail
> what
> the URIConverter currently does, how the overridden method on a new
> subclass
> would work, and how I would register that new subclass with the system so
> that my overridden method is called instead of the URIConverter?
>
> Sorry for all the questions.
>
> Thanks,
> Seely "newbie" Place
>
Previous Topic:Using ResourceSet with InputStream rather than URI
Next Topic:why isn't element declaration given "anyType" type by default
Goto Forum:
  


Current Time: Thu Oct 30 17:39:23 GMT 2014

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

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