SlideShare ist ein Scribd-Unternehmen logo
1 von 21
CIS-189 XML
   Qualification refers to whether a value
    (element, attribute) must be qualified by a its
    namespace
    ◦ When an element (or attribute) doesn’t have a
      namespace declaration it’s unqualified
    ◦ Determines how name is used in data (instance)
      document
   A schema has the attributes elementFormDefault
    and attributeFormDefault
    ◦ Set to qualified or unqualified
    ◦ By setting to qualified, must include a namespace when
      use attributes or elements
<schema attiributeFormDefault=“unqualified”
elementFormDefault=“unqualified”>

   Element and attributes can be specified
    individually as qualified (or not)
    <element form=“unqualified”>
    <attribute form=“qualified”>
   Have several different ways to specify how
    elements fit together
   Sequence: specifies that elements must be in
    order, and there’s variability in when and how
    many times a child element occurs
   All: elements may appear (or not), and in any
    order
   Choice: one of several child elements may
    appear
   Group: a set of elements may be referenced
    by name
   Allows elements to appear in any order or not
    at all
   Rules governing use
    1. Must be only content model declaration of a
       <complexType> definition
      For example, can’t follow with <sequence>
    2. Can only have element declarations as children
    3. The children of the <all> element may appear
       once – or not at all
<element name=“name”>
 <complexType>
  <all>
   <element name=“first” type=“xs:string” />
   <element name=“middle” type=“xs:string” />
   <element name=“last” type=“xs:string” />
  </all>
 </complextType>
</element>
   Similar in syntax to sequence
   Only one member of list can appear in the
    document
   Allow a middle initial or a middle name

<choice>
 <element name=“middleInitial” type=“xs:string” />
 <element name=“middleName type=“xs:string” />
</choice>

Note: Best case would restrict Middle Initial to one
character with a simple type.
   A group allows you to tie elements together, and
    then reference then with a single name
Definition:
<group name=“nameFields”>
  <element name=“first” type=“xs:string” />
  <element name=“middle” type=“xs:string” />
  <element name=“last” type=“xs:string” />
</group>
Use:
<element name=“name”>
  <complexType>
       <group ref=“nameFields” />
  </complexType>
