Home » Archived » XML Schema Definition (XSD) » Sharing a common schema instance across many schemas
Sharing a common schema instance across many schemas [message #31712] |
Sat, 11 October 2003 19:30 |
Eclipse User |
|
|
|
Originally posted by: cipher8000.yahoo.com
Hi Ed,
I am looking for a way to share a common imported schema instance
across many schemas. I have the following two schemas (foo.xsd and goo.xsd)
importing an xsd (common.xsd) which is common to both. Like below:
boo.xsd:
<schema targetNamespace="boo">
<import namespace="foo" location="foo.xsd" />
<import namespace="goo" location="goo.xsd" />
</schema>
foo.xsd:
<schema targetNamespace="foo">
<import namespace="common" location="common.xsd" />
</schema>
goo.xsd:
<schema targetNamespace="goo">
<import namespace="common" location="common.xsd" />
</schema>
Now when i load "boo.xsd", which intern resolves "foo.xsd"
and "goo.xsd".
"foo.xsd" & "goo.xsd" schemas loads common.xsd, each one
keeps its own copy of common.xsd schema. But i want to keep only
once instance of common.xsd and ask foo.xsd and goo.xsd to
share this common.xsd instance.This would save lots of memory.
If you have 20 schemas sharing one common schema.
It will be very useful if i could share one schema instance of across
many schemas.
Can i get a hint on how to do this in eclipse xsd?
thanks
-muruga
|
|
|
Re: Sharing a common schema instance across many schemas [message #31754 is a reply to message #31712] |
Sun, 12 October 2003 15:48 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
--------------2498F66E03BD2178698817E3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Muruga,
If you load the resources into a common resource set, it already works exactly
the way you want. For example, if I take these files:
boo.xsd
<schema targetNamespace="boo"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:boo="boo"
xmlns:foo="foo" xmlns:goo="goo">
<import namespace="foo" schemaLocation="foo.xsd" />
<import namespace="goo" schemaLocation="goo.xsd" />
<element name="boo-foo" substitutionGroup="foo:foo"/>
<element name="boo-goo" substitutionGroup="goo:goo"/>
</schema>
foo.xsd
<schema targetNamespace="foo"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:foo="foo"
xmlns:common="common">
<import namespace="common" schemaLocation="common.xsd" />
<element name="foo" substitutionGroup="common:common"/>
</schema>
goo.xsd
<schema targetNamespace="goo"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:goo="goo"
xmlns:common="common">
<import namespace="common" schemaLocation="common.xsd" />
<element name="goo" substitutionGroup="common:common"/>
</schema>
common.xsd
<schema targetNamespace="common"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:common="common">
<element name="common"/>
</schema>
And I run xsd-test.bat -validate on it, it prints out the URI of each resource
that's loaded and validated:
> xsd-test.bat -validate
D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/muruga/bo o.xsd
-->
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/boo.xsd
-->
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/foo.xsd
-->
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/common.xsd
-->
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/goo.xsd
As you can see, only one instance of each resource is loaded and the XSD
components in each resource are shared as you would expect and desire. (One
can't implement proper XML Schema semantics without supporting exactly this
type of sharing.) The key here is simply to load the schema resources into a
common ResourceSet.
Muruga Chinnananchi wrote:
> Hi Ed,
>
> I am looking for a way to share a common imported schema instance
> across many schemas. I have the following two schemas (foo.xsd and goo.xsd)
> importing an xsd (common.xsd) which is common to both. Like below:
>
> boo.xsd:
> <schema targetNamespace="boo">
> <import namespace="foo" location="foo.xsd" />
> <import namespace="goo" location="goo.xsd" />
> </schema>
>
> foo.xsd:
> <schema targetNamespace="foo">
> <import namespace="common" location="common.xsd" />
> </schema>
>
> goo.xsd:
> <schema targetNamespace="goo">
> <import namespace="common" location="common.xsd" />
> </schema>
>
> Now when i load "boo.xsd", which intern resolves "foo.xsd"
> and "goo.xsd".
>
> "foo.xsd" & "goo.xsd" schemas loads common.xsd, each one
> keeps its own copy of common.xsd schema. But i want to keep only
> once instance of common.xsd and ask foo.xsd and goo.xsd to
> share this common.xsd instance.This would save lots of memory.
> If you have 20 schemas sharing one common schema.
>
> It will be very useful if i could share one schema instance of across
> many schemas.
>
> Can i get a hint on how to do this in eclipse xsd?
>
> thanks
> -muruga
--------------2498F66E03BD2178698817E3
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Muruga,
<p>If you load the resources into a common resource set, it already works
exactly the way you want. For example, if I take these files:
<blockquote><b>boo.xsd</b>
<br><schema targetNamespace="boo" xmlns="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
xmlns:boo="boo" xmlns:foo="foo" xmlns:goo="goo">
<br> <import namespace="foo" schemaLocation="foo.xsd" />
<br> <import namespace="goo" schemaLocation="goo.xsd" />
<p> <element name="boo-foo" substitutionGroup="foo:foo"/>
<br> <element name="boo-goo" substitutionGroup="goo:goo"/>
<br></schema>
<br><b>foo.xsd</b>
<br><schema targetNamespace="foo" xmlns="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
xmlns:foo="foo" xmlns:common="common">
<br> <import namespace="common" schemaLocation="common.xsd"
/>
<p> <element name="foo" substitutionGroup="common:common"/>
<br></schema>
<br><b>goo.xsd</b>
<br><schema targetNamespace="goo" xmlns="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
xmlns:goo="goo" xmlns:common="common">
<br> <import namespace="common" schemaLocation="common.xsd"
/>
<p> <element name="goo" substitutionGroup="common:common"/>
<br></schema>
<br><b>common.xsd</b>
<br><schema targetNamespace="common" xmlns="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
xmlns:common="common">
<br> <element name="common"/>
<br></schema></blockquote>
And I run xsd-test.bat -validate on it, it prints out the URI of each resource
that's loaded and validated:
<blockquote>> xsd-test.bat -validate D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/muruga/bo o.xsd
<br>--> <A HREF=" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/boo.xsd "> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/boo.xsd </A>
<br>--> <A HREF=" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/foo.xsd "> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/foo.xsd </A>
<br>--> <A HREF=" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/common.xsd "> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/common.xsd </A>
<br>--> <A HREF=" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/goo.xsd "> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/goo.xsd </A></blockquote>
As you can see, only one instance of each resource is loaded and the XSD
components in each resource are shared as you would expect and desire.
(One can't implement proper XML Schema semantics without supporting exactly
this type of sharing.) The key here is simply to load the schema
resources into a common ResourceSet.
<br>
<p>Muruga Chinnananchi wrote:
<blockquote TYPE=CITE>Hi Ed,
<p>I am looking for a way to share a common imported schema instance
<br>across many schemas. I have the following two schemas (foo.xsd and
goo.xsd)
<br>importing an xsd (common.xsd) which is common to both. Like below:
<p>boo.xsd:
<br><schema targetNamespace="boo">
<br> <import namespace="foo" location="foo.xsd" />
<br> <import namespace="goo" location="goo.xsd" />
<br></schema>
<p>foo.xsd:
<br><schema targetNamespace="foo">
<br> <import namespace="common" location="common.xsd" />
<br></schema>
<p>goo.xsd:
<br><schema targetNamespace="goo">
<br> <import namespace="common" location="common.xsd" />
<br></schema>
<p>Now when i load "boo.xsd", which intern resolves "foo.xsd"
<br>and "goo.xsd".
<p>"foo.xsd" & "goo.xsd" schemas loads common.xsd, each one
<br>keeps its own copy of common.xsd schema. But i want to keep only
<br>once instance of common.xsd and ask foo.xsd and goo.xsd to
<br>share this common.xsd instance.This would save lots of memory.
<br>If you have 20 schemas sharing one common schema.
<p>It will be very useful if i could share one schema instance of across
<br>many schemas.
<p>Can i get a hint on how to do this in eclipse xsd?
<p>thanks
<br>-muruga</blockquote>
</html>
--------------2498F66E03BD2178698817E3--
|
|
|
Re: Sharing a common schema instance across many schemas [message #31789 is a reply to message #31754] |
Sun, 12 October 2003 18:46 |
Eclipse User |
|
|
|
Originally posted by: cipher8000.yahoo.com
This is a multi-part message in MIME format.
------=_NextPart_000_0012_01C390B6.73146570
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Ed,
Thank you so much for your help. I appreciate that. This is great..yes. =
now I am using common resource set for loading all schemas...that's =
solves this problem.
again, thanks very much for your help.
-muruga
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:3F8977C5.D975262D@ca.ibm.com...
Muruga,=20
If you load the resources into a common resource set, it already works =
exactly the way you want. For example, if I take these files:=20
boo.xsd=20
<schema targetNamespace=3D"boo" =
xmlns=3D"http://www.w3.org/2001/XMLSchema" xmlns:boo=3D"boo" =
xmlns:foo=3D"foo" xmlns:goo=3D"goo">=20
<import namespace=3D"foo" schemaLocation=3D"foo.xsd" />=20
<import namespace=3D"goo" schemaLocation=3D"goo.xsd" />=20
<element name=3D"boo-foo" substitutionGroup=3D"foo:foo"/>=20
<element name=3D"boo-goo" substitutionGroup=3D"goo:goo"/>=20
</schema>=20
foo.xsd=20
<schema targetNamespace=3D"foo" =
xmlns=3D"http://www.w3.org/2001/XMLSchema" xmlns:foo=3D"foo" =
xmlns:common=3D"common">=20
<import namespace=3D"common" schemaLocation=3D"common.xsd" />=20
<element name=3D"foo" substitutionGroup=3D"common:common"/>=20
</schema>=20
goo.xsd=20
<schema targetNamespace=3D"goo" =
xmlns=3D"http://www.w3.org/2001/XMLSchema" xmlns:goo=3D"goo" =
xmlns:common=3D"common">=20
<import namespace=3D"common" schemaLocation=3D"common.xsd" />=20
<element name=3D"goo" substitutionGroup=3D"common:common"/>=20
</schema>=20
common.xsd=20
<schema targetNamespace=3D"common" =
xmlns=3D"http://www.w3.org/2001/XMLSchema" xmlns:common=3D"common">=20
<element name=3D"common"/>=20
</schema>
And I run xsd-test.bat -validate on it, it prints out the URI of each =
resource that's loaded and validated:=20
> xsd-test.bat -validate =
D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/muruga/bo o.xsd=20
--> =
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/boo.xsd=20
--> =
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/foo.xsd=20
--> =
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/common.xs=
d=20
--> =
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/goo.xsd
As you can see, only one instance of each resource is loaded and the =
XSD components in each resource are shared as you would expect and =
desire. (One can't implement proper XML Schema semantics without =
supporting exactly this type of sharing.) The key here is simply to =
load the schema resources into a common ResourceSet.=20
=20
Muruga Chinnananchi wrote:=20
Hi Ed,=20
I am looking for a way to share a common imported schema instance=20
across many schemas. I have the following two schemas (foo.xsd and =
goo.xsd)=20
importing an xsd (common.xsd) which is common to both. Like below:=20
boo.xsd:=20
<schema targetNamespace=3D"boo">=20
<import namespace=3D"foo" location=3D"foo.xsd" />=20
<import namespace=3D"goo" location=3D"goo.xsd" />=20
</schema>=20
foo.xsd:=20
<schema targetNamespace=3D"foo">=20
<import namespace=3D"common" location=3D"common.xsd" />=20
</schema>=20
goo.xsd:=20
<schema targetNamespace=3D"goo">=20
<import namespace=3D"common" location=3D"common.xsd" />=20
</schema>=20
Now when i load "boo.xsd", which intern resolves "foo.xsd"=20
and "goo.xsd".=20
"foo.xsd" & "goo.xsd" schemas loads common.xsd, each one=20
keeps its own copy of common.xsd schema. But i want to keep only=20
once instance of common.xsd and ask foo.xsd and goo.xsd to=20
share this common.xsd instance.This would save lots of memory.=20
If you have 20 schemas sharing one common schema.=20
It will be very useful if i could share one schema instance of =
across=20
many schemas.=20
Can i get a hint on how to do this in eclipse xsd?=20
thanks=20
-muruga
------=_NextPart_000_0012_01C390B6.73146570
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1264" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thank you so much for your help. I =
appreciate that.=20
This is great..yes. now I am using common resource set for loading all=20
schemas...that's solves this problem.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>again, thanks very much for your =
help.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-muruga</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>"Ed Merks" <<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>>=20
wrote in message <A=20
href=3D"news:3F8977C5.D975262D@ca.ibm.com">news:3F8977C5.D975262D@ca.ibm.=
com</A>...</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">Muruga,=20
<P>If you load the resources into a common resource set, it already =
works=20
exactly the way you want. For example, if I take these files:=20
<BLOCKQUOTE><B>boo.xsd</B> <BR><schema targetNamespace=3D"boo" =
xmlns=3D"<A=20
=
href=3D"http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchem=
a</A>"=20
xmlns:boo=3D"boo" xmlns:foo=3D"foo" xmlns:goo=3D"goo"> =
<BR> =20
<import namespace=3D"foo" schemaLocation=3D"foo.xsd" /> =
<BR> =20
<import namespace=3D"goo" schemaLocation=3D"goo.xsd" />=20
<P> <element name=3D"boo-foo" =
substitutionGroup=3D"foo:foo"/>=20
<BR> <element name=3D"boo-goo" =
substitutionGroup=3D"goo:goo"/>=20
<BR></schema> <BR><B>foo.xsd</B> <BR><schema =
targetNamespace=3D"foo"=20
xmlns=3D"<A=20
=
href=3D"http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchem=
a</A>"=20
xmlns:foo=3D"foo" xmlns:common=3D"common"> <BR> =
<import=20
namespace=3D"common" schemaLocation=3D"common.xsd" />=20
<P> <element name=3D"foo"=20
substitutionGroup=3D"common:common"/> <BR></schema>=20
<BR><B>goo.xsd</B> <BR><schema targetNamespace=3D"goo" =
xmlns=3D"<A=20
=
href=3D"http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchem=
a</A>"=20
xmlns:goo=3D"goo" xmlns:common=3D"common"> <BR> =
<import=20
namespace=3D"common" schemaLocation=3D"common.xsd" />=20
<P> <element name=3D"goo"=20
substitutionGroup=3D"common:common"/> <BR></schema>=20
<BR><B>common.xsd</B> <BR><schema targetNamespace=3D"common" =
xmlns=3D"<A=20
=
href=3D"http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchem=
a</A>"=20
xmlns:common=3D"common"> <BR> <element =
name=3D"common"/>=20
<BR></schema></P></BLOCKQUOTE>And I run xsd-test.bat -validate =
on it, it=20
prints out the URI of each resource that's loaded and validated:=20
<BLOCKQUOTE>> xsd-test.bat -validate=20
D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/muruga/bo o.xsd =
<BR>-->=20
<A=20
=
href=3D" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/b=
oo.xsd"> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/b=
oo.xsd</A>=20
<BR>--> <A=20
=
href=3D" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/f=
oo.xsd"> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/f=
oo.xsd</A>=20
<BR>--> <A=20
=
href=3D" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/c=
ommon.xsd"> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur ug=
a/common.xsd</A>=20
<BR>--> <A=20
=
href=3D" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/g=
oo.xsd"> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/g=
oo.xsd</A></BLOCKQUOTE>As=20
you can see, only one instance of each resource is loaded and the XSD=20
components in each resource are shared as you would expect and =
desire.=20
(One can't implement proper XML Schema semantics without supporting =
exactly=20
this type of sharing.) The key here is simply to load the schema =
resources into a common ResourceSet. <BR> =20
<P>Muruga Chinnananchi wrote:=20
<BLOCKQUOTE TYPE=3D"CITE">Hi Ed,=20
<P>I am looking for a way to share a common imported schema instance =
<BR>across many schemas. I have the following two schemas (foo.xsd =
and=20
goo.xsd) <BR>importing an xsd (common.xsd) which is common to both. =
Like=20
below:=20
<P>boo.xsd: <BR><schema targetNamespace=3D"boo"> =
<BR> =20
<import namespace=3D"foo" location=3D"foo.xsd" /> =
<BR> =20
<import namespace=3D"goo" location=3D"goo.xsd" /> =
<BR></schema>=20
<P>foo.xsd: <BR><schema targetNamespace=3D"foo"> =
<BR> =20
<import namespace=3D"common" location=3D"common.xsd" />=20
<BR></schema>=20
<P>goo.xsd: <BR><schema targetNamespace=3D"goo"> =
<BR> =20
<import namespace=3D"common" location=3D"common.xsd" />=20
<BR></schema>=20
<P>Now when i load "boo.xsd", which intern resolves "foo.xsd" =
<BR>and=20
"goo.xsd".=20
<P>"foo.xsd" & "goo.xsd" schemas loads common.xsd, each one =
<BR>keeps=20
its own copy of common.xsd schema. But i want to keep only <BR>once =
instance=20
of common.xsd and ask foo.xsd and goo.xsd to <BR>share this =
common.xsd=20
instance.This would save lots of memory. <BR>If you have 20 schemas =
sharing=20
one common schema.=20
<P>It will be very useful if i could share one schema instance of =
across=20
<BR>many schemas.=20
<P>Can i get a hint on how to do this in eclipse xsd?=20
<P>thanks <BR>-muruga</P></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML >
------=_NextPart_000_0012_01C390B6.73146570--
|
|
|
Re: Sharing a common schema instance across many schemas [message #579793 is a reply to message #31712] |
Sun, 12 October 2003 15:48 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
--------------2498F66E03BD2178698817E3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Muruga,
If you load the resources into a common resource set, it already works exactly
the way you want. For example, if I take these files:
boo.xsd
<schema targetNamespace="boo"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:boo="boo"
xmlns:foo="foo" xmlns:goo="goo">
<import namespace="foo" schemaLocation="foo.xsd" />
<import namespace="goo" schemaLocation="goo.xsd" />
<element name="boo-foo" substitutionGroup="foo:foo"/>
<element name="boo-goo" substitutionGroup="goo:goo"/>
</schema>
foo.xsd
<schema targetNamespace="foo"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:foo="foo"
xmlns:common="common">
<import namespace="common" schemaLocation="common.xsd" />
<element name="foo" substitutionGroup="common:common"/>
</schema>
goo.xsd
<schema targetNamespace="goo"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:goo="goo"
xmlns:common="common">
<import namespace="common" schemaLocation="common.xsd" />
<element name="goo" substitutionGroup="common:common"/>
</schema>
common.xsd
<schema targetNamespace="common"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:common="common">
<element name="common"/>
</schema>
And I run xsd-test.bat -validate on it, it prints out the URI of each resource
that's loaded and validated:
> xsd-test.bat -validate
D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/muruga/bo o.xsd
-->
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/boo.xsd
-->
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/foo.xsd
-->
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/common.xsd
-->
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/goo.xsd
As you can see, only one instance of each resource is loaded and the XSD
components in each resource are shared as you would expect and desire. (One
can't implement proper XML Schema semantics without supporting exactly this
type of sharing.) The key here is simply to load the schema resources into a
common ResourceSet.
Muruga Chinnananchi wrote:
> Hi Ed,
>
> I am looking for a way to share a common imported schema instance
> across many schemas. I have the following two schemas (foo.xsd and goo.xsd)
> importing an xsd (common.xsd) which is common to both. Like below:
>
> boo.xsd:
> <schema targetNamespace="boo">
> <import namespace="foo" location="foo.xsd" />
> <import namespace="goo" location="goo.xsd" />
> </schema>
>
> foo.xsd:
> <schema targetNamespace="foo">
> <import namespace="common" location="common.xsd" />
> </schema>
>
> goo.xsd:
> <schema targetNamespace="goo">
> <import namespace="common" location="common.xsd" />
> </schema>
>
> Now when i load "boo.xsd", which intern resolves "foo.xsd"
> and "goo.xsd".
>
> "foo.xsd" & "goo.xsd" schemas loads common.xsd, each one
> keeps its own copy of common.xsd schema. But i want to keep only
> once instance of common.xsd and ask foo.xsd and goo.xsd to
> share this common.xsd instance.This would save lots of memory.
> If you have 20 schemas sharing one common schema.
>
> It will be very useful if i could share one schema instance of across
> many schemas.
>
> Can i get a hint on how to do this in eclipse xsd?
>
> thanks
> -muruga
--------------2498F66E03BD2178698817E3
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Muruga,
<p>If you load the resources into a common resource set, it already works
exactly the way you want. For example, if I take these files:
<blockquote><b>boo.xsd</b>
<br><schema targetNamespace="boo" xmlns="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
xmlns:boo="boo" xmlns:foo="foo" xmlns:goo="goo">
<br> <import namespace="foo" schemaLocation="foo.xsd" />
<br> <import namespace="goo" schemaLocation="goo.xsd" />
<p> <element name="boo-foo" substitutionGroup="foo:foo"/>
<br> <element name="boo-goo" substitutionGroup="goo:goo"/>
<br></schema>
<br><b>foo.xsd</b>
<br><schema targetNamespace="foo" xmlns="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
xmlns:foo="foo" xmlns:common="common">
<br> <import namespace="common" schemaLocation="common.xsd"
/>
<p> <element name="foo" substitutionGroup="common:common"/>
<br></schema>
<br><b>goo.xsd</b>
<br><schema targetNamespace="goo" xmlns="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
xmlns:goo="goo" xmlns:common="common">
<br> <import namespace="common" schemaLocation="common.xsd"
/>
<p> <element name="goo" substitutionGroup="common:common"/>
<br></schema>
<br><b>common.xsd</b>
<br><schema targetNamespace="common" xmlns="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
xmlns:common="common">
<br> <element name="common"/>
<br></schema></blockquote>
And I run xsd-test.bat -validate on it, it prints out the URI of each resource
that's loaded and validated:
<blockquote>> xsd-test.bat -validate D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/muruga/bo o.xsd
<br>--> <A HREF=" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/boo.xsd "> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/boo.xsd </A>
<br>--> <A HREF=" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/foo.xsd "> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/foo.xsd </A>
<br>--> <A HREF=" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/common.xsd "> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/common.xsd </A>
<br>--> <A HREF=" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/goo.xsd "> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/goo.xsd </A></blockquote>
As you can see, only one instance of each resource is loaded and the XSD
components in each resource are shared as you would expect and desire.
(One can't implement proper XML Schema semantics without supporting exactly
this type of sharing.) The key here is simply to load the schema
resources into a common ResourceSet.
<br>
<p>Muruga Chinnananchi wrote:
<blockquote TYPE=CITE>Hi Ed,
<p>I am looking for a way to share a common imported schema instance
<br>across many schemas. I have the following two schemas (foo.xsd and
goo.xsd)
<br>importing an xsd (common.xsd) which is common to both. Like below:
<p>boo.xsd:
<br><schema targetNamespace="boo">
<br> <import namespace="foo" location="foo.xsd" />
<br> <import namespace="goo" location="goo.xsd" />
<br></schema>
<p>foo.xsd:
<br><schema targetNamespace="foo">
<br> <import namespace="common" location="common.xsd" />
<br></schema>
<p>goo.xsd:
<br><schema targetNamespace="goo">
<br> <import namespace="common" location="common.xsd" />
<br></schema>
<p>Now when i load "boo.xsd", which intern resolves "foo.xsd"
<br>and "goo.xsd".
<p>"foo.xsd" & "goo.xsd" schemas loads common.xsd, each one
<br>keeps its own copy of common.xsd schema. But i want to keep only
<br>once instance of common.xsd and ask foo.xsd and goo.xsd to
<br>share this common.xsd instance.This would save lots of memory.
<br>If you have 20 schemas sharing one common schema.
<p>It will be very useful if i could share one schema instance of across
<br>many schemas.
<p>Can i get a hint on how to do this in eclipse xsd?
<p>thanks
<br>-muruga</blockquote>
</html>
--------------2498F66E03BD2178698817E3--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Sharing a common schema instance across many schemas [message #579825 is a reply to message #31754] |
Sun, 12 October 2003 18:46 |
Eclipse User |
|
|
|
Originally posted by: cipher8000.yahoo.com
This is a multi-part message in MIME format.
------=_NextPart_000_0012_01C390B6.73146570
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Ed,
Thank you so much for your help. I appreciate that. This is great..yes. =
now I am using common resource set for loading all schemas...that's =
solves this problem.
again, thanks very much for your help.
-muruga
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:3F8977C5.D975262D@ca.ibm.com...
Muruga,=20
If you load the resources into a common resource set, it already works =
exactly the way you want. For example, if I take these files:=20
boo.xsd=20
<schema targetNamespace=3D"boo" =
xmlns=3D"http://www.w3.org/2001/XMLSchema" xmlns:boo=3D"boo" =
xmlns:foo=3D"foo" xmlns:goo=3D"goo">=20
<import namespace=3D"foo" schemaLocation=3D"foo.xsd" />=20
<import namespace=3D"goo" schemaLocation=3D"goo.xsd" />=20
<element name=3D"boo-foo" substitutionGroup=3D"foo:foo"/>=20
<element name=3D"boo-goo" substitutionGroup=3D"goo:goo"/>=20
</schema>=20
foo.xsd=20
<schema targetNamespace=3D"foo" =
xmlns=3D"http://www.w3.org/2001/XMLSchema" xmlns:foo=3D"foo" =
xmlns:common=3D"common">=20
<import namespace=3D"common" schemaLocation=3D"common.xsd" />=20
<element name=3D"foo" substitutionGroup=3D"common:common"/>=20
</schema>=20
goo.xsd=20
<schema targetNamespace=3D"goo" =
xmlns=3D"http://www.w3.org/2001/XMLSchema" xmlns:goo=3D"goo" =
xmlns:common=3D"common">=20
<import namespace=3D"common" schemaLocation=3D"common.xsd" />=20
<element name=3D"goo" substitutionGroup=3D"common:common"/>=20
</schema>=20
common.xsd=20
<schema targetNamespace=3D"common" =
xmlns=3D"http://www.w3.org/2001/XMLSchema" xmlns:common=3D"common">=20
<element name=3D"common"/>=20
</schema>
And I run xsd-test.bat -validate on it, it prints out the URI of each =
resource that's loaded and validated:=20
> xsd-test.bat -validate =
D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/muruga/bo o.xsd=20
--> =
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/boo.xsd=20
--> =
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/foo.xsd=20
--> =
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/common.xs=
d=20
--> =
file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/goo.xsd
As you can see, only one instance of each resource is loaded and the =
XSD components in each resource are shared as you would expect and =
desire. (One can't implement proper XML Schema semantics without =
supporting exactly this type of sharing.) The key here is simply to =
load the schema resources into a common ResourceSet.=20
=20
Muruga Chinnananchi wrote:=20
Hi Ed,=20
I am looking for a way to share a common imported schema instance=20
across many schemas. I have the following two schemas (foo.xsd and =
goo.xsd)=20
importing an xsd (common.xsd) which is common to both. Like below:=20
boo.xsd:=20
<schema targetNamespace=3D"boo">=20
<import namespace=3D"foo" location=3D"foo.xsd" />=20
<import namespace=3D"goo" location=3D"goo.xsd" />=20
</schema>=20
foo.xsd:=20
<schema targetNamespace=3D"foo">=20
<import namespace=3D"common" location=3D"common.xsd" />=20
</schema>=20
goo.xsd:=20
<schema targetNamespace=3D"goo">=20
<import namespace=3D"common" location=3D"common.xsd" />=20
</schema>=20
Now when i load "boo.xsd", which intern resolves "foo.xsd"=20
and "goo.xsd".=20
"foo.xsd" & "goo.xsd" schemas loads common.xsd, each one=20
keeps its own copy of common.xsd schema. But i want to keep only=20
once instance of common.xsd and ask foo.xsd and goo.xsd to=20
share this common.xsd instance.This would save lots of memory.=20
If you have 20 schemas sharing one common schema.=20
It will be very useful if i could share one schema instance of =
across=20
many schemas.=20
Can i get a hint on how to do this in eclipse xsd?=20
thanks=20
-muruga
------=_NextPart_000_0012_01C390B6.73146570
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1264" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Ed,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thank you so much for your help. I =
appreciate that.=20
This is great..yes. now I am using common resource set for loading all=20
schemas...that's solves this problem.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>again, thanks very much for your =
help.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-muruga</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>"Ed Merks" <<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>>=20
wrote in message <A=20
href=3D"news:3F8977C5.D975262D@ca.ibm.com">news:3F8977C5.D975262D@ca.ibm.=
com</A>...</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">Muruga,=20
<P>If you load the resources into a common resource set, it already =
works=20
exactly the way you want. For example, if I take these files:=20
<BLOCKQUOTE><B>boo.xsd</B> <BR><schema targetNamespace=3D"boo" =
xmlns=3D"<A=20
=
href=3D"http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchem=
a</A>"=20
xmlns:boo=3D"boo" xmlns:foo=3D"foo" xmlns:goo=3D"goo"> =
<BR> =20
<import namespace=3D"foo" schemaLocation=3D"foo.xsd" /> =
<BR> =20
<import namespace=3D"goo" schemaLocation=3D"goo.xsd" />=20
<P> <element name=3D"boo-foo" =
substitutionGroup=3D"foo:foo"/>=20
<BR> <element name=3D"boo-goo" =
substitutionGroup=3D"goo:goo"/>=20
<BR></schema> <BR><B>foo.xsd</B> <BR><schema =
targetNamespace=3D"foo"=20
xmlns=3D"<A=20
=
href=3D"http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchem=
a</A>"=20
xmlns:foo=3D"foo" xmlns:common=3D"common"> <BR> =
<import=20
namespace=3D"common" schemaLocation=3D"common.xsd" />=20
<P> <element name=3D"foo"=20
substitutionGroup=3D"common:common"/> <BR></schema>=20
<BR><B>goo.xsd</B> <BR><schema targetNamespace=3D"goo" =
xmlns=3D"<A=20
=
href=3D"http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchem=
a</A>"=20
xmlns:goo=3D"goo" xmlns:common=3D"common"> <BR> =
<import=20
namespace=3D"common" schemaLocation=3D"common.xsd" />=20
<P> <element name=3D"goo"=20
substitutionGroup=3D"common:common"/> <BR></schema>=20
<BR><B>common.xsd</B> <BR><schema targetNamespace=3D"common" =
xmlns=3D"<A=20
=
href=3D"http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchem=
a</A>"=20
xmlns:common=3D"common"> <BR> <element =
name=3D"common"/>=20
<BR></schema></P></BLOCKQUOTE>And I run xsd-test.bat -validate =
on it, it=20
prints out the URI of each resource that's loaded and validated:=20
<BLOCKQUOTE>> xsd-test.bat -validate=20
D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/muruga/bo o.xsd =
<BR>-->=20
<A=20
=
href=3D" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/b=
oo.xsd"> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/b=
oo.xsd</A>=20
<BR>--> <A=20
=
href=3D" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/f=
oo.xsd"> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/f=
oo.xsd</A>=20
<BR>--> <A=20
=
href=3D" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/c=
ommon.xsd"> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur ug=
a/common.xsd</A>=20
<BR>--> <A=20
=
href=3D" file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/g=
oo.xsd"> file:/D:/sandbox/unpackage1_3.0/eclipse/workspace/simple/mur uga/g=
oo.xsd</A></BLOCKQUOTE>As=20
you can see, only one instance of each resource is loaded and the XSD=20
components in each resource are shared as you would expect and =
desire.=20
(One can't implement proper XML Schema semantics without supporting =
exactly=20
this type of sharing.) The key here is simply to load the schema =
resources into a common ResourceSet. <BR> =20
<P>Muruga Chinnananchi wrote:=20
<BLOCKQUOTE TYPE=3D"CITE">Hi Ed,=20
<P>I am looking for a way to share a common imported schema instance =
<BR>across many schemas. I have the following two schemas (foo.xsd =
and=20
goo.xsd) <BR>importing an xsd (common.xsd) which is common to both. =
Like=20
below:=20
<P>boo.xsd: <BR><schema targetNamespace=3D"boo"> =
<BR> =20
<import namespace=3D"foo" location=3D"foo.xsd" /> =
<BR> =20
<import namespace=3D"goo" location=3D"goo.xsd" /> =
<BR></schema>=20
<P>foo.xsd: <BR><schema targetNamespace=3D"foo"> =
<BR> =20
<import namespace=3D"common" location=3D"common.xsd" />=20
<BR></schema>=20
<P>goo.xsd: <BR><schema targetNamespace=3D"goo"> =
<BR> =20
<import namespace=3D"common" location=3D"common.xsd" />=20
<BR></schema>=20
<P>Now when i load "boo.xsd", which intern resolves "foo.xsd" =
<BR>and=20
"goo.xsd".=20
<P>"foo.xsd" & "goo.xsd" schemas loads common.xsd, each one =
<BR>keeps=20
its own copy of common.xsd schema. But i want to keep only <BR>once =
instance=20
of common.xsd and ask foo.xsd and goo.xsd to <BR>share this =
common.xsd=20
instance.This would save lots of memory. <BR>If you have 20 schemas =
sharing=20
one common schema.=20
<P>It will be very useful if i could share one schema instance of =
across=20
<BR>many schemas.=20
<P>Can i get a hint on how to do this in eclipse xsd?=20
<P>thanks <BR>-muruga</P></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML >
------=_NextPart_000_0012_01C390B6.73146570--
|
|
|
Goto Forum:
Current Time: Thu Apr 25 09:44:54 GMT 2024
Powered by FUDForum. Page generated in 0.03417 seconds
|