Re: SchemaLocation Question

"Arigapudi, Shyam" wrote:

> Hi,
>
> I have 2 schema files, both using the same namespace.
> Let's say box.xsd,pallet.xsd. Both of them derive from common.xsd.
>
> Common.xsd has an abstract type, which is overridden in each of the other
> xsd's (box - boxType, pallet - palletType).

<snip/>

> 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?

To change the namespace is one solution but a better one is probably to create a
"main" schema that use the same targetNamespace as box and pallet
(urn:www.eai.com:CIMF) and then includes these two schemas. This will bring in
all the types and elements from box and pallet to this "main" schema and in your
instance document it is enough if you include this schema:

<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 main.xsd">

Cheers,
/Eddie

Received on Wednesday, 23 January 2002 17:50:32 UTC