</element>
   Can create a group of attributes similar to
    element groups
   Allows re-use of common members without
    multiple definitions
    ◦ Attribute groups cannot be recursive (refer to
      themselves
   Create limits on acceptable values as a simple
    type
   A facet is a single property or trait of a simple
    type
   Twelve facets can be applied to limit
    acceptable values
   minExclusive: smallest value, excluding
    what’s specified
   minInclusive: smallest value, including what’s
    specified
   maxExclusive: largest value, excluding what’s
    specified
   maxInclusive: largest value, including what’s
    specified
   totalDigits: total number of digits of a
    numeric type
   fractionDigits: number of decimal places
   length: number of items in a list or characters
    in a string
   minLength: minimum number of list items or
    characters
   maxLength: maximum number of list items
    or characters
   enumeration: specify member of a list
   whitespace: how whitespace should be
    treated
   pattern: restrict string types by pattern
Specifying a positive integer
<xs:simpleType name="creditHours">
 <xs:restriction base="xs:integer">
 <xs:minInclusive value="0" />
 </xs:restriction>
</xs:simpleType>
Specifying a list:
<xs:simpleType name="cisDepartments">
 <xs:restriction base="xs:string">
   <xs:enumeration value="CIS" />
   <xs:enumeration value="CNA" />
   <xs:enumeration value="CS" />
 </xs:restriction>
</xs:simpleType>
   Specify a 3 digit value

<xs:simpleType name="courseNumbering">
 <xs:restriction base="xs:string">
   <xs:pattern value="b[0-9]{3}b" />
 </xs:restriction>
</xs:simpleType>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
  elementFormDefault="qualified"
  xmlns="http://tempuri.org/XMLSchema.xsd"
  xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
  xmlns:xs="http://www.w3.org/2001/XMLSchema”>
 <xs:element name="course">
  <xs:complexType>
   <xs:sequence>
     <xs:element name="department" type="cisDepartments" />
     <xs:element name="number" type="courseNumbering" />
     <xs:element name="title" type="xs:string" />
     <xs:element name="credits" type="creditHours" />
   </xs:sequence>
  </xs:complexType>
 </xs:element>
<xs:simpleType name="creditHours">
 <xs:restriction base="xs:integer">
  <xs:minInclusive value="0" />
 </xs:restriction>
</xs:simpleType>
<xs:simpleType name="cisDepartments">
 <xs:restriction base="xs:string">
  <xs:enumeration value="CIS" />
  <xs:enumeration value="CNA" />
  <xs:enumeration value="CS" />
 </xs:restriction>
</xs:simpleType>
<xs:simpleType name="courseNumbering">
 <xs:restriction base="xs:string">
  <xs:pattern value="b[0-9]{3}b" />
 </xs:restriction>
</xs:simpleType>

</xs:schema>
   A list allows an element or attribute to store
    multiple values
    ◦ Uses enumerated values
    ◦ Values are separated by whitespace, so whitespace
      cannot be part of the content
    ◦ Can be built-in XML or a defined simpleType data
      type
Define
<simpleType name=“Degrees”>        different
 <restriction base=“string”>       values
     <enumeration value=“AA” />
     <enumeration value=“AS” />
     <enumeration value=“AAS” />
 </restriction>
</simpleType>
                                       Define
<simpleType name=“DegreesList”>        data type
 <list itemType=“Degrees”/>            using
</simpleType>                          values

<element name=“degreesEarned” type=“DegreesList” />

                    Define element storing different values
   <union> allows the combination of two data
    type for an element or attribute
   If have a possiblePoints element, expected
    value would be an integer; <union> would
    allow a string entry to note a “Missing” value
   Separate data types with whitespace

<simpleType name=“CreditValue”>
<union memberTypes=“xs:integer xs:string />
</simpleType
<xs:simpleType name="zipCode">
  <xs:union>
   <xs:simpleType>
     <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]{5}" />
     </xs:restriction>
   </xs:simpleType>
   <xs:simpleType>
     <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]{5}-[0-9]{4}" />
     </xs:restriction>
   </xs:simpleType>
  </xs:union>
 </xs:simpleType>

Weitere ähnliche Inhalte

Was ist angesagt? (20)

XML Schema
XML SchemaXML Schema
XML Schema
 
Xml part4
Xml part4Xml part4
Xml part4
 
XML Fundamentals
XML FundamentalsXML Fundamentals
XML Fundamentals
 
Mysql Crud, Php Mysql, php, sql
Mysql Crud, Php Mysql, php, sqlMysql Crud, Php Mysql, php, sql
Mysql Crud, Php Mysql, php, sql
 
SXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup LanguageSXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup Language
 
Database constraints
Database constraintsDatabase constraints
Database constraints
 
Xml Schema
Xml SchemaXml Schema
Xml Schema
 
Xslt
XsltXslt
Xslt
 
Xsd tutorial
Xsd tutorialXsd tutorial
Xsd tutorial
 
Web Service Workshop - 3 days
Web Service Workshop - 3 daysWeb Service Workshop - 3 days
Web Service Workshop - 3 days
 
Informasjonsintegrasjon – hva er utfordringene
Informasjonsintegrasjon – hva er utfordringeneInformasjonsintegrasjon – hva er utfordringene
Informasjonsintegrasjon – hva er utfordringene
 
Xslt
XsltXslt
Xslt
 
XML DTD and Schema
XML DTD and SchemaXML DTD and Schema
XML DTD and Schema
 
Xml part2
Xml part2Xml part2
Xml part2
 
SCDJWS 1. xml schema
SCDJWS 1. xml schemaSCDJWS 1. xml schema
SCDJWS 1. xml schema
 
Xml part3
Xml part3Xml part3
Xml part3
 
Structure&amp;union
Structure&amp;unionStructure&amp;union
Structure&amp;union
 
XSLT
XSLTXSLT
XSLT
 
