Hello and welcome to this article... in this article, we will see some basic details of XSD
XSD stands for XML Schema definition.
in XSD root tag is mandatory, all other tags should come under this XSD.
as we already know,XML can contain either simple tag or compound tag.
to define simple tag, we can use
<xs: element name="itemcode" type="xs:string">
to define complex attributes, XSD provides xs:complexType as shown below.
<xs:complexType name="address">
<xs:sequence> or <xs:all>
<xs: element name="street" type="xs:string">
<xs:element name="state" type="xs:string">
</xs:sequence> or </xs:all>
</xs:complexType>
when we use xs:sequence, it specifies the all the nested elements should come in the same order
when we use xs:all, these attributes can come in any order
once we define a complex element, we can refere them in any other complex types
<xs:element name="permentaddr" type="address">
</xs:element>
Working with multipole XSDs
________________________________
If you want to refer one XSD in another XSD, we can use import or include.
if both XSDs are in same location, we can use include
if both XSDs are in different locations, we use import
<xs:schema targetNamespace="xxxx">
</xs:schema>
<xs:schema targetnamespace="XXX">
<xs:include schemalocation="po1.xsd"
</xs:schema?
No comments:
Post a Comment