Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » binding during multiple loads
binding during multiple loads [message #44500] Thu, 13 May 2004 22:10 Go to next message
Eclipse UserFriend
Originally posted by: jtaylor.nextance.com

If I load Schema A that includes Schema B and then separately load Schema
C that also includes Schema B, is there any way that I can get Eclipse XSD
to reuse and rebind the Schema B that was already loaded when Schema C is
loaded?

For example, using the three schemas below, if I first load cat.xsd and
then separately load dog.xsd, I'd like to be able to tell XSD to reuse the
commonly included animal.xsd schema such that if I ask for the members of
the animal substitution group, I'd get back both cat and dog. Otherwise,
I'm forced to figure out the dependencies up front and load everything at
once which in my case could be 1500+ schemas. Being able to load them
as-needed would save on memory and processing time.

One more related question: has anyone done any memory and performance
profiling on loading XSD schemas? Is there an rough approximation I could
use based on the size of the schema?

Thanks,

James

Schema A) cat.xsd:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="animal.xsd"/>
<xs:element name="cat" substitutionGroup="animal"/>
</xs:schema>

Schema B) animal.xsd:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="animal" abstract="true"/>
</xs:schema>


Schema C) dog.xsd:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="animal.xsd"/>
<xs:element name="dog" substitutionGroup="animal"/>
</xs:schema>
Re: binding during multiple loads [message #44531 is a reply to message #44500] Thu, 13 May 2004 23:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

James,

It should already do what you are wanting, if you use a common resource set to
load the instances. You would use ResourceSet.getResource(..., true) to make
sure you reuse already loaded schemas if you are loading them one by one.

Most of the focus on XSD has been on correctness and completeness not on
performance. So it's not very fast and it's pretty heavy weight.


James Taylor wrote:

> If I load Schema A that includes Schema B and then separately load Schema
> C that also includes Schema B, is there any way that I can get Eclipse XSD
> to reuse and rebind the Schema B that was already loaded when Schema C is
> loaded?
>
> For example, using the three schemas below, if I first load cat.xsd and
> then separately load dog.xsd, I'd like to be able to tell XSD to reuse the
> commonly included animal.xsd schema such that if I ask for the members of
> the animal substitution group, I'd get back both cat and dog. Otherwise,
> I'm forced to figure out the dependencies up front and load everything at
> once which in my case could be 1500+ schemas. Being able to load them
> as-needed would save on memory and processing time.
>
> One more related question: has anyone done any memory and performance
> profiling on loading XSD schemas? Is there an rough approximation I could
> use based on the size of the schema?
>
> Thanks,
>
> James
>
> Schema A) cat.xsd:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:include schemaLocation="animal.xsd"/>
> <xs:element name="cat" substitutionGroup="animal"/>
> </xs:schema>
>
> Schema B) animal.xsd:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="animal" abstract="true"/>
> </xs:schema>
>
> Schema C) dog.xsd:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:include schemaLocation="animal.xsd"/>
> <xs:element name="dog" substitutionGroup="animal"/>
> </xs:schema>
Re: binding during multiple loads [message #44723 is a reply to message #44531] Mon, 17 May 2004 23:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jtaylor.nextance.com

Ed,

It worked like a charm -- thanks for the tip.

One other scenario for you: if an XSD has already been loaded by Eclipse
XSD and the XSD is modified outside of the Eclipse interfaces, can the
schema model be updated in-place with the new XSD? This scenario comes up
when trying to cache the schema model in a clustered server environment.
If it changes on one server, the other servers may need to be updated as
well. Would one solution be to unload the resource and then reload it?
If so, are there limitations on this wrt the parts of the model that are
dependent on the modified schema? I found a similar question asked before
on this forum:
http://dev.eclipse.org/newslists/news.eclipse.technology.xsd /msg00452.html
Does all of this still apply? What approach would you recommend for this
scenario?

Thanks,

James

Ed Merks wrote:

> James,

> It should already do what you are wanting, if you use a common resource set
to
> load the instances. You would use ResourceSet.getResource(..., true) to make
> sure you reuse already loaded schemas if you are loading them one by one.

> Most of the focus on XSD has been on correctness and completeness not on
> performance. So it's not very fast and it's pretty heavy weight.


> James Taylor wrote:

> > If I load Schema A that includes Schema B and then separately load Schema
> > C that also includes Schema B, is there any way that I can get Eclipse XSD
> > to reuse and rebind the Schema B that was already loaded when Schema C is
> > loaded?
> >
> > For example, using the three schemas below, if I first load cat.xsd and
> > then separately load dog.xsd, I'd like to be able to tell XSD to reuse the
> > commonly included animal.xsd schema such that if I ask for the members of
> > the animal substitution group, I'd get back both cat and dog. Otherwise,
> > I'm forced to figure out the dependencies up front and load everything at
> > once which in my case could be 1500+ schemas. Being able to load them
> > as-needed would save on memory and processing time.
> >
> > One more related question: has anyone done any memory and performance
> > profiling on loading XSD schemas? Is there an rough approximation I could
> > use based on the size of the schema?
> >
> > Thanks,
> >
> > James
> >
> > Schema A) cat.xsd:
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > <xs:include schemaLocation="animal.xsd"/>
> > <xs:element name="cat" substitutionGroup="animal"/>
> > </xs:schema>
> >
> > Schema B) animal.xsd:
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > <xs:element name="animal" abstract="true"/>
> > </xs:schema>
> >
> > Schema C) dog.xsd:
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > <xs:include schemaLocation="animal.xsd"/>
> > <xs:element name="dog" substitutionGroup="animal"/>
> > </xs:schema>
Re: binding during multiple loads [message #44739 is a reply to message #44723] Tue, 18 May 2004 09:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

James,

If you unload a schema, all the schemas that depend on it (indirectly include or
import it) will be in rough shape and should also be unloaded. Unloading them all
would be kind of brute force but certainly the easiest to implement.


James Taylor wrote:

> Ed,
>
> It worked like a charm -- thanks for the tip.
>
> One other scenario for you: if an XSD has already been loaded by Eclipse
> XSD and the XSD is modified outside of the Eclipse interfaces, can the
> schema model be updated in-place with the new XSD? This scenario comes up
> when trying to cache the schema model in a clustered server environment.
> If it changes on one server, the other servers may need to be updated as
> well. Would one solution be to unload the resource and then reload it?
> If so, are there limitations on this wrt the parts of the model that are
> dependent on the modified schema? I found a similar question asked before
> on this forum:
> http://dev.eclipse.org/newslists/news.eclipse.technology.xsd /msg00452.html
> Does all of this still apply? What approach would you recommend for this
> scenario?
>
> Thanks,
>
> James
>
> Ed Merks wrote:
>
> > James,
>
> > It should already do what you are wanting, if you use a common resource set
> to
> > load the instances. You would use ResourceSet.getResource(..., true) to make
> > sure you reuse already loaded schemas if you are loading them one by one.
>
> > Most of the focus on XSD has been on correctness and completeness not on
> > performance. So it's not very fast and it's pretty heavy weight.
>
> > James Taylor wrote:
>
> > > If I load Schema A that includes Schema B and then separately load Schema
> > > C that also includes Schema B, is there any way that I can get Eclipse XSD
> > > to reuse and rebind the Schema B that was already loaded when Schema C is
> > > loaded?
> > >
> > > For example, using the three schemas below, if I first load cat.xsd and
> > > then separately load dog.xsd, I'd like to be able to tell XSD to reuse the
> > > commonly included animal.xsd schema such that if I ask for the members of
> > > the animal substitution group, I'd get back both cat and dog. Otherwise,
> > > I'm forced to figure out the dependencies up front and load everything at
> > > once which in my case could be 1500+ schemas. Being able to load them
> > > as-needed would save on memory and processing time.
> > >
> > > One more related question: has anyone done any memory and performance
> > > profiling on loading XSD schemas? Is there an rough approximation I could
> > > use based on the size of the schema?
> > >
> > > Thanks,
> > >
> > > James
> > >
> > > Schema A) cat.xsd:
> > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > <xs:include schemaLocation="animal.xsd"/>
> > > <xs:element name="cat" substitutionGroup="animal"/>
> > > </xs:schema>
> > >
> > > Schema B) animal.xsd:
> > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > <xs:element name="animal" abstract="true"/>
> > > </xs:schema>
> > >
> > > Schema C) dog.xsd:
> > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > <xs:include schemaLocation="animal.xsd"/>
> > > <xs:element name="dog" substitutionGroup="animal"/>
> > > </xs:schema>
Re: binding during multiple loads [message #45709 is a reply to message #44739] Tue, 25 May 2004 22:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jtaylor.nextance.com

Ed,

I'd like to try to minimize the amount of reloading, so limiting the
unload to dependent schemas would work well. However, forward references
such as substition group members are (as expected) not updated. Updating
these manually from the doUnload method of my derived XSDResourceImpl
class seems to do the trick. Are there other forward references that I'd
need to update and do you think this approach will work?

Thanks,

James

Ed Merks wrote:

> James,

> If you unload a schema, all the schemas that depend on it (indirectly
include or
> import it) will be in rough shape and should also be unloaded. Unloading
them all
> would be kind of brute force but certainly the easiest to implement.


> James Taylor wrote:

> > Ed,
> >
> > It worked like a charm -- thanks for the tip.
> >
> > One other scenario for you: if an XSD has already been loaded by Eclipse
> > XSD and the XSD is modified outside of the Eclipse interfaces, can the
> > schema model be updated in-place with the new XSD? This scenario comes up
> > when trying to cache the schema model in a clustered server environment.
> > If it changes on one server, the other servers may need to be updated as
> > well. Would one solution be to unload the resource and then reload it?
> > If so, are there limitations on this wrt the parts of the model that are
> > dependent on the modified schema? I found a similar question asked before
> > on this forum:
> > http://dev.eclipse.org/newslists/news.eclipse.technology.xsd /msg00452.html
> > Does all of this still apply? What approach would you recommend for this
> > scenario?
> >
> > Thanks,
> >
> > James
> >
> > Ed Merks wrote:
> >
> > > James,
> >
> > > It should already do what you are wanting, if you use a common resource
set
> > to
> > > load the instances. You would use ResourceSet.getResource(..., true) to
make
> > > sure you reuse already loaded schemas if you are loading them one by one.
> >
> > > Most of the focus on XSD has been on correctness and completeness not on
> > > performance. So it's not very fast and it's pretty heavy weight.
> >
> > > James Taylor wrote:
> >
> > > > If I load Schema A that includes Schema B and then separately load
Schema
> > > > C that also includes Schema B, is there any way that I can get Eclipse
XSD
> > > > to reuse and rebind the Schema B that was already loaded when Schema C
is
> > > > loaded?
> > > >
> > > > For example, using the three schemas below, if I first load cat.xsd and
> > > > then separately load dog.xsd, I'd like to be able to tell XSD to reuse
the
> > > > commonly included animal.xsd schema such that if I ask for the members
of
> > > > the animal substitution group, I'd get back both cat and dog.
Otherwise,
> > > > I'm forced to figure out the dependencies up front and load everything
at
> > > > once which in my case could be 1500+ schemas. Being able to load them
> > > > as-needed would save on memory and processing time.
> > > >
> > > > One more related question: has anyone done any memory and performance
> > > > profiling on loading XSD schemas? Is there an rough approximation I
could
> > > > use based on the size of the schema?
> > > >
> > > > Thanks,
> > > >
> > > > James
> > > >
> > > > Schema A) cat.xsd:
> > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > > <xs:include schemaLocation="animal.xsd"/>
> > > > <xs:element name="cat" substitutionGroup="animal"/>
> > > > </xs:schema>
> > > >
> > > > Schema B) animal.xsd:
> > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > > <xs:element name="animal" abstract="true"/>
> > > > </xs:schema>
> > > >
> > > > Schema C) dog.xsd:
> > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > > <xs:include schemaLocation="animal.xsd"/>
> > > > <xs:element name="dog" substitutionGroup="animal"/>
> > > > </xs:schema>
Re: binding during multiple loads [message #45739 is a reply to message #45709] Tue, 25 May 2004 22:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

James,

The forward references required for computing substitution groups is the only
anomaly that needs special treatment. Your approach sounds like a workable one.


James Taylor wrote:

> Ed,
>
> I'd like to try to minimize the amount of reloading, so limiting the
> unload to dependent schemas would work well. However, forward references
> such as substition group members are (as expected) not updated. Updating
> these manually from the doUnload method of my derived XSDResourceImpl
> class seems to do the trick. Are there other forward references that I'd
> need to update and do you think this approach will work?
>
> Thanks,
>
> James
>
> Ed Merks wrote:
>
> > James,
>
> > If you unload a schema, all the schemas that depend on it (indirectly
> include or
> > import it) will be in rough shape and should also be unloaded. Unloading
> them all
> > would be kind of brute force but certainly the easiest to implement.
>
> > James Taylor wrote:
>
> > > Ed,
> > >
> > > It worked like a charm -- thanks for the tip.
> > >
> > > One other scenario for you: if an XSD has already been loaded by Eclipse
> > > XSD and the XSD is modified outside of the Eclipse interfaces, can the
> > > schema model be updated in-place with the new XSD? This scenario comes up
> > > when trying to cache the schema model in a clustered server environment.
> > > If it changes on one server, the other servers may need to be updated as
> > > well. Would one solution be to unload the resource and then reload it?
> > > If so, are there limitations on this wrt the parts of the model that are
> > > dependent on the modified schema? I found a similar question asked before
> > > on this forum:
> > > http://dev.eclipse.org/newslists/news.eclipse.technology.xsd /msg00452.html
> > > Does all of this still apply? What approach would you recommend for this
> > > scenario?
> > >
> > > Thanks,
> > >
> > > James
> > >
> > > Ed Merks wrote:
> > >
> > > > James,
> > >
> > > > It should already do what you are wanting, if you use a common resource
> set
> > > to
> > > > load the instances. You would use ResourceSet.getResource(..., true) to
> make
> > > > sure you reuse already loaded schemas if you are loading them one by one.
> > >
> > > > Most of the focus on XSD has been on correctness and completeness not on
> > > > performance. So it's not very fast and it's pretty heavy weight.
> > >
> > > > James Taylor wrote:
> > >
> > > > > If I load Schema A that includes Schema B and then separately load
> Schema
> > > > > C that also includes Schema B, is there any way that I can get Eclipse
> XSD
> > > > > to reuse and rebind the Schema B that was already loaded when Schema C
> is
> > > > > loaded?
> > > > >
> > > > > For example, using the three schemas below, if I first load cat.xsd and
> > > > > then separately load dog.xsd, I'd like to be able to tell XSD to reuse
> the
> > > > > commonly included animal.xsd schema such that if I ask for the members
> of
> > > > > the animal substitution group, I'd get back both cat and dog.
> Otherwise,
> > > > > I'm forced to figure out the dependencies up front and load everything
> at
> > > > > once which in my case could be 1500+ schemas. Being able to load them
> > > > > as-needed would save on memory and processing time.
> > > > >
> > > > > One more related question: has anyone done any memory and performance
> > > > > profiling on loading XSD schemas? Is there an rough approximation I
> could
> > > > > use based on the size of the schema?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > James
> > > > >
> > > > > Schema A) cat.xsd:
> > > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > > > <xs:include schemaLocation="animal.xsd"/>
> > > > > <xs:element name="cat" substitutionGroup="animal"/>
> > > > > </xs:schema>
> > > > >
> > > > > Schema B) animal.xsd:
> > > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > > > <xs:element name="animal" abstract="true"/>
> > > > > </xs:schema>
> > > > >
> > > > > Schema C) dog.xsd:
> > > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > > > <xs:include schemaLocation="animal.xsd"/>
> > > > > <xs:element name="dog" substitutionGroup="animal"/>
> > > > > </xs:schema>
Re: binding during multiple loads [message #45769 is a reply to message #44500] Wed, 26 May 2004 12:08 Go to previous messageGo to next message
Christian Stein is currently offline Christian SteinFriend
Messages: 29
Registered: July 2009
Junior Member
On Thu, 13 May 2004 22:10:39 +0000 (UTC), James Taylor
<jtaylor@nextance.com> wrote:

> If I load Schema A that includes Schema B and then separately load Schema
> C that also includes Schema B, is there any way that I can get Eclipse
> XSD to reuse and rebind [...]

Hello!

I followed the thread and hoped a similar setup solved as well. :)

