You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by vipin <vi...@rediffmail.com> on 2007/06/07 20:57:41 UTC
Schema definition
Hi,
I have a generic question regarding writing xsd for XML.
Is it possible to write a schema(xsd) if children of an element depends on
value of a particular attribute ?
for eg, if type="service" then children of will be
(protocal,srcport,destport,icmpType,icmpCode) AND
if type="device" then children of will be (ip,hostname,domain)
<Service>
<protocol/>
<srcPort/>
<destPort/>
<icmpType/>
<icmpCode/>
<Service>
<ReportingDevices>
<ip/>
<hostName/>
<domain/>
</ReportingDevices>
Thanks,
Vipin V S.
--
View this message in context: http://www.nabble.com/Schema-definition-tf3885720.html#a11014163
Sent from the Apache XML - General mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org
Re: Schema definition
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Vipin,
The only attribute in XML Schema 1.0 that can be used to do what you want
is xsi:type.
FYI: The W3C mailing list [1] is a more appropriate list for generic
queries such as this.
Thanks.
[1] http://lists.w3.org/Archives/Public/xmlschema-dev/
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
vipin <vi...@rediffmail.com> wrote on 06/07/2007 02:57:41 PM:
> Hi,
>
> I have a generic question regarding writing xsd for XML.
>
> Is it possible to write a schema(xsd) if children of an element depends
on
> value of a particular attribute ?
>
> for eg, if type="service" then children of will be
> (protocal,srcport,destport,icmpType,icmpCode) AND
> if type="device" then children of will be
(ip,hostname,domain)
>
> <Service>
>
> <protocol/>
> <srcPort/>
> <destPort/>
> <icmpType/>
> <icmpCode/>
>
> <Service>
>
> <ReportingDevices>
>
> <ip/>
> <hostName/>
> <domain/>
>
> </ReportingDevices>
>
> Thanks,
> Vipin V S.
> --
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org