[Home] [By Thread] [By Date] [Recent Entries]


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@m...> 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
------------------------------------------------------------

http://in.rd.yahoo.com/specials/mailtg/*http://yahoo.shaadi.com/india-matrimony/: Find your life partner http://in.rd.yahoo.com/specials/mailtg2/*http://yahoo.shaadi.com/india-matrimony/.


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member