It didn't. Now I wonder, if the following configuriation is valid.

Here I load schema A that includes first schema B and second C.
B and C refer to types defined in A. Types in B refer to types
in C and vice versa WITHOUT B importing C nor imports C schema B.
When XSD loads B it doesn't know C-types yet, so they are left
blank. B-types that are used in C are resolved. If I change the
include order in A, the world flips...

Is this "WITHOUT" a design flaw? Or can I trigger a "bind" on the
root resource? Like:

ResourceSet set = new org.eclipse.xsd.util.XSDResourceImpl();

set.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_LOCATION,
Boolean.TRUE);

XSDSchema a = ((XSDResourceImpl) set.getResource("a.xsd"
true)).getSchema();

a.updateBinding();

Regards,
Christian
Re: binding during multiple loads [message #45799 is a reply to message #45769] Wed, 26 May 2004 12:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Christian,

What you describe sounds invalid. Names will not resolve by virtue of
inclusion in another schema. For B to see things in A it must include or
import A. So I'm not even sure your statement that B-types in C are resolved
without an import or include can be true; things just aren't designed nor
intended to work that way. (In fact, if A imports B which imports C, A cannot
see things in C unless it imports C directly.)


Christian Stein wrote:

> On Thu, 13 May 2004 22:10:39 +0000 (UTC), James Taylor
> <jtaylor@nextance.com> wrote:
>
> > If I load Schema A that includes Schema B and then separately load Schema
> > C that also includes Schema B, is there any way that I can get Eclipse
> > XSD to reuse and rebind [...]
>
> Hello!
>
> I followed the thread and hoped a similar setup solved as well. :)
>
> It didn't. Now I wonder, if the following configuriation is valid.
>
> Here I load schema A that includes first schema B and second C.
> B and C refer to types defined in A. Types in B refer to types
> in C and vice versa WITHOUT B importing C nor imports C schema B.
> When XSD loads B it doesn't know C-types yet, so they are left
> blank. B-types that are used in C are resolved. If I change the
> include order in A, the world flips...
>
> Is this "WITHOUT" a design flaw? Or can I trigger a "bind" on the
> root resource? Like:
>
> ResourceSet set = new org.eclipse.xsd.util.XSDResourceImpl();
>
> set.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_LOCATION,
> Boolean.TRUE);
>
> XSDSchema a = ((XSDResourceImpl) set.getResource("a.xsd"
> true)).getSchema();
>
> a.updateBinding();
>
> Regards,
> Christian
Re: binding during multiple loads [message #45829 is a reply to message #45799] Wed, 26 May 2004 13:05 Go to previous messageGo to next message
Christian Stein is currently offline Christian SteinFriend
Messages: 29
Registered: July 2009
Junior Member
On Wed, 26 May 2004 08:17:39 -0400, Ed Merks <merks@ca.ibm.com> wrote:

> Christian,
>
> What you describe sounds invalid. Names will not resolve by virtue of
> inclusion in another schema. For B to see things in A it must include or
> import A. So I'm not even sure your statement that B-types in C are
> resolved
> without an import or include can be true; things just aren't designed nor
> intended to work that way. (In fact, if A imports B which imports C, A
> cannot
> see things in C unless it imports C directly.)

Ed, my description was wrong due to over-simplification and lack of
deep knowledge. ;) Next try with links to the patients:

