Difference between xs:simpleType & xs:complexType

View: New views
6 Messages — Rating Filter:   Alert me  

Difference between xs:simpleType & xs:complexType

by selvam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Can anyone help me in explaining the difference between the xs:simpleType & xs:complexType?

I am bit confused with these two.

Please explain these two with the proper example.

When should we go for simpleType and when should we  go for xs:complexType?

Also explain about simplexContent and complexContent?

Thanks
Selvam

RE: Difference between xs:simpleType & xs:complexType

by Michael Kay :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Complex types allow element children, simple types don't.

So <a><b/></a> has a complex type, while <a>ddd</a> has a simple type.

"Complex types with simple content" allow attributes but not child elements,
for example

<a b="1">ddd</a>

A complex type with "Mixed content" allows character data as well as child
elements, for example

<p>Some <i>italic</i> text</p>

The only time there's any confusion is with empty elements <a/>, which can
be modelled as either complex or simple depending on your whim.

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: xmlschema-dev-request@...
> [mailto:xmlschema-dev-request@...] On Behalf Of selvam
> Sent: 16 April 2007 11:44
> To: xmlschema-dev@...
> Subject: Difference between xs:simpleType & xs:complexType
>
>
> Hi,
> Can anyone help me in explaining the difference between the
> xs:simpleType & xs:complexType?
>
> I am bit confused with these two.
>
> Please explain these two with the proper example.
>
> When should we go for simpleType and when should we  go for
> xs:complexType?
>
> Also explain about simplexContent and complexContent?
>
> Thanks
> Selvam
> --
> View this message in context:
> http://www.nabble.com/Difference-between-xs%3AsimpleType---xs%
> 3AcomplexType-tf3583684.html#a10013797
> Sent from the w3.org - xmlschema-dev mailing list archive at
> Nabble.com.
>
>
>




Re: Difference between xs:simpleType & xs:complexType

by Pete Cordell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Selvam,

You may find the following introduction to schema useful:

http://www.tech-know-ware.com/lmx/xsd-overview.html

HTH,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx/
http://www.codalogic.com/lmx/
=============================================

----- Original Message -----
From: "selvam" <jps_cse@...>
To: <xmlschema-dev@...>
Sent: Monday, April 16, 2007 11:44 AM
Subject: Difference between xs:simpleType & xs:complexType


>
> Hi,
> Can anyone help me in explaining the difference between the xs:simpleType
> &
> xs:complexType?
>
> I am bit confused with these two.
>
> Please explain these two with the proper example.
>
> When should we go for simpleType and when should we  go for
> xs:complexType?
>
> Also explain about simplexContent and complexContent?
>
> Thanks
> Selvam
> --
> View this message in context:
> http://www.nabble.com/Difference-between-xs%3AsimpleType---xs%3AcomplexType-tf3583684.html#a10013797
> Sent from the w3.org - xmlschema-dev mailing list archive at Nabble.com.
>
>
>
>




RE: Difference between xs:simpleType & xs:complexType

by Chuck Herrick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I believe if you want an element to have an attribute, that element
must be a complexType.

>
> Complex types allow element children, simple types don't.
>
> So <a><b/></a> has a complex type, while <a>ddd</a> has a simple
> type.
>
> "Complex types with simple content" allow attributes but not child
> elements,
> for example
>
> <a b="1">ddd</a>
>
> A complex type with "Mixed content" allows character data as well
> as child
> elements, for example
>
> <p>Some <i>italic</i> text</p>
>
> The only time there's any confusion is with empty elements <a/>,
> which can
> be modelled as either complex or simple depending on your whim.
>
> Michael Kay
> http://www.saxonica.com/
>
>
> > -----Original Message-----
> > From: xmlschema-dev-request@...
> > [mailto:xmlschema-dev-request@...] On Behalf Of selvam
> > Sent: 16 April 2007 11:44
> > To: xmlschema-dev@...
> > Subject: Difference between xs:simpleType & xs:complexType
> >
> >
> > Hi,
> > Can anyone help me in explaining the difference between the
> > xs:simpleType & xs:complexType?
> >
> > I am bit confused with these two.
> >
> > Please explain these two with the proper example.
> >
> > When should we go for simpleType and when should we  go for
> > xs:complexType?
> >
> > Also explain about simplexContent and complexContent?
> >
> > Thanks
> > Selvam
> > --
> > View this message in context:
> > http://www.nabble.com/Difference-between-xs%3AsimpleType---xs%
> > 3AcomplexType-tf3583684.html#a10013797
> > Sent from the w3.org - xmlschema-dev mailing list archive at
> > Nabble.com.
> >
> >
> >
>
>
>
>


--
Chuck Herrick
mailto:cherrick@...
512 289 0926 (cell)
830 839 4437 (home)


RE: Difference between xs:simpleType & xs:complexType

by selvam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

thanks..

you mean "Mixed Content" as "complexContent" right?

Can you also explain me the way how the xs:any and xs:anyAttribute will work?
what is the diff b/w namespace="##any", "##other", "##local", "##targetNamespace"?


Re: Difference between xs:simpleType & xs:complexType

by Pete Cordell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


The schema primer answers this at:

http://www.w3.org/TR/xmlschema-0/#any

HTH,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx/
http://www.codalogic.com/lmx/
=============================================

----- Original Message -----
From: "selvam" <jps_cse@...>
To: <xmlschema-dev@...>
Sent: Monday, April 16, 2007 3:22 PM
Subject: RE: Difference between xs:simpleType & xs:complexType


>
>
> thanks..
>
> you mean "Mixed Content" as "complexContent" right?
>
> Can you also explain me the way how the xs:any and xs:anyAttribute will
> work?
> what is the diff b/w namespace="##any", "##other", "##local",
> "##targetNamespace"?
>
>
> Michael Kay wrote:
>>
>>
>> Complex types allow element children, simple types don't.
>>
>> So    has a complex type, while  ddd  has a simple type.
>>
>> "Complex types with simple content" allow attributes but not child
>> elements,
>> for example
>>
>>  ddd
>>
>> A complex type with "Mixed content" allows character data as well as
>> child
>> elements, for example
>>
>> <p>Some italic text</p>
>>
>> The only time there's any confusion is with empty elements  , which can
>> be modelled as either complex or simple depending on your whim.
>>
>> Michael Kay
>> http://www.saxonica.com/
>>
>>
>>> -----Original Message-----
>>> From: xmlschema-dev-request@...
>>> [mailto:xmlschema-dev-request@...] On Behalf Of selvam
>>> Sent: 16 April 2007 11:44
>>> To: xmlschema-dev@...
>>> Subject: Difference between xs:simpleType & xs:complexType
>>>
>>>
>>> Hi,
>>> Can anyone help me in explaining the difference between the
>>> xs:simpleType & xs:complexType?
>>>
>>> I am bit confused with these two.
>>>
>>> Please explain these two with the proper example.
>>>
>>> When should we go for simpleType and when should we  go for
>>> xs:complexType?
>>>
>>> Also explain about simplexContent and complexContent?
>>>
>>> Thanks
>>> Selvam
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Difference-between-xs%3AsimpleType---xs%
>>> 3AcomplexType-tf3583684.html#a10013797
>>> Sent from the w3.org - xmlschema-dev mailing list archive at
>>> Nabble.com.
>>>
>>>
>>>
>>
>>
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Difference-between-xs%3AsimpleType---xs%3AcomplexType-tf3583684.html#a10016736
> Sent from the w3.org - xmlschema-dev mailing list archive at Nabble.com.
>
>
>