W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2002

RE: Schema Location/namespace question.

From: Schramm, Oliver <schramm@sony.de>
Date: Fri, 25 Jan 2002 09:57:18 +0100
Message-ID: <B0793DB946E52942A49C1E8152A1358C04EA61@leo.wins.fb.sony.de>
To: "'Arigapudi, Shyam'" <Shyam.Arigapudi@ugs.com>
Cc: xmlschema-dev@w3.org


> -----Original Message-----
> From: Arigapudi, Shyam [mailto:Shyam.Arigapudi@ugs.com]
> Sent: Mittwoch, 23. Januar 2002 15:47
> To: xmlschema-dev@w3.org
> Subject: Schema Location/namespace question.
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <x:CimfObjects xmlns:x="urn:www.eai.com:CIMF"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xsi:schemaLocation="urn:www.eai.com:CIMF box.xsd">
> 
> <x:Object xsi:type="x:BoxType>
> 	...
> </x:Object>
> </x:CimfObjects>
> 
> It all works fine. (Replace box with pallet and that works fine).
> 
> 
> Now,  I want to have both the types to be in one xml file. Is 
> this possible?
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <x:CimfObjects xmlns:x="urn:www.eai.com:CIMF"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xsi:schemaLocation="urn:www.eai.com:CIMF box.xsd 
> 				urn:www.eai.com:CIMF pallet.xsd">
> 
> <x:Object xsi:type="x:BoxType>
> 	...
> </x:Object>
> <x:Object xsi:type="x:PalletType>
> 	...
> </x:Object>
> </x:CimfObjects>
> 
> 
> Not sure about the syntax for schemaLocation (since both xsd 
> files use the
> same 
>  urn). Is the solution to change these name spaces or is 
> there a better way?
> 

Hey, 

I) the syntax of your schemaLocation is correct,
(Have a look XML Schema Primer - Part 0, section 5.6,
 'a schemaLocation attribute contains pairs of values: The
 first member of each pair is the namespace for wich the second
 member is the hint describing where to find to an appropriate
 schema document'

II) Then you can use the schema in your instance document.

But have a look at 'xs:include' it might help you.


I tested a simplified document with xerces and it works fine.

<?xml version="1.0"?>

<foo:foo1 xmlns:foo="http://www.foo.de/foo"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://www.foo.de/foo usageOfTwoSchema_1.xsd
http://www.foo.de/foo usageOfTwoSchema_1.xsd">
  <foo:text>hallo world</foo:text>
</foo:foo1>


regards

Oliver
Received on Friday, 25 January 2002 03:59:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:26 GMT