OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] What's difference between ref and type in XML schema

[ Lists Home | Date Index | Thread Index ]

If we create the data type for an element and refer to it rather than creating the code for datatype inline in the element, we can use the same data type in other elements also.
 
e.g.
<xsd:element name="A" type="AType" maxOccurs="unbounded"/>
<xsd:complexType name="AType">
..
</xsd:complexType>
Here, if you want to use the same type 'AType' in other element also , say B, you can use the following syntax for that.
 
<xsd:element name="B" type="AType"/>.
 
If you coded like this
 
<xsd:element ref="A" maxOccurs="unbounded"/>
<xsd:element name="A">
<xsd:complexType>
...
</xsd:complexType>
</xsd:element>

then you can not use the same type in other elements. i.e. it is not reusable.
So from the point of OOP, we prefer the first form.
 
 

"Baisak, Ranjan" <ranjan_baisak@mentorg.com> wrote:
I am bit confused regarding referring an element and creating a data
type for an element and referring it.
E.g.
Referring by type


..


Referring by element itself



...





regards,
-Ranjan

-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org , an
initiative of OASIS

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager:



Thanks & Regards,

Chandrashekhar P. Otari

Software Engineer
------------------------------------------------------------
Suma Soft Pvt. Ltd.
Suma Center, 2nd Floor, Opp. Himali Society,
Near Mangeshkar Hospital, Erandawane,
Pune 411004.
Phone 25425655, 25424253
------------------------------------------------------------

Yahoo! India Matrimony: Find your life partner online.





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS