Return-Path: Mailing-List: contact general-help@xml.apache.org; run by ezmlm Delivered-To: mailing list general@xml.apache.org Received: (qmail 53276 invoked from network); 9 Nov 2000 00:41:27 -0000 Received: from unknown (HELO cheeta.equitytg.com) (216.242.111.2) by locus.apache.org with SMTP; 9 Nov 2000 00:41:27 -0000 Received: (qmail 4066 invoked by uid 0); 9 Nov 2000 01:46:18 -0000 Received: from unknown (HELO dfoster) (192.168.0.16) by 192.168.0.3 with SMTP; 9 Nov 2000 01:46:18 -0000 Message-ID: <002101c049e6$1eefc670$1000a8c0@equitytg.com> From: "Dane Foster" To: , "Eric Ye" References: <001001c049af$44b28af0$1000a8c0@equitytg.com> <03a901c049db$b8d55cb0$4a1685c6@Trojan> Subject: Re: Schema Question Date: Wed, 8 Nov 2000 19:43:24 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_001E_01C049BC.28453F40" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N ------=_NextPart_000_001E_01C049BC.28453F40 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I don't see it. The restriction that I'm trying to apply is based upon = the value of the parent type's attribute, not it's element type. I sent = out another email with additional samples of what I'm trying to = accomplish but I'll do it here again. The following scenario is an invalid constructs: This is an incorrect construct because the value of = the 'TYPE' attribute of 'myElement' is "type1", therefore the children = of 'myElement' should be 'type-1-element's, not = 'type-2-element's ----- Original Message -----=20 From: Eric Ye=20 To: general@xml.apache.org=20 Cc: xerces-j-dev@xml.apache.org ; dfoster@equitytg.com=20 Sent: Wednesday, November 08, 2000 6:28 PM Subject: Re: Schema Question Good question to demonstrate powerfulness of schema: With 04/07 schema spec, here is the syntax: in your schema : =20 in your instance XML document use xsi:type attribute:=20 by default myelement will have "type1"'s content model , if you do = this: =20 =20 See, it is much more cumbersome than the 04/07 version, we should let = the W3C working Group know that schema syntax is getting more and more = diverted from simplicity and flexibility. _____ Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org ----- Original Message -----=20 From: Dane Foster=20 To: general@xml.apache.org=20 Sent: Wednesday, November 08, 2000 10:11 AM Subject: Schema Question I know that most of the post to this list deal with Xerces and Xalan = so this may not be the place to ask this question. If it's not please = let me know. Anyway, my question is this, in the current Schema = specification (..2000/10/XMLSchema), how do I specify that if an element = contains a particular attribute it's children must be a specific = element? Example: Notes*: The myElement node's 'type' attribute can be one of two = values "type1" or "type2". If the value is type1 then the root node(s) = of the myElement sub-tree must be 'type-1-element'. If the value is = type2 then the root node(s) of the myElement sub-tree must be = 'type-2-element'. Element data goes here Element data goes here Dane Foster ------=_NextPart_000_001E_01C049BC.28453F40 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I don't see it.  The restriction that I'm = trying to apply=20 is based upon the value of the parent type's attribute, not it's = element=20 type.  I sent out another email with additional samples of what I'm = trying=20 to accomplish but I'll do it here again.
 
The following scenario is an invalid=20 constructs:
 
<!--Scenario Three -->
<myElement TYPE=3D"type1">
    <type-2-element>This is an = incorrect=20 construct because the value of the 'TYPE' attribute of 'myElement' is = "type1",=20 therefore the children of 'myElement' should = be=20 'type-1-element's, not = 'type-2-element's</type-2-element>
</myElement>
----- Original Message -----
From:=20 Eric=20 Ye
Sent: Wednesday, November 08, = 2000 6:28=20 PM
Subject: Re: Schema = Question

Good question to demonstrate = powerfulness of=20 schema:
 
With 04/07 schema spec, here is the=20 syntax:
 
in your schema :
<schema ....xmlns:NS=3D"your = targetNamespace"=20 targetNamespace =3D"your targetNamesapce">
    <complexType=20 name=3D"type1">
        = <element=20 name=3D"type-1-element"/>
   =20 </complexType>
 
    <complexType = name=3D"type2"=20 base=3D"NS:type1" derivedBy=3D"restriction">
        = <element=20 name=3D"type-2-element"/>   
   =20 </complexType>
 
    <element name=3D"myelement"=20 type=3D"NS:type1"/>
</schema>
 
in your instance XML document use xsi:type attribute:
 
by default myelement will have "type1"'s content model ,  if = you do=20 this:
<NS:myelement xmlns:xsi=3D"...." = xsi:type=3D"type2"......
 
then myelement will have "type2"'s content model.
 
With the CR(10/24) version, the syntax is a little bit different = for the=20 schema part, here it is:
 
    <complexType name=3D"type1">
        <sequence>
           = <element=20 name=3D"type-1-element"/>
        = </sequence>
    </complexType>
 
    <complexType=20 name=3D"type2" >
       <complexContent = >
          = <restriction=20 base=3D"type1>
=
           =20 <sequence>
   =20           <element=20 name=3D"type-2-element"/>   
=
           &n= bsp;</sequence>
         =20 </restriction>
=
       </complexContent>&nb= sp;=20
   =20 </complexType>
 
See, it is much more cumbersome than the 04/07 version, we should = let the=20 W3C working Group know that schema syntax is getting more and = more=20 diverted from simplicity and = flexibility.
_____
 

Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org
----- Original Message -----
From:=20 Dane=20 Foster
Sent: Wednesday, November 08, = 2000=20 10:11 AM
Subject: Schema = Question

I know that most of the = post to this=20 list deal with Xerces and Xalan so this may not be the place to ask = this=20 question.  If it's not please let me know.  Anyway, my = question is=20 this, in the current = Schema=20 specification (..2000/10/XMLSchema), how do I specify that if an = element=20 contains a particular attribute it's children must be a specific=20 element?
 
Example:
 
Notes*: The myElement = node's 'type'=20 attribute can be one of two values "type1" or "type2".  If the = value is=20 type1 then the root node(s) of the myElement sub-tree must be=20 'type-1-element'.  If the value is type2 then the root node(s) = of the=20 myElement sub-tree must be 'type-2-element'.
 
<!--Scenario=20 one-->
<myElement=20 type=3D"type1">
  = <type-1-element>Element=20 data goes here</type-1-element>
</myElement>
 
 
<!--Scenario=20 two-->
<myElement=20 type=3D"type2">
  = <type-2-element>Element=20 data goes here</type-2-element>
</myElement>
 
 
Dane=20 Foster
------=_NextPart_000_001E_01C049BC.28453F40--