http://ltsc.ieee.org/xsd/lomv1.0/20040413/

In my last posting I renamed...

"lom.xsd" to "A",
"common/dataTypes.xsd" to "B" and finally
"common/elementTypes.xsd" to "C".

....and saw import statement where there were none. Sorry for that. But
the problem(?) is not "resolved" yet. As you can see below, C uses the
type "MimeType" declared in B WITHOUT importing/including B. Yes, this
feels like a flaw... but before blame s/o at IEEE... :)

A: lom.xsd

[...]

<xs:include schemaLocation="common/dataTypes.xsd"/> <!-- B -->
<xs:include schemaLocation="common/elementNames.xsd"/>
<xs:include schemaLocation="common/elementTypes.xsd"/> <!-- C -->
<xs:include schemaLocation="common/rootElement.xsd"/>
<xs:include schemaLocation="common/vocabValues.xsd"/>
<xs:include schemaLocation="common/vocabTypes.xsd"/>

</xs:schema>

B: common/dataTypes.xsd

[...]

<!-- MimeType -->
<xs:simpleType name="MimeType">
<xs:restriction base="CharacterString"/>
</xs:simpleType>

[...]

C: common/elementTypes.xsd

[...]

<!-- 4.1 Format -->
<xs:complexType name="format">
<xs:simpleContent>
<xs:extension base="MimeType">
<xs:attributeGroup ref="ag:format"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

