Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Loading one Resource using different URLs
Loading one Resource using different URLs [message #31824] Thu, 16 October 2003 06:20 Go to next message
Eclipse UserFriend
Originally posted by: cipher8000.yahoo.com

Hi Ed,

I started experiencing different problem today..now i am using common
ResourceSet
to load boo.xsd, but this time i have two imports for foo.xsd, please look
at the boo.xsd, one import uses "http://localhost:8080/test/foo.xsd" and the
next import
uses "http://localhost:8080/test/.//foo.xsd", the both URLs are same (the
second one is little bit twisted but it is pointing to the same resource)
pointing to foo.xsd.
When i ran the "xsd-test.bat" against this boo.xsd, it loads the foo.xsd
twice. I think
the loading of xsd resources goes based on literal schema location name.

c:\>xsd-test.bat -validate http://localhost:8080/test/boo.xsd
--> http://localhost:8080/test/boo.xsd
--> http://localhost:8080/test/foo.xsd
--> http://localhost:8080/test/common.xsd
--> http://localhost:8080/test/.//foo.xsd [*loaded second time*]
--> http://localhost:8080/test/goo.xsd


Here are the schemas(boo.xsd, foo.xsd, goo.xsd & common.xsd):

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="http://localhost:8080/test/foo.xsd" />

<!-- the schemaLocation is little bit twisted but pointing to the same
foo.xsd -->
<import namespace="foo"
schemaLocation="http://localhost:8080/test/.//foo.xsd" />
<import namespace="goo"
schemaLocation="http://localhost:8080/test/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>
Re: Loading one Resource using different URLs [message #31859 is a reply to message #31824] Thu, 16 October 2003 11:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Muruga,

The ResourceSet calls URIConverter.normalize on each URI before comparing them.
If you want to add additional logic to remove ".", "..", or empty segments, you
can create a derived URIConverterImpl, override normalize to do this extra
processing, and set that converter to be the converter for your resource set.
I'm considering whether I should do this kind of processing in
XSDUtil.resolveSchemaLocation so that the schemaLocation URI is "untwisted"
before it's passed on to the resource set. But I also kind of wonder if this is
this a "real" problem or a contrived one? It looks kind of contrived. (I'll
also ask Dave about a method on URI that would collapse the segments.)


Muruga Chinnananchi wrote:

> Hi Ed,
>
> I started experiencing different problem today..now i am using common
> ResourceSet
> to load boo.xsd, but this time i have two imports for foo.xsd, please look
> at the boo.xsd, one import uses "http://localhost:8080/test/foo.xsd" and the
> next import
> uses "http://localhost:8080/test/.//foo.xsd", the both URLs are same (the
> second one is little bit twisted but it is pointing to the same resource)
> pointing to foo.xsd.
> When i ran the "xsd-test.bat" against this boo.xsd, it loads the foo.xsd
> twice. I think
> the loading of xsd resources goes based on literal schema location name.
>
> c:\>xsd-test.bat -validate http://localhost:8080/test/boo.xsd
> --> http://localhost:8080/test/boo.xsd
> --> http://localhost:8080/test/foo.xsd
> --> http://localhost:8080/test/common.xsd
> --> http://localhost:8080/test/.//foo.xsd [*loaded second time*]
> --> http://localhost:8080/test/goo.xsd
>
> Here are the schemas(boo.xsd, foo.xsd, goo.xsd & common.xsd):
>
> 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="http://localhost:8080/test/foo.xsd" />
>
> <!-- the schemaLocation is little bit twisted but pointing to the same
> foo.xsd -->
> <import namespace="foo"
> schemaLocation="http://localhost:8080/test/.//foo.xsd" />
> <import namespace="goo"
> schemaLocation="http://localhost:8080/test/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>
Re: Loading one Resource using different URLs [message #31894 is a reply to message #31859] Thu, 16 October 2003 22:52 Go to previous message
Eclipse UserFriend
Originally posted by: cipher8000.yahoo.com

Ed,

Thanks for the suggestion. I would go ahead and extend URIConverterImpl to
accommodate my requirements.

Thanks again for your help.
-muruga

"Ed Merks" <merks@ca.ibm.com> wrote in message
news:3F8E7CF3.5F02D97A@ca.ibm.com...
Muruga,

The ResourceSet calls URIConverter.normalize on each URI before comparing
them.
If you want to add additional logic to remove ".", "..", or empty segments,
you
can create a derived URIConverterImpl, override normalize to do this extra
processing, and set that converter to be the converter for your resource
set.
I'm considering whether I should do this kind of processing in
XSDUtil.resolveSchemaLocation so that the schemaLocation URI is "untwisted"
before it's passed on to the resource set. But I also kind of wonder if
this is
this a "real" problem or a contrived one? It looks kind of contrived.
(I'll
also ask Dave about a method on URI that would collapse the segments.)


Muruga Chinnananchi wrote:

> Hi Ed,
>
> I started experiencing different problem today..now i am using common
> ResourceSet
> to load boo.xsd, but this time i have two imports for foo.xsd, please look
> at the boo.xsd, one import uses "http://localhost:8080/test/foo.xsd" and
the
> next import
> uses "http://localhost:8080/test/.//foo.xsd", the both URLs are same (the
> second one is little bit twisted but it is pointing to the same resource)
> pointing to foo.xsd.
> When i ran the "xsd-test.bat" against this boo.xsd, it loads the foo.xsd
> twice. I think
> the loading of xsd resources goes based on literal schema location name.
>
> c:\>xsd-test.bat -validate http://localhost:8080/test/boo.xsd
> --> http://localhost:8080/test/boo.xsd
> --> http://localhost:8080/test/foo.xsd
> --> http://localhost:8080/test/common.xsd
> --> http://localhost:8080/test/.//foo.xsd [*loaded second time*]
> --> http://localhost:8080/test/goo.xsd
>
> Here are the schemas(boo.xsd, foo.xsd, goo.xsd & common.xsd):
>
> 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="http://localhost:8080/test/foo.xsd" />
>
> <!-- the schemaLocation is little bit twisted but pointing to the same
> foo.xsd -->
> <import namespace="foo"
> schemaLocation="http://localhost:8080/test/.//foo.xsd" />
> <import namespace="goo"
> schemaLocation="http://localhost:8080/test/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>
Re: Loading one Resource using different URLs [message #579875 is a reply to message #31824] Thu, 16 October 2003 11:11 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Muruga,

The ResourceSet calls URIConverter.normalize on each URI before comparing them.
If you want to add additional logic to remove ".", "..", or empty segments, you
can create a derived URIConverterImpl, override normalize to do this extra
processing, and set that converter to be the converter for your resource set.
I'm considering whether I should do this kind of processing in
XSDUtil.resolveSchemaLocation so that the schemaLocation URI is "untwisted"
before it's passed on to the resource set. But I also kind of wonder if this is
this a "real" problem or a contrived one? It looks kind of contrived. (I'll
also ask Dave about a method on URI that would collapse the segments.)


Muruga Chinnananchi wrote:

> Hi Ed,
>
> I started experiencing different problem today..now i am using common
> ResourceSet
> to load boo.xsd, but this time i have two imports for foo.xsd, please look
> at the boo.xsd, one import uses "http://localhost:8080/test/foo.xsd" and the
> next import
> uses "http://localhost:8080/test/.//foo.xsd", the both URLs are same (the
> second one is little bit twisted but it is pointing to the same resource)
> pointing to foo.xsd.
> When i ran the "xsd-test.bat" against this boo.xsd, it loads the foo.xsd
> twice. I think
> the loading of xsd resources goes based on literal schema location name.
>
> c:\>xsd-test.bat -validate http://localhost:8080/test/boo.xsd
> --> http://localhost:8080/test/boo.xsd
> --> http://localhost:8080/test/foo.xsd
> --> http://localhost:8080/test/common.xsd
> --> http://localhost:8080/test/.//foo.xsd [*loaded second time*]
> --> http://localhost:8080/test/goo.xsd
>
> Here are the schemas(boo.xsd, foo.xsd, goo.xsd & common.xsd):
>
> 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="http://localhost:8080/test/foo.xsd" />
>
> <!-- the schemaLocation is little bit twisted but pointing to the same
> foo.xsd -->
> <import namespace="foo"
> schemaLocation="http://localhost:8080/test/.//foo.xsd" />
> <import namespace="goo"
> schemaLocation="http://localhost:8080/test/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>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Loading one Resource using different URLs [message #579899 is a reply to message #31859] Thu, 16 October 2003 22:52 Go to previous message
Eclipse UserFriend
Originally posted by: cipher8000.yahoo.com

Ed,

Thanks for the suggestion. I would go ahead and extend URIConverterImpl to
accommodate my requirements.

Thanks again for your help.
-muruga

"Ed Merks" <merks@ca.ibm.com> wrote in message
news:3F8E7CF3.5F02D97A@ca.ibm.com...
Muruga,

The ResourceSet calls URIConverter.normalize on each URI before comparing
them.
If you want to add additional logic to remove ".", "..", or empty segments,
you
can create a derived URIConverterImpl, override normalize to do this extra
processing, and set that converter to be the converter for your resource
set.
I'm considering whether I should do this kind of processing in
XSDUtil.resolveSchemaLocation so that the schemaLocation URI is "untwisted"
before it's passed on to the resource set. But I also kind of wonder if
this is
this a "real" problem or a contrived one? It looks kind of contrived.
(I'll
also ask Dave about a method on URI that would collapse the segments.)


Muruga Chinnananchi wrote:

> Hi Ed,
>
> I started experiencing different problem today..now i am using common
> ResourceSet
> to load boo.xsd, but this time i have two imports for foo.xsd, please look
> at the boo.xsd, one import uses "http://localhost:8080/test/foo.xsd" and
the
> next import
> uses "http://localhost:8080/test/.//foo.xsd", the both URLs are same (the
> second one is little bit twisted but it is pointing to the same resource)
> pointing to foo.xsd.
> When i ran the "xsd-test.bat" against this boo.xsd, it loads the foo.xsd
> twice. I think
> the loading of xsd resources goes based on literal schema location name.
>
> c:\>xsd-test.bat -validate http://localhost:8080/test/boo.xsd
> --> http://localhost:8080/test/boo.xsd
> --> http://localhost:8080/test/foo.xsd
> --> http://localhost:8080/test/common.xsd
> --> http://localhost:8080/test/.//foo.xsd [*loaded second time*]
> --> http://localhost:8080/test/goo.xsd
>
> Here are the schemas(boo.xsd, foo.xsd, goo.xsd & common.xsd):
>
> 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="http://localhost:8080/test/foo.xsd" />
>
> <!-- the schemaLocation is little bit twisted but pointing to the same
> foo.xsd -->
> <import namespace="foo"
> schemaLocation="http://localhost:8080/test/.//foo.xsd" />
> <import namespace="goo"
> schemaLocation="http://localhost:8080/test/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>
Previous Topic:Loading one Resource using different URLs
Next Topic:Parsing a WSDL with embedded xsd
Goto Forum:
  


Current Time: Fri Apr 19 15:21:34 GMT 2024

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

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

Back to the top