XML Schemas

1,210 views

Published on

XML Schemas Lanaguage

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,210
On SlideShare
0
From Embeds
0
Number of Embeds
65
Actions
Shares
0
Downloads
82
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

XML Schemas

  1. 1. <?xml version=„1.0‟ encoding=“UTF-8”?><!-- Human Resource data--><HumanResource> <!-- Information for a person--> <Person id=„1‟ slary=“500”> <FirstName>John</FirstName> <MidName></MidName> <LastName>Doe</LastName> <Position>Manager</Position> </Person></HumanResource> Document Type
  2. 2. <?xml version=”1.0”?><?xml version=”1.0”?> <schema xmlns=”http://www.w3.org/2001/XMLSchema”<name> xmlns:target=”http://www.exam.com/name” targetNamespace=”http://www.exam.com/name” <first> elementFormDefault=”qualified”> John </first> <element name=”name”> <complexType> <middle> <sequence> Johansen <element name=”first” type=”string”/> </middle> <element name=”middle” type=”string”/> <element name=”last” type=”string”/> <last> </sequence> Doe </complexType> </last> </element></name> </schema>
  3. 3. <rootElement xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“list of namespace-location pairs” ></rootElement>
  4. 4. <rootElement xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=“location” ></rootElement>
  5. 5. <?xml version=”1.0”?><?xml version=”1.0”?> <schema xmlns=”http://www.w3.org/2001/XMLSchema”<name> xmlns:target=”http://www.exam.com/name” targetNamespace=”http://www.exam.com/name” <first> elementFormDefault=”qualified”> John </first> <element name=”name”> <complexType> <middle> <sequence> Johansen <element name=”first” type=”string”/> </middle> <element name=”middle” type=”string”/> <element name=”last” type=”string”/> <last> </sequence> Doe </complexType> </last> </element></name> </schema>
  6. 6. <schema targetNamespace=“URI” attributeFormDefault=“qualified or unqualified” elementFormDefault=“qualified or unqualified” version=“version number”></schema><schema xmlns=”http://www.w3.org/2001/XMLSchema”><xs:schema xmlns:xs=”http://www.w3.org/2001/XMLSchema”><xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
  7. 7. <element name=”name of the element” type=”global type” ref=”global element declaration” form=”qualified or unqualified” minOccurs=”non negative number” maxOccurs=”non negative number or „unbounded‟” default=”default value” fixed=”fixed value”>
  8. 8. <element name=”name of the element” type=”global type” ref=”global element declaration” form=”qualified or unqualified” minOccurs=”non negative number” maxOccurs=”non negative number or „unbounded‟” default=”default value” fixed=”fixed value”>
  9. 9. <phone>043678002</phone>birthday=“02-10-2011”
  10. 10. <simpleType name=”name of the simpleType” final=”#all or list or union or restriction”>
  11. 11. <restrictionbase=”name of the simpleType you are deriving from”>
  12. 12. Facet DescriptionminExclusive Allows you to specify the minimum value for your type that excludes the value you specifyminInclusive Allows you to specify the minimum value for your type that includes the value you specifymaxExclusive Allows you to specify the maximum value for your type that excludes the value you specifymaxInclusive Allows you to specify the maximum value for your type that includes the value you specifytotalDigits Allows you to specify the total number of digits in a numeric typefractionDigits Allows you to specify the number of fractional digits in a numeric typelength Allows you to specify the number of items in a list type or the number of characters in a string typeminLength Allows you to specify the minimum number of items in a list type or the minimum number of characters in a string typemaxLength Allows you to specify the maximum number of items in a list type or the maximum number of characters in a string typeenumeration Allows you to specify an allowable value in an enumerated listwhitespace Allows you to specify how whitespace should be treated within the typepattern Allows you to restrict string types using regular expressions
  13. 13. <simpleType name="myIntegerType"> <restriction base="integer"> <minInclusive value="10000"/> <maxInclusive value="99999"/> </restriction></simpleType>
  14. 14. <simpleType name="stockKeepingUnitType"> <restriction base="string"> <pattern value="d{3}-[A-Z]{2}"/> </restriction></simpleType>
  15. 15. <simpleType name=“phoneType”> <restriction base=”string”> <enumeration value=”Home”/> <enumeration value=”Work”/> <enumeration value=”Cell”/> <enumeration value=”Fax”/> </restriction></simpleType>
  16. 16. <listitemType=”name of simpleType used for validating items in the list”> <simpleType name=”phoneListType”> <list itemType=”exam:phoneType”/> </simpleType>
  17. 17. <union memberTypes=”whitespace separated list of types”>
  18. 18. <simpleType name=”UnknownString”> <restriction base=”string”> <enumeration value=”Unknown”/> </restriction></simpleType><simpleType name=”UnknownOrFloatType”> <union memberTypes=”float exam:UnknownString”/></simpleType>
  19. 19. content model attribute list
  20. 20. <element name=”name”> <complexType> <sequence> <element name=”first” type=”string”/> <element name=”middle” type=”string”/><phone>043678002</phone> <element name=”last” type=”string”/> </sequence> <attribute name=”title” type=”string”/> </complexType> </element>
  21. 21. <sequence> <element name=”first” type=”string”/> <element name=”middle” type=”string”/> <element name=”last” type=”string”/></sequence><!ELEMENT name (first, middle, last)>
  22. 22. <choice> <element name=”first” type=”string”/> <element name=”middle” type=”string”/> <element name=”last” type=”string”/></choice><!ELEMENT name (first| middle| last)>
  23. 23. <group name=”NameGroup”> <sequence> <element name=”first” type=”string”/> <element name=”middle” type=”string”/> <element name=”last” type=”string”/> </sequence></group><element name=”name”> <complexType> <group ref=”target:NameGroup”/> <attribute name=”title” type=”string”/> </complexType></element>
  24. 24. <complexType name="mixedType" mixed="true"> <choice maxOccurs="unbounded" minOccurs="0"> <element name=“b" type="string"/> <element name="i" type="string"/> <element name="u" type="string"/> </choice> <attribute ref="class"/></complexType><!ELEMENT description (#PCDATA | b | i | u)*>
  25. 25. <element name=“br”> <complexType> <attribute name=”title” type=”string”/> <complexType></element><!ELEMENT br EMPTY>
  26. 26. <all> <element name=”first” type=”string”/> <element name=”middle” type=”string”/> <element name=”last” type=”string”/></all>
  27. 27. <attribute name=”name of the attribute” type=”global type” ref=”global attribute declaration” form=”qualified or unqualified” use=”optional or prohibited or required” default=”default value” fixed=”fixed value”>
  28. 28. <attribute name=”title”> <simpleType> <!-- type information --> </simpleType></attribute><attribute name=”title” type=”string”/>
  29. 29. <attributeGroup name=”ContactsAttributes”> <!-- attribute declarations go here --></attributeGroup>  attributGroups may not recursively refer to themselves<attributeGroup name=”AttGroup1”> <attributeGroup ref=”target:AttGroup1”/></attributeGroup ><attributeGroup name=”AttGroup1”> <attributeGroup ref=”target:AttGroup2”/></attributeGroup ><attributeGroup name=”AttGroup2”> <attributeGroup ref=”target:AttGroup1”/></attributeGroup >
  30. 30. <import namespace=”” schemaLocation=””><import namespace=”http://www.example.com/name” schemaLocation=”name8.xsd”/>
  31. 31. <include schemaLocation=””><include schemaLocation=”contact_tags.xsd”/>

×