[...]

Regards,
Christian
Re: binding during multiple loads [message #45859 is a reply to message #45829] Wed, 26 May 2004 13:29 Go to previous message
Christian Stein is currently offline Christian SteinFriend
Messages: 29
Registered: July 2009
Junior Member
On Wed, 26 May 2004 15:05:56 +0200, Christian Stein <sormuras@web.de>
wrote:

> [...]
> Ed, my description was wrong due to over-simplification and lack of
> deep knowledge. ;) Next try with links to the patients:

And again, I forgot to refine the real problem. :(

Looking at "format"...

> C: common/elementTypes.xsd
>
> <!-- 4.1 Format -->
> <xs:complexType name="format">
> <xs:simpleContent>
> <xs:extension base="MimeType">
> <xs:attributeGroup ref="ag:format"/>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>

....XSD delivers the correct simpleContent type "MimeType".
BUT the base type is reported as an anonymous type (null?).
Base type should point to the base of "MimeType", namely
"CharacterString", as defined in B

> B: common/dataTypes.xsd
>
> <!-- MimeType -->
> <xs:simpleType name="MimeType">
> <xs:restriction base="CharacterString"/>
> </xs:simpleType>

If I merge B and C into one file, everything is fine.

Regards, need a coffee,
Christian
Re: binding during multiple loads [message #587112 is a reply to message #44500] Thu, 13 May 2004 23:04 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
James,

It should already do what you are wanting, if you use a common resource set to
load the instances. You would use ResourceSet.getResource(..., true) to make
sure you reuse already loaded schemas if you are loading them one by one.

Most of the focus on XSD has been on correctness and completeness not on
performance. So it's not very fast and it's pretty heavy weight.


James Taylor wrote:

> If I load Schema A that includes Schema B and then separately load Schema
> C that also includes Schema B, is there any way that I can get Eclipse XSD
> to reuse and rebind the Schema B that was already loaded when Schema C is
> loaded?
>
> For example, using the three schemas below, if I first load cat.xsd and
> then separately load dog.xsd, I'd like to be able to tell XSD to reuse the
> commonly included animal.xsd schema such that if I ask for the members of
> the animal substitution group, I'd get back both cat and dog. Otherwise,
> I'm forced to figure out the dependencies up front and load everything at
> once which in my case could be 1500+ schemas. Being able to load them
> as-needed would save on memory and processing time.
>
> One more related question: has anyone done any memory and performance
> profiling on loading XSD schemas? Is there an rough approximation I could
> use based on the size of the schema?
>
> Thanks,
>
> James
>
> Schema A) cat.xsd:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:include schemaLocation="animal.xsd"/>
> <xs:element name="cat" substitutionGroup="animal"/>
> </xs:schema>
>
> Schema B) animal.xsd:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="animal" abstract="true"/>
> </xs:schema>
>
> Schema C) dog.xsd:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:include schemaLocation="animal.xsd"/>
> <xs:element name="dog" substitutionGroup="animal"/>
> </xs:schema>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: binding during multiple loads [message #587170 is a reply to message #44531] Mon, 17 May 2004 23:37 Go to previous message
James Taylor is currently offline James TaylorFriend
Messages: 21
Registered: July 2009
Junior Member
Ed,

It worked like a charm -- thanks for the tip.

One other scenario for you: if an XSD has already been loaded by Eclipse
XSD and the XSD is modified outside of the Eclipse interfaces, can the
schema model be updated in-place with the new XSD? This scenario comes up
when trying to cache the schema model in a clustered server environment.
If it changes on one server, the other servers may need to be updated as
well. Would one solution be to unload the resource and then reload it?
If so, are there limitations on this wrt the parts of the model that are
dependent on the modified schema? I found a similar question asked before
on this forum:
http://dev.eclipse.org/newslists/news.eclipse.technology.xsd /msg00452.html
Does all of this still apply? What approach would you recommend for this
scenario?

Thanks,

James

Ed Merks wrote:

> James,

> It should already do what you are wanting, if you use a common resource set
to
> load the instances. You would use ResourceSet.getResource(..., true) to make
> sure you reuse already loaded schemas if you are loading them one by one.

> Most of the focus on XSD has been on correctness and completeness not on
> performance. So it's not very fast and it's pretty heavy weight.


> James Taylor wrote:

> > If I load Schema A that includes Schema B and then separately load Schema
> > C that also includes Schema B, is there any way that I can get Eclipse XSD
> > to reuse and rebind the Schema B that was already loaded when Schema C is
> > loaded?
> >
> > For example, using the three schemas below, if I first load cat.xsd and
> > then separately load dog.xsd, I'd like to be able to tell XSD to reuse the
> > commonly included animal.xsd schema such that if I ask for the members of
> > the animal substitution group, I'd get back both cat and dog. Otherwise,
> > I'm forced to figure out the dependencies up front and load everything at
> > once which in my case could be 1500+ schemas. Being able to load them
> > as-needed would save on memory and processing time.
> >
> > One more related question: has anyone done any memory and performance
> > profiling on loading XSD schemas? Is there an rough approximation I could
> > use based on the size of the schema?
> >
> > Thanks,
> >
> > James
> >
> > Schema A) cat.xsd:
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > <xs:include schemaLocation="animal.xsd"/>
> > <xs:element name="cat" substitutionGroup="animal"/>
> > </xs:schema>
> >
> > Schema B) animal.xsd:
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > <xs:element name="animal" abstract="true"/>
> > </xs:schema>
> >
> > Schema C) dog.xsd:
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > <xs:include schemaLocation="animal.xsd"/>
> > <xs:element name="dog" substitutionGroup="animal"/>
> > </xs:schema>
Re: binding during multiple loads [message #587182 is a reply to message #44723] Tue, 18 May 2004 09:29 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
James,

If you unload a schema, all the schemas that depend on it (indirectly include or
import it) will be in rough shape and should also be unloaded. Unloading them all
would be kind of brute force but certainly the easiest to implement.


James Taylor wrote:

> Ed,
>
> It worked like a charm -- thanks for the tip.
>
> One other scenario for you: if an XSD has already been loaded by Eclipse
> XSD and the XSD is modified outside of the Eclipse interfaces, can the
> schema model be updated in-place with the new XSD? This scenario comes up
> when trying to cache the schema model in a clustered server environment.
> If it changes on one server, the other servers may need to be updated as
> well. Would one solution be to unload the resource and then reload it?
> If so, are there limitations on this wrt the parts of the model that are
> dependent on the modified schema? I found a similar question asked before
> on this forum:
> http://dev.eclipse.org/newslists/news.eclipse.technology.xsd /msg00452.html
> Does all of this still apply? What approach would you recommend for this
> scenario?
>
> Thanks,
>
> James
>
> Ed Merks wrote:
>
> > James,
>
> > It should already do what you are wanting, if you use a common resource set
> to
> > load the instances. You would use ResourceSet.getResource(..., true) to make
> > sure you reuse already loaded schemas if you are loading them one by one.
>
> > Most of the focus on XSD has been on correctness and completeness not on
> > performance. So it's not very fast and it's pretty heavy weight.
>
> > James Taylor wrote:
>
> > > If I load Schema A that includes Schema B and then separately load Schema
> > > C that also includes Schema B, is there any way that I can get Eclipse XSD
> > > to reuse and rebind the Schema B that was already loaded when Schema C is
> > > loaded?
> > >
> > > For example, using the three schemas below, if I first load cat.xsd and
> > > then separately load dog.xsd, I'd like to be able to tell XSD to reuse the
> > > commonly included animal.xsd schema such that if I ask for the members of
> > > the animal substitution group, I'd get back both cat and dog. Otherwise,
> > > I'm forced to figure out the dependencies up front and load everything at
> > > once which in my case could be 1500+ schemas. Being able to load them
> > > as-needed would save on memory and processing time.
> > >
> > > One more related question: has anyone done any memory and performance
> > > profiling on loading XSD schemas? Is there an rough approximation I could
> > > use based on the size of the schema?
> > >
> > > Thanks,
> > >
> > > James
> > >
> > > Schema A) cat.xsd:
> > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > <xs:include schemaLocation="animal.xsd"/>
> > > <xs:element name="cat" substitutionGroup="animal"/>
> > > </xs:schema>
> > >
> > > Schema B) animal.xsd:
> > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > <xs:element name="animal" abstract="true"/>
> > > </xs:schema>
> > >
> > > Schema C) dog.xsd:
> > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > <xs:include schemaLocation="animal.xsd"/>
> > > <xs:element name="dog" substitutionGroup="animal"/>
> > > </xs:schema>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: binding during multiple loads [message #587603 is a reply to message #44739] Tue, 25 May 2004 22:40 Go to previous message
James Taylor is currently offline James TaylorFriend
Messages: 21
Registered: July 2009
Junior Member
Ed,

I'd like to try to minimize the amount of reloading, so limiting the
unload to dependent schemas would work well. However, forward references
such as substition group members are (as expected) not updated. Updating
these manually from the doUnload method of my derived XSDResourceImpl
class seems to do the trick. Are there other forward references that I'd
need to update and do you think this approach will work?

Thanks,

James

Ed Merks wrote:

> James,

> If you unload a schema, all the schemas that depend on it (indirectly
include or
> import it) will be in rough shape and should also be unloaded. Unloading
them all
> would be kind of brute force but certainly the easiest to implement.


> James Taylor wrote:

> > Ed,
> >
> > It worked like a charm -- thanks for the tip.
> >
> > One other scenario for you: if an XSD has already been loaded by Eclipse
> > XSD and the XSD is modified outside of the Eclipse interfaces, can the
> > schema model be updated in-place with the new XSD? This scenario comes up
> > when trying to cache the schema model in a clustered server environment.
> > If it changes on one server, the other servers may need to be updated as
> > well. Would one solution be to unload the resource and then reload it?
> > If so, are there limitations on this wrt the parts of the model that are
> > dependent on the modified schema? I found a similar question asked before
> > on this forum:
> > http://dev.eclipse.org/newslists/news.eclipse.technology.xsd /msg00452.html
> > Does all of this still apply? What approach would you recommend for this
> > scenario?
> >
> > Thanks,
> >
> > James
> >
> > Ed Merks wrote:
> >
> > > James,
> >
> > > It should already do what you are wanting, if you use a common resource
set
> > to
> > > load the instances. You would use ResourceSet.getResource(..., true) to
make
> > > sure you reuse already loaded schemas if you are loading them one by one.
> >
> > > Most of the focus on XSD has been on correctness and completeness not on
> > > performance. So it's not very fast and it's pretty heavy weight.
> >
> > > James Taylor wrote:
> >
> > > > If I load Schema A that includes Schema B and then separately load
Schema
> > > > C that also includes Schema B, is there any way that I can get Eclipse
XSD
> > > > to reuse and rebind the Schema B that was already loaded when Schema C
is
> > > > loaded?
> > > >
> > > > For example, using the three schemas below, if I first load cat.xsd and
> > > > then separately load dog.xsd, I'd like to be able to tell XSD to reuse
the
> > > > commonly included animal.xsd schema such that if I ask for the members
of
> > > > the animal substitution group, I'd get back both cat and dog.
Otherwise,
> > > > I'm forced to figure out the dependencies up front and load everything
at
> > > > once which in my case could be 1500+ schemas. Being able to load them
> > > > as-needed would save on memory and processing time.
> > > >
> > > > One more related question: has anyone done any memory and performance
> > > > profiling on loading XSD schemas? Is there an rough approximation I
could
> > > > use based on the size of the schema?
> > > >
> > > > Thanks,
> > > >
> > > > James
> > > >
> > > > Schema A) cat.xsd:
> > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > > <xs:include schemaLocation="animal.xsd"/>
> > > > <xs:element name="cat" substitutionGroup="animal"/>
> > > > </xs:schema>
> > > >
> > > > Schema B) animal.xsd:
> > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > > <xs:element name="animal" abstract="true"/>
> > > > </xs:schema>
> > > >
> > > > Schema C) dog.xsd:
> > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > > <xs:include schemaLocation="animal.xsd"/>
> > > > <xs:element name="dog" substitutionGroup="animal"/>
> > > > </xs:schema>
Re: binding during multiple loads [message #587618 is a reply to message #45709] Tue, 25 May 2004 22:56 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
James,

The forward references required for computing substitution groups is the only
anomaly that needs special treatment. Your approach sounds like a workable one.


James Taylor wrote:

> Ed,
>
> I'd like to try to minimize the amount of reloading, so limiting the
> unload to dependent schemas would work well. However, forward references
> such as substition group members are (as expected) not updated. Updating
> these manually from the doUnload method of my derived XSDResourceImpl
> class seems to do the trick. Are there other forward references that I'd
> need to update and do you think this approach will work?
>
> Thanks,
>
> James
>
> Ed Merks wrote:
>
> > James,
>
> > If you unload a schema, all the schemas that depend on it (indirectly
> include or
> > import it) will be in rough shape and should also be unloaded. Unloading
> them all
> > would be kind of brute force but certainly the easiest to implement.
>
> > James Taylor wrote:
>
> > > Ed,
> > >
> > > It worked like a charm -- thanks for the tip.
> > >
> > > One other scenario for you: if an XSD has already been loaded by Eclipse
> > > XSD and the XSD is modified outside of the Eclipse interfaces, can the
> > > schema model be updated in-place with the new XSD? This scenario comes up
> > > when trying to cache the schema model in a clustered server environment.
> > > If it changes on one server, the other servers may need to be updated as
> > > well. Would one solution be to unload the resource and then reload it?
> > > If so, are there limitations on this wrt the parts of the model that are
> > > dependent on the modified schema? I found a similar question asked before
> > > on this forum:
> > > http://dev.eclipse.org/newslists/news.eclipse.technology.xsd /msg00452.html
> > > Does all of this still apply? What approach would you recommend for this
> > > scenario?
> > >
> > > Thanks,
> > >
> > > James
> > >
> > > Ed Merks wrote:
> > >
> > > > James,
> > >
> > > > It should already do what you are wanting, if you use a common resource
> set
> > > to
> > > > load the instances. You would use ResourceSet.getResource(..., true) to
> make
> > > > sure you reuse already loaded schemas if you are loading them one by one.
> > >
> > > > Most of the focus on XSD has been on correctness and completeness not on
> > > > performance. So it's not very fast and it's pretty heavy weight.
> > >
> > > > James Taylor wrote:
> > >
> > > > > If I load Schema A that includes Schema B and then separately load
> Schema
> > > > > C that also includes Schema B, is there any way that I can get Eclipse
> XSD
> > > > > to reuse and rebind the Schema B that was already loaded when Schema C
> is
> > > > > loaded?
> > > > >
> > > > > For example, using the three schemas below, if I first load cat.xsd and
> > > > > then separately load dog.xsd, I'd like to be able to tell XSD to reuse
> the
> > > > > commonly included animal.xsd schema such that if I ask for the members
> of
> > > > > the animal substitution group, I'd get back both cat and dog.
> Otherwise,
> > > > > I'm forced to figure out the dependencies up front and load everything
> at
> > > > > once which in my case could be 1500+ schemas. Being able to load them
> > > > > as-needed would save on memory and processing time.
> > > > >
> > > > > One more related question: has anyone done any memory and performance
> > > > > profiling on loading XSD schemas? Is there an rough approximation I
> could
> > > > > use based on the size of the schema?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > James
> > > > >
> > > > > Schema A) cat.xsd:
> > > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > > > <xs:include schemaLocation="animal.xsd"/>
> > > > > <xs:element name="cat" substitutionGroup="animal"/>
> > > > > </xs:schema>
> > > > >
> > > > > Schema B) animal.xsd:
> > > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > > > <xs:element name="animal" abstract="true"/>
> > > > > </xs:schema>
> > > > >
> > > > > Schema C) dog.xsd:
> > > > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> > > > > <xs:include schemaLocation="animal.xsd"/>
> > > > > <xs:element name="dog" substitutionGroup="animal"/>
> > > > > </xs:schema>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: binding during multiple loads [message #587622 is a reply to message #44500] Wed, 26 May 2004 12:08 Go to previous message
Christian Stein is currently offline Christian SteinFriend
Messages: 29
Registered: July 2009
Junior Member
On Thu, 13 May 2004 22:10:39 +0000 (UTC), James Taylor
<jtaylor@nextance.com> wrote:

> If I load Schema A that includes Schema B and then separately load Schema
> C that also includes Schema B, is there any way that I can get Eclipse
> XSD to reuse and rebind [...]

Hello!

I followed the thread and hoped a similar setup solved as well. :)

