XML Schemas

  • 960 views
Uploaded on

XML Schemas Lanaguage

XML Schemas Lanaguage

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
960
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
70
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 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. <?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. <rootElement xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“list of namespace-location pairs” ></rootElement>
  • 4. <rootElement xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=“location” ></rootElement>
  • 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. <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. <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. <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. <phone>043678002</phone>birthday=“02-10-2011”
  • 10. <simpleType name=”name of the simpleType” final=”#all or list or union or restriction”>
  • 11. <restrictionbase=”name of the simpleType you are deriving from”>
  • 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. <simpleType name="myIntegerType"> <restriction base="integer"> <minInclusive value="10000"/> <maxInclusive value="99999"/> </restriction></simpleType>
  • 14. <simpleType name="stockKeepingUnitType"> <restriction base="string"> <pattern value="d{3}-[A-Z]{2}"/> </restriction></simpleType>
  • 15. <simpleType name=“phoneType”> <restriction base=”string”> <enumeration value=”Home”/> <enumeration value=”Work”/> <enumeration value=”Cell”/> <enumeration value=”Fax”/> </restriction></simpleType>
  • 16. <listitemType=”name of simpleType used for validating items in the list”> <simpleType name=”phoneListType”> <list itemType=”exam:phoneType”/> </simpleType>
  • 17. <union memberTypes=”whitespace separated list of types”>
  • 18. <simpleType name=”UnknownString”> <restriction base=”string”> <enumeration value=”Unknown”/> </restriction></simpleType><simpleType name=”UnknownOrFloatType”> <union memberTypes=”float exam:UnknownString”/></simpleType>
  • 19. content model attribute list
  • 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. <sequence> <element name=”first” type=”string”/> <element name=”middle” type=”string”/> <element name=”last” type=”string”/></sequence><!ELEMENT name (first, middle, last)>
  • 22. <choice> <element name=”first” type=”string”/> <element name=”middle” type=”string”/> <element name=”last” type=”string”/></choice><!ELEMENT name (first| middle| last)>
  • 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. <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. <element name=“br”> <complexType> <attribute name=”title” type=”string”/> <complexType></element><!ELEMENT br EMPTY>
  • 26. <all> <element name=”first” type=”string”/> <element name=”middle” type=”string”/> <element name=”last” type=”string”/></all>
  • 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. <attribute name=”title”> <simpleType> <!-- type information --> </simpleType></attribute><attribute name=”title” type=”string”/>
  • 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. <import namespace=”” schemaLocation=””><import namespace=”http://www.example.com/name” schemaLocation=”name8.xsd”/>
  • 31. <include schemaLocation=””><include schemaLocation=”contact_tags.xsd”/>