[
Lists Home |
Date Index |
Thread Index
]
- To: John Stubbe <johnstubbe@msn.com>
- Subject: Re: [xml-dev] How to define separate schema definition for the same element type...
- From: "Chiusano Joseph" <chiusano_joseph@bah.com>
- Date: Mon, 07 Jul 2003 06:54:13 -0400
- Cc: xml-dev@lists.xml.org
- Organization: BAH
- References: <BAY4-F19DL55c4JskKj0001a5ca@hotmail.com>
John,
Your example and issue description are contradictory - you say that you
need to "define to separate schema definition for the same element type
but with different attribute", but your example shows the opposite:
different element types (element "input"), but same attribute ("type").
I believe you're asking how you can define an element with the same name
("input") in two different ways in the same schema. Assuming that is the
case, the simplest way (among several ways) is to declare 2 local
elements named "input" as shown below:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
version="1.0">
<xsd:element name="builder">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="input">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="description" type="xsd:string"/>
<xsd:element name="content" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="type" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="input">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="testinfo" type="xsd:string"/>
</xsd:sequence>
<xsd:attribute name="type" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Hope that helps,
Joe Chiusano
Booz | Allen | Hamilton
John Stubbe wrote:
>
> Hi
>
> I have a little schema problem.
> I need to define to separate schema definition for the same element type but
> with different attribute how is that possible?
>
> Try look at the small XML example below.
>
> <? XML version=”1.0” ?>
> <builder>
> <input type=”version1”>
> <description>descr1</description>
> <content>content1</content>
> </input>
> <input type=”test”>
> <testinfo>info</testinfo>
> </input>
> </builder>
>
> Who can I create a schema (XSD) where I have a separate definition section
> for each input type?
>
> Shall I use some kind of ID or is there an other way?
>
> Thanks in advance
>
> Kind regards
>
> John
> Denmark
>
> _________________________________________________________________
> Nem, sjov og hurtig chat med vennerne med MSN Messenger
> http://messenger.msn.dk
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
begin:vcard
n:Chiusano;Joseph
tel;work:(703) 902-6923
x-mozilla-html:FALSE
url:www.bah.com
org:Booz | Allen | Hamilton;IT Digital Strategies Team
adr:;;8283 Greensboro Drive;McLean;VA;22012;
version:2.1
email;internet:chiusano_joseph@bah.com
title:Senior Consultant
fn:Joseph M. Chiusano
end:vcard
|