It didn't. Now I wonder, if the following configuriation is valid.

Here I load schema A that includes first schema B and second C.
B and C refer to types defined in A. Types in B refer to types
in C and vice versa WITHOUT B importing C nor imports C schema B.
When XSD loads B it doesn't know C-types yet, so they are left
blank. B-types that are used in C are resolved. If I change the
include order in A, the world flips...

Is this "WITHOUT" a design flaw? Or can I trigger a "bind" on the
root resource? Like:

ResourceSet set = new org.eclipse.xsd.util.XSDResourceImpl();

set.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_LOCATION,
Boolean.TRUE);

XSDSchema a = ((XSDResourceImpl) set.getResource("a.xsd"
true)).getSchema();

a.updateBinding();

Regards,
Christian
Re: binding during multiple loads [message #587632 is a reply to message #45769] Wed, 26 May 2004 12:17 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Christian,

What you describe sounds invalid. Names will not resolve by virtue of
inclusion in another schema. For B to see things in A it must include or
import A. So I'm not even sure your statement that B-types in C are resolved
without an import or include can be true; things just aren't designed nor
intended to work that way. (In fact, if A imports B which imports C, A cannot
see things in C unless it imports C directly.)


Christian Stein wrote:

> On Thu, 13 May 2004 22:10:39 +0000 (UTC), James Taylor
> <jtaylor@nextance.com> wrote:
>
> > If I load Schema A that includes Schema B and then separately load Schema
> > C that also includes Schema B, is there any way that I can get Eclipse
> > XSD to reuse and rebind [...]
>
> Hello!
>
> I followed the thread and hoped a similar setup solved as well. :)
>
> It didn't. Now I wonder, if the following configuriation is valid.
>
> Here I load schema A that includes first schema B and second C.
> B and C refer to types defined in A. Types in B refer to types
> in C and vice versa WITHOUT B importing C nor imports C schema B.
> When XSD loads B it doesn't know C-types yet, so they are left
> blank. B-types that are used in C are resolved. If I change the
> include order in A, the world flips...
>
> Is this "WITHOUT" a design flaw? Or can I trigger a "bind" on the
> root resource? Like:
>
> ResourceSet set = new org.eclipse.xsd.util.XSDResourceImpl();
>
> set.getLoadOptions().put(XSDResourceImpl.XSD_TRACK_LOCATION,
> Boolean.TRUE);
>
> XSDSchema a = ((XSDResourceImpl) set.getResource("a.xsd"
> true)).getSchema();
>
> a.updateBinding();
>
> Regards,
> Christian


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: binding during multiple loads [message #587638 is a reply to message #45799] Wed, 26 May 2004 13:05 Go to previous message
Christian Stein is currently offline Christian SteinFriend
Messages: 29
Registered: July 2009
Junior Member
On Wed, 26 May 2004 08:17:39 -0400, Ed Merks <merks@ca.ibm.com> wrote:

> Christian,
>
> What you describe sounds invalid. Names will not resolve by virtue of
> inclusion in another schema. For B to see things in A it must include or
> import A. So I'm not even sure your statement that B-types in C are
> resolved
> without an import or include can be true; things just aren't designed nor
> intended to work that way. (In fact, if A imports B which imports C, A
> cannot
> see things in C unless it imports C directly.)

Ed, my description was wrong due to over-simplification and lack of
deep knowledge. ;) Next try with links to the patients:

