Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » How to parse a schema from an InputStream
How to parse a schema from an InputStream [message #45354] Tue, 25 May 2004 12:14 Go to next message
Eclipse UserFriend
Originally posted by: hoe.zurich.ibm.com

How do I parse an XSDSchema from an InputStream instead of a URI? I've
tried to register a special URIConverter that returns the desired
stream, but that itself does not seem to be enough: e.g. somehow the
ability to access the cached XSD schema was lost.
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",
new XSDResourceFactoryImpl());
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.setURIConverter(new SingletonURIConverter(in,
resourceSet.getURIConverter());
Resource resource =
resourceSet.getResource(SingletonURIConverter.SINGLETON_URI, true);

Thanks,
Christian
Re: How to parse a schema from an InputStream [message #45383 is a reply to message #45354] Tue, 25 May 2004 12:23 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Christian,

You can use ResourceSet.createResource followed by Resource.load(inputStream, options), and you can
use ResourceSet.getResource(..., false) to test for the need to create one.


Christian Hoertnagl wrote:

> How do I parse an XSDSchema from an InputStream instead of a URI? I've
> tried to register a special URIConverter that returns the desired
> stream, but that itself does not seem to be enough: e.g. somehow the
> ability to access the cached XSD schema was lost.
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",
> new XSDResourceFactoryImpl());
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.setURIConverter(new SingletonURIConverter(in,
> resourceSet.getURIConverter());
> Resource resource =
> resourceSet.getResource(SingletonURIConverter.SINGLETON_URI, true);
>
> Thanks,
> Christian
Re: How to parse a schema from an InputStream [message #587465 is a reply to message #45354] Tue, 25 May 2004 12:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Christian,

You can use ResourceSet.createResource followed by Resource.load(inputStream, options), and you can
use ResourceSet.getResource(..., false) to test for the need to create one.


Christian Hoertnagl wrote:

> How do I parse an XSDSchema from an InputStream instead of a URI? I've
> tried to register a special URIConverter that returns the desired
> stream, but that itself does not seem to be enough: e.g. somehow the
> ability to access the cached XSD schema was lost.
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",
> new XSDResourceFactoryImpl());
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.setURIConverter(new SingletonURIConverter(in,
> resourceSet.getURIConverter());
> Resource resource =
> resourceSet.getResource(SingletonURIConverter.SINGLETON_URI, true);
>
> Thanks,
> Christian


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to parse a schema from an InputStream
Next Topic:Retrieving user information
Goto Forum:
  


Current Time: Wed Apr 24 21:28:03 GMT 2024

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

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

Back to the top