Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Multiple Schemas

Reply
Thread Tools

Multiple Schemas

 
 
steve_marjoribanks
Guest
Posts: n/a
 
      01-24-2006
Does anyone know of any good resources about using multiple schemas? I
am having trouble getting me head round a problem!

I am writing schema A which imports schema B from another namespace
(ns) and in S1 I define an element as being <element name="top"
type="ns:geometry" />. If the 'geometry' complex type is a 'top level'
complex type which contains lots of other complex types which can
describe any object, do I need to define all of these (or at least the
ones I need) again in my schema or does the fact that I've imported the
top level type mean that any instances of the lower types in my XML
will be valid?

Sorry, it's a difficult problem to describe, I'm working with GML which
is so huge it's hard to get my head round it!

Thanks

Steve

 
Reply With Quote
 
 
 
 
the_edge123.nospam@club-internet.fr
Guest
Posts: n/a
 
      01-25-2006

steve_marjoribanks a écrit :

> Does anyone know of any good resources about using multiple schemas? I
> am having trouble getting me head round a problem!
>
> I am writing schema A which imports schema B from another namespace
> (ns) and in S1 I define an element as being <element name="top"
> type="ns:geometry" />. If the 'geometry' complex type is a 'top level'
> complex type which contains lots of other complex types which can
> describe any object, do I need to define all of these (or at least the
> ones I need) again in my schema or does the fact that I've imported the
> top level type mean that any instances of the lower types in my XML
> will be valid?
>

No, you don't. "import" is similar to "include" for the C language.
You certainly have a syntax problem in your schema definition.
Have a look at this: http://www.w3schools.com/schema/schema_intro.asp

 
Reply With Quote
 
 
 
 
steve_marjoribanks
Guest
Posts: n/a
 
      01-25-2006
So if I wish import a complex type into my schema which is defined in
another schema I don't have to define the complex type I want again in
my schema because the 'import' statement will mean that all of the
global elements/complex types from that schema will automatically be
valid in mine? I understand that I don't have to define/declare the
types again, but I do have to 'ref' or 'name' them, is this correct? So
if I wanted to use 3 complex types from another schema with namespace
"http://www.???.com" called, "one", "two" and "three", in my schema I
would have:

<schema ...... xmlns:no="http://www.???.org" ....... >
..
<import namespace="http://www.???.com"
schemaLocation="http://www.???.com/schema.xsd" />
..
..
..
<element name="1" type="none" .... />
<element name="2" type="no:two"..... />
<element name="3" type="no:three" ..... />
..
..
</schema>


Say, for example, complex types one, two and three had 'sub' types and
'super' types (not the correct terminology but I expect you know what I
mean) defined in the external schema, would an instance document of my
schema be valid if it contained instances of these 'sub' and 'super'
types or would I have to explicitly declare them in my schema?

Thanks for your help
Steve

 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      01-25-2006


steve_marjoribanks wrote:


> I understand that I don't have to define/declare the
> types again, but I do have to 'ref' or 'name' them, is this correct?


Yes, right, you import the schema for another different namespace and
then use the elements or types defined there using ref or type with a
qualified name given.

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
the_edge123.nospam@club-internet.fr
Guest
Posts: n/a
 
      01-26-2006

steve_marjoribanks a écrit :

> So if I wish import a complex type into my schema which is defined in
> another schema I don't have to define the complex type I want again in
> my schema because the 'import' statement will mean that all of the
> global elements/complex types from that schema will automatically be
> valid in mine? I understand that I don't have to define/declare the
> types again, but I do have to 'ref' or 'name' them, is this correct? So
> if I wanted to use 3 complex types from another schema with namespace
> "http://www.???.com" called, "one", "two" and "three", in my schema I
> would have:
>
> <schema ...... xmlns:no="http://www.???.org" ....... >
> .
> <import namespace="http://www.???.com"
> schemaLocation="http://www.???.com/schema.xsd" />
> .
> .
> .
> <element name="1" type="none" .... />
> <element name="2" type="no:two"..... />
> <element name="3" type="no:three" ..... />
> .
> .
> </schema>
>
>
> Say, for example, complex types one, two and three had 'sub' types and
> 'super' types (not the correct terminology but I expect you know what I
> mean) defined in the external schema, would an instance document of my
> schema be valid if it contained instances of these 'sub' and 'super'
> types or would I have to explicitly declare them in my schema?
>
> Thanks for your help
> Steve

Don't you have an application like "xmllint" to quickly validate your
schemas ?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing multiple schemas with same namespace? Steve George XML 1 04-12-2005 11:09 AM
dynamic color schemas with ASP.NET Oleg Ogurok ASP .Net 1 06-08-2004 01:06 PM
XMLSchema. Assign multiple schemas Mattias XML 1 12-04-2003 01:15 PM
Validating Multiple Schemas Sean Keplinger XML 0 10-15-2003 01:44 PM
XML conforming to multiple Schemas simultaneously Alex Rootham XML 2 08-28-2003 12:01 AM



Advertisments