http://ltsc.ieee.org/xsd/lomv1.0/20040413/

In my last posting I renamed...

"lom.xsd" to "A",
"common/dataTypes.xsd" to "B" and finally
"common/elementTypes.xsd" to "C".

....and saw import statement where there were none. Sorry for that. But
the problem(?) is not "resolved" yet. As you can see below, C uses the
type "MimeType" declared in B WITHOUT importing/including B. Yes, this
feels like a flaw... but before blame s/o at IEEE... :)

A: lom.xsd

[...]

<xs:include schemaLocation="common/dataTypes.xsd"/> <!-- B -->
<xs:include schemaLocation="common/elementNames.xsd"/>
<xs:include schemaLocation="common/elementTypes.xsd"/> <!-- C -->
<xs:include schemaLocation="common/rootElement.xsd"/>
<xs:include schemaLocation="common/vocabValues.xsd"/>
<xs:include schemaLocation="common/vocabTypes.xsd"/>

</xs:schema>

B: common/dataTypes.xsd

[...]

<!-- MimeType -->
<xs:simpleType name="MimeType">
<xs:restriction base="CharacterString"/>
</xs:simpleType>

[...]

C: common/elementTypes.xsd

[...]

<!-- 4.1 Format -->
<xs:complexType name="format">
<xs:simpleContent>
<xs:extension base="MimeType">
<xs:attributeGroup ref="ag:format"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