J query lecture 1
J query lecture 1J query lecture 1
J query lecture 1
 
XSLT. Basic.
XSLT. Basic.XSLT. Basic.
XSLT. Basic.
 

Andere mochten auch (7)

Cis245 Midterm Review
Cis245 Midterm ReviewCis245 Midterm Review
Cis245 Midterm Review
 
CIS160 final review
CIS160 final reviewCIS160 final review
CIS160 final review
 
Cis166 Final Review C#
Cis166 Final Review C#Cis166 Final Review C#
Cis166 Final Review C#
 
CIS 245 Final Review
CIS 245 Final ReviewCIS 245 Final Review
CIS 245 Final Review
 
Stored procedures
Stored proceduresStored procedures
Stored procedures
 
3 sql overview
3 sql overview3 sql overview
3 sql overview
 
Normalization
NormalizationNormalization
Normalization
 

Ähnlich wie Schemas 2 - Restricting Values

Xsd restrictions, xsl elements, dhtml
Xsd restrictions, xsl elements, dhtmlXsd restrictions, xsl elements, dhtml
Xsd restrictions, xsl elements, dhtmlAMIT VIRAMGAMI
 
XML Schema
XML SchemaXML Schema
XML Schemayht4ever
 
Alfresco Custom Model
Alfresco Custom ModelAlfresco Custom Model
Alfresco Custom ModelAndrea Leo
 
