Home » Archived » XML Schema Definition (XSD) » Using ResourceSet with InputStream rather than URI
Using ResourceSet with InputStream rather than URI [message #65463] |
Wed, 21 December 2005 01:25  |
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 06:23   |
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 #65524 is a reply to message #65504] |
Wed, 21 December 2005 15:05  |
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 06:23  |
Eclipse User |
|
|
|
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 14:42  |
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 15:05  |
Eclipse User |
|
|
|
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
>
|
|
|
Goto Forum:
Current Time: Mon May 05 23:34:58 EDT 2025
Powered by FUDForum. Page generated in 0.04371 seconds
|