Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » How to access type definitions from XSD namespace as part of ResourceSet?
How to access type definitions from XSD namespace as part of ResourceSet? [message #37614] Mon, 01 March 2004 17:55 Go to next message
Eclipse UserFriend
Originally posted by: hoe.zurich.ibm.com

Hi,

I'm trying to read from an XSD file into a ResourceSet. The contained
type definitions reference simple types from the xsd namespace
(http://www.w3.org/2001/XMLSchema). I end up with a ResourceSet that
contains one resource (not two, as I had expected).

Do I have to do anything special to get defintions from the cached
xml.xsd included in the ResourceSet; or what's the other/preferred way
to get hold of them? Because of the way the ResourceSet is currently
made up, looping over all XSDSchema.getTypeDefinitions() for all
contained Resources won't do the trick for finding e.g. the
XSDTypeDefiniton for "xsd:string". Where/how can I find that definition
instead?

Here's a shortcut version of what I'm doing:

Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",
new XSDResourceFactoryImpl());
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResource(createURI(uri), true);

and here's a shortcut version of my XSD file:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns="http://www.whathaveyou.com">
<!-- etc. -->
</xsd:schema>

Thanks,
Christian
Re: How to access type definitions from XSD namespace as part of ResourceSet? [message #37639 is a reply to message #37614] Mon, 01 March 2004 18:59 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Christian,

Given an XSDSchema x, calling x.getSchemaForSchema() will get the you the
schema for schemas; there is a single shared instance of this schema that's
used by all other schemas.


Christian Hoertnagl wrote:

> Hi,
>
> I'm trying to read from an XSD file into a ResourceSet. The contained
> type definitions reference simple types from the xsd namespace
> (http://www.w3.org/2001/XMLSchema). I end up with a ResourceSet that
> contains one resource (not two, as I had expected).
>
> Do I have to do anything special to get defintions from the cached
> xml.xsd included in the ResourceSet; or what's the other/preferred way
> to get hold of them? Because of the way the ResourceSet is currently
> made up, looping over all XSDSchema.getTypeDefinitions() for all
> contained Resources won't do the trick for finding e.g. the
> XSDTypeDefiniton for "xsd:string". Where/how can I find that definition
> instead?
>
> Here's a shortcut version of what I'm doing:
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",
> new XSDResourceFactoryImpl());
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getResource(createURI(uri), true);
>
> and here's a shortcut version of my XSD file:
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:ns="http://www.whathaveyou.com">
> <!-- etc. -->
> </xsd:schema>
>
> Thanks,
> Christian
Re: How to access type definitions from XSD namespace as part of ResourceSet? [message #583624 is a reply to message #37614] Mon, 01 March 2004 18:59 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33139
Registered: July 2009
Senior Member
Christian,

Given an XSDSchema x, calling x.getSchemaForSchema() will get the you the
schema for schemas; there is a single shared instance of this schema that's
used by all other schemas.


Christian Hoertnagl wrote:

> Hi,
>
> I'm trying to read from an XSD file into a ResourceSet. The contained
> type definitions reference simple types from the xsd namespace
> (http://www.w3.org/2001/XMLSchema). I end up with a ResourceSet that
> contains one resource (not two, as I had expected).
>
> Do I have to do anything special to get defintions from the cached
> xml.xsd included in the ResourceSet; or what's the other/preferred way
> to get hold of them? Because of the way the ResourceSet is currently
> made up, looping over all XSDSchema.getTypeDefinitions() for all
> contained Resources won't do the trick for finding e.g. the
> XSDTypeDefiniton for "xsd:string". Where/how can I find that definition
> instead?
>
> Here's a shortcut version of what I'm doing:
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "xsd",
> new XSDResourceFactoryImpl());
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getResource(createURI(uri), true);
>
> and here's a shortcut version of my XSD file:
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:ns="http://www.whathaveyou.com">
> <!-- etc. -->
> </xsd:schema>
>
> Thanks,
> Christian


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to access type definitions from XSD namespace as part of ResourceSet?
Next Topic:Getting elements
Goto Forum:
  


Current Time: Sat Apr 20 15:40:14 GMT 2024

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

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

Back to the top