Native XML processing in C++ (BoostCon'11)
Native XML processing in C++ (BoostCon'11)Native XML processing in C++ (BoostCon'11)
Native XML processing in C++ (BoostCon'11)Sumant Tambe
 
35 schemas
35 schemas35 schemas
35 schemasmavilym
 
[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자
[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자
[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자Donghyeok Kang
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersAmanda Gilmore
 
Xml For Dummies Chapter 10 Building A Custom Xml Schema it-slideshares.blog...
Xml For Dummies   Chapter 10 Building A Custom Xml Schema it-slideshares.blog...Xml For Dummies   Chapter 10 Building A Custom Xml Schema it-slideshares.blog...
Xml For Dummies Chapter 10 Building A Custom Xml Schema it-slideshares.blog...phanleson
 
Generation_XSD_Article - Part 3.pdf
Generation_XSD_Article - Part 3.pdfGeneration_XSD_Article - Part 3.pdf
Generation_XSD_Article - Part 3.pdfDavid Harrison
 

Ähnlich wie Schemas 2 - Restricting Values (20)

Xsd restrictions, xsl elements, dhtml
Xsd restrictions, xsl elements, dhtmlXsd restrictions, xsl elements, dhtml
Xsd restrictions, xsl elements, dhtml
 
XML Schema
XML SchemaXML Schema
XML Schema
 
XML SCHEMAS
XML SCHEMASXML SCHEMAS
XML SCHEMAS
 
02 xml schema
02 xml schema02 xml schema
02 xml schema
 
Alfresco Custom Model
Alfresco Custom ModelAlfresco Custom Model
Alfresco Custom Model
 
Native XML processing in C++ (BoostCon'11)
Native XML processing in C++ (BoostCon'11)Native XML processing in C++ (BoostCon'11)
Native XML processing in C++ (BoostCon'11)
 
Xsd examples
Xsd examplesXsd examples
Xsd examples
 
XML_schema_Structure
XML_schema_StructureXML_schema_Structure
XML_schema_Structure
 
Xml session
Xml sessionXml session
Xml session
 
Schematron
SchematronSchematron
Schematron
 
35 schemas
35 schemas35 schemas
35 schemas
 
XSD
XSDXSD
XSD
 
XML Schemas
XML SchemasXML Schemas
XML Schemas
 
[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자
[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자
[제1회 루씬 한글분석기 기술세미나] solr로 나만의 검색엔진을 만들어보자
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL Superpowers
 
Xml For Dummies Chapter 10 Building A Custom Xml Schema it-slideshares.blog...
Xml For Dummies   Chapter 10 Building A Custom Xml Schema it-slideshares.blog...Xml For Dummies   Chapter 10 Building A Custom Xml Schema it-slideshares.blog...
Xml For Dummies Chapter 10 Building A Custom Xml Schema it-slideshares.blog...
 
Generation_XSD_Article - Part 3.pdf
Generation_XSD_Article - Part 3.pdfGeneration_XSD_Article - Part 3.pdf
Generation_XSD_Article - Part 3.pdf
 
Selenium-Locators
Selenium-LocatorsSelenium-Locators
Selenium-Locators
 
Sightly - Part 2
Sightly - Part 2Sightly - Part 2
Sightly - Part 2
 
Day2 xslt x_path_xquery
Day2 xslt x_path_xqueryDay2 xslt x_path_xquery
Day2 xslt x_path_xquery
 

Mehr von Randy Riness @ South Puget Sound Community College

Mehr von Randy Riness @ South Puget Sound Community College (20)

SQL Constraints
SQL ConstraintsSQL Constraints
SQL Constraints
 
CIS145 Final Review
CIS145 Final ReviewCIS145 Final Review
CIS145 Final Review
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
 
CIS245 sql
CIS245 sqlCIS245 sql
CIS245 sql
 
CSS
CSSCSS
CSS
 
XPath
XPathXPath
XPath
 
XSLT Overview
XSLT OverviewXSLT Overview
XSLT Overview
 
Views
ViewsViews
Views
 
CIS282 Midterm review
CIS282 Midterm reviewCIS282 Midterm review
CIS282 Midterm review
 
CIS 145 test 1 review
CIS 145 test 1 reviewCIS 145 test 1 review
CIS 145 test 1 review
 
XML schemas
XML schemasXML schemas
XML schemas
 
Document type definitions part 2
Document type definitions part 2Document type definitions part 2
Document type definitions part 2
 
Document type definitions part 1
Document type definitions part 1Document type definitions part 1
Document type definitions part 1
 
DOM specifics
DOM specificsDOM specifics
DOM specifics
 
SQL overview and software
SQL overview and softwareSQL overview and software
SQL overview and software
 
Cis166 final review c#
Cis166 final review c#Cis166 final review c#
Cis166 final review c#
 
Triggers
TriggersTriggers
Triggers
 
CIS 282 Final Review
CIS 282 Final ReviewCIS 282 Final Review
CIS 282 Final Review
 
SQL Server Stored procedures
SQL Server Stored proceduresSQL Server Stored procedures
SQL Server Stored procedures
 
SQL Server Views
SQL Server ViewsSQL Server Views
SQL Server Views
 

Kürzlich hochgeladen

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 

Kürzlich hochgeladen (20)

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 

Schemas 2 - Restricting Values

  • 2. Qualification refers to whether a value (element, attribute) must be qualified by a its namespace ◦ When an element (or attribute) doesn’t have a namespace declaration it’s unqualified ◦ Determines how name is used in data (instance) document  A schema has the attributes elementFormDefault and attributeFormDefault ◦ Set to qualified or unqualified ◦ By setting to qualified, must include a namespace when use attributes or elements
  • 3. <schema attiributeFormDefault=“unqualified” elementFormDefault=“unqualified”>  Element and attributes can be specified individually as qualified (or not) <element form=“unqualified”> <attribute form=“qualified”>
  • 4. Have several different ways to specify how elements fit together  Sequence: specifies that elements must be in order, and there’s variability in when and how many times a child element occurs  All: elements may appear (or not), and in any order  Choice: one of several child elements may appear  Group: a set of elements may be referenced by name
  • 5. Allows elements to appear in any order or not at all  Rules governing use 1. Must be only content model declaration of a <complexType> definition  For example, can’t follow with <sequence> 2. Can only have element declarations as children 3. The children of the <all> element may appear once – or not at all
  • 6. <element name=“name”> <complexType> <all> <element name=“first” type=“xs:string” /> <element name=“middle” type=“xs:string” /> <element name=“last” type=“xs:string” /> </all> </complextType> </element>
  • 7. Similar in syntax to sequence  Only one member of list can appear in the document  Allow a middle initial or a middle name <choice> <element name=“middleInitial” type=“xs:string” /> <element name=“middleName type=“xs:string” /> </choice> Note: Best case would restrict Middle Initial to one character with a simple type.
  • 8. A group allows you to tie elements together, and then reference then with a single name Definition: <group name=“nameFields”> <element name=“first” type=“xs:string” /> <element name=“middle” type=“xs:string” /> <element name=“last” type=“xs:string” /> </group> Use: <element name=“name”> <complexType> <group ref=“nameFields” /> </complexType> </element>
  • 9. Can create a group of attributes similar to element groups  Allows re-use of common members without multiple definitions ◦ Attribute groups cannot be recursive (refer to themselves
  • 10. Create limits on acceptable values as a simple type  A facet is a single property or trait of a simple type  Twelve facets can be applied to limit acceptable values
  • 11. minExclusive: smallest value, excluding what’s specified  minInclusive: smallest value, including what’s specified  maxExclusive: largest value, excluding what’s specified  maxInclusive: largest value, including what’s specified  totalDigits: total number of digits of a numeric type
  • 12. fractionDigits: number of decimal places  length: number of items in a list or characters in a string  minLength: minimum number of list items or characters  maxLength: maximum number of list items or characters  enumeration: specify member of a list  whitespace: how whitespace should be treated  pattern: restrict string types by pattern
  • 13. Specifying a positive integer <xs:simpleType name="creditHours"> <xs:restriction base="xs:integer"> <xs:minInclusive value="0" /> </xs:restriction> </xs:simpleType>
  • 14. Specifying a list: <xs:simpleType name="cisDepartments"> <xs:restriction base="xs:string"> <xs:enumeration value="CIS" /> <xs:enumeration value="CNA" /> <xs:enumeration value="CS" /> </xs:restriction> </xs:simpleType>
  • 15. Specify a 3 digit value <xs:simpleType name="courseNumbering"> <xs:restriction base="xs:string"> <xs:pattern value="b[0-9]{3}b" /> </xs:restriction> </xs:simpleType>
  • 16. <?xml version="1.0" encoding="utf-8"?> <xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd" xmlns:mstns="http://tempuri.org/XMLSchema.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema”> <xs:element name="course"> <xs:complexType> <xs:sequence> <xs:element name="department" type="cisDepartments" /> <xs:element name="number" type="courseNumbering" /> <xs:element name="title" type="xs:string" /> <xs:element name="credits" type="creditHours" /> </xs:sequence> </xs:complexType> </xs:element>
  • 17. <xs:simpleType name="creditHours"> <xs:restriction base="xs:integer"> <xs:minInclusive value="0" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="cisDepartments"> <xs:restriction base="xs:string"> <xs:enumeration value="CIS" /> <xs:enumeration value="CNA" /> <xs:enumeration value="CS" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="courseNumbering"> <xs:restriction base="xs:string"> <xs:pattern value="b[0-9]{3}b" /> </xs:restriction> </xs:simpleType> </xs:schema>
  • 18. A list allows an element or attribute to store multiple values ◦ Uses enumerated values ◦ Values are separated by whitespace, so whitespace cannot be part of the content ◦ Can be built-in XML or a defined simpleType data type
  • 19. Define <simpleType name=“Degrees”> different <restriction base=“string”> values <enumeration value=“AA” /> <enumeration value=“AS” /> <enumeration value=“AAS” /> </restriction> </simpleType> Define <simpleType name=“DegreesList”> data type <list itemType=“Degrees”/> using </simpleType> values <element name=“degreesEarned” type=“DegreesList” /> Define element storing different values
  • 20. <union> allows the combination of two data type for an element or attribute  If have a possiblePoints element, expected value would be an integer; <union> would allow a string entry to note a “Missing” value  Separate data types with whitespace <simpleType name=“CreditValue”> <union memberTypes=“xs:integer xs:string /> </simpleType
  • 21. <xs:simpleType name="zipCode"> <xs:union> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="[0-9]{5}" /> </xs:restriction> </xs:simpleType> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="[0-9]{5}-[0-9]{4}" /> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType>