Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
XML SCHEMA
BY
SANA MATEEN
XMLSCHEMA
• It is also called as XSD(Xml Schema Definition).
• It is used to describe and validate the structure and conte...
ELEMENTS
• Elements are building blocks of xml document. An element can be defined with
in an XSD.
• <xs:element name=“x” ...
Complex Type
• They are container for other element definition.
• They allow us to specify which child elements an element...
Global Type
• With global type, you can define a single type in your document, which can
be used by all other references.
...
Attributes
• Attributes in XSD provide extra information within an element. Attributes
have name and type property as show...
7
xs:all
• xs:all allows elements to appear in any order
• <xs:element name="person">
<xs:complexType>
<xs:all>
<xs:elemen...
8
Referencing
• Once you have defined an element or attribute (with
name="..."), you can refer to it with ref="..."
• Exam...
9
Text element with attributes
• If a text element has attributes, it is no longer a simple type
– <xs:element name="popul...
Próxima SlideShare
Cargando en…5
×

Xml schema

XML Schema,Elements,Complex Type,Global Type,xs:all,referencing

  • Sé el primero en comentar

Xml schema

  1. 1. XML SCHEMA BY SANA MATEEN
  2. 2. XMLSCHEMA • It is also called as XSD(Xml Schema Definition). • It is used to describe and validate the structure and content of xml data • Xml schema defines the elements, attributes, and data types. • <xs:schema xmlns:xs=“http://www.w3.org/2001/XMLSchema”>
  3. 3. ELEMENTS • Elements are building blocks of xml document. An element can be defined with in an XSD. • <xs:element name=“x” type=“y”/> • Three types of elements: 1.Simple Type 2.Complex Type 3.Global Type 1. Simple Type These are used only in the context of text. They are  xs:integer  xs:boolean  xs:string  xs:date  <xs:element name=“phone_number” type=“xs:int”/> – name is the name of the element • Other attributes a simple element may have: – default="default value" if no other value is specified – fixed="value" no other value may be specified
  4. 4. Complex Type • They are container for other element definition. • They allow us to specify which child elements an element can contain and to provide some structure within your document.
  5. 5. Global Type • With global type, you can define a single type in your document, which can be used by all other references. • For example, suppose you want to generalize the person and company for different addresses of the company. In such case, you can define a general type as below:
  6. 6. Attributes • Attributes in XSD provide extra information within an element. Attributes have name and type property as shown below: • <xs:attribute nam e="x" type="y"/>
  7. 7. 7 xs:all • xs:all allows elements to appear in any order • <xs:element name="person"> <xs:complexType> <xs:all> <xs:element name="firstName" type="xs:string" /> <xs:element name="lastName" type="xs:string" /> </xs:all> </xs:complexType> </xs:element> • Despite the name, the members of an xs:all group can occur once or not at all • You can use minOccurs="0" to specify that an element is optional (default value is 1) – In this context, maxOccurs is always 1
  8. 8. 8 Referencing • Once you have defined an element or attribute (with name="..."), you can refer to it with ref="..." • Example: – <xs:element name="person"> <xs:complexType> <xs:all> <xs:element name="firstName" type="xs:string" /> <xs:element name="lastName" type="xs:string" /> </xs:all> </xs:complexType> </xs:element> – <xs:element name="student" ref="person"> – Or just: <xs:element ref="person">
  9. 9. 9 Text element with attributes • If a text element has attributes, it is no longer a simple type – <xs:element name="population"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:integer"> <xs:attribute name="year” type="xs:integer"> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element>

×