[...]

Regards,
Christian
Re: binding during multiple loads [message #587650 is a reply to message #45829] Wed, 26 May 2004 13:29 Go to previous message
Christian Stein is currently offline Christian SteinFriend
Messages: 29
Registered: July 2009
Junior Member
On Wed, 26 May 2004 15:05:56 +0200, Christian Stein <sormuras@web.de>
wrote:

> [...]
> Ed, my description was wrong due to over-simplification and lack of
> deep knowledge. ;) Next try with links to the patients:

And again, I forgot to refine the real problem. :(

Looking at "format"...

> C: common/elementTypes.xsd
>
> <!-- 4.1 Format -->
> <xs:complexType name="format">
> <xs:simpleContent>
> <xs:extension base="MimeType">
> <xs:attributeGroup ref="ag:format"/>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>

....XSD delivers the correct simpleContent type "MimeType".
BUT the base type is reported as an anonymous type (null?).
Base type should point to the base of "MimeType", namely
"CharacterString", as defined in B

> B: common/dataTypes.xsd
>
> <!-- MimeType -->
> <xs:simpleType name="MimeType">
> <xs:restriction base="CharacterString"/>
> </xs:simpleType>

If I merge B and C into one file, everything is fine.

Regards, need a coffee,
Christian
Previous Topic:NPE during schema validation
Next Topic:Base for relative schemaLocations
Goto Forum:
  


Current Time: Thu Mar 28 13:05:32 GMT 2024

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

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

Back to the top