dev 13 xml schema to the rescue n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
DEV-13: XML Schema to the Rescue PowerPoint Presentation
Download Presentation
DEV-13: XML Schema to the Rescue

Loading in 2 Seconds...

play fullscreen
1 / 62

DEV-13: XML Schema to the Rescue - PowerPoint PPT Presentation


  • 65 Views
  • Uploaded on

DEV-13: XML Schema to the Rescue. Michael Resnick Principal Software Engineer. Under Development. D I S C L A I M E R. D I S C L A I M E R. This talk includes information about potential future products and/or product enhancements.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'DEV-13: XML Schema to the Rescue' - sheila


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
dev 13 xml schema to the rescue

DEV-13:XML Schema to the Rescue

Michael Resnick

Principal Software Engineer

under development
Under Development

D I S C L A I M E R

D I S C L A I M E R

  • This talk includes information about potential future products and/or product enhancements.
  • What I am going to say reflects our current thinking, but the information contained herein is preliminary and subject to change. Any future products we ultimately deliver may be materially different from what is described here.

DEV-13: XML Schema to the Rescue

agenda
Agenda
  • Introduction
  • Use in the 4GL
  • Namespaces
  • Simple Data Types
  • Complex Data Types
  • XML Constructs
  • Extensibility
  • Demonstration

DEV-13: XML Schema to the Rescue

what is xml schema
What Is XML Schema?
  • An XML syntax
  • Describes structure of an XML document
  • Describes data types
  • Similar to OpenEdge™ table schema

DEV-13: XML Schema to the Rescue

xml schema example schema
XML Schema Example - Schema

XML Schema Fragment

<schema>

<element name=“name”>

<complexType>

<sequence>

<element name=“first” type=“string”/>

<element name=“last” type=“string”/>

</sequence>

</complexType>

</element>

</schema>

DEV-13: XML Schema to the Rescue

xml schema example instance
XML Schema Example - Instance

XML Instance

<name>

<first>Alfred</first>

<last>Newman</last>

</name>

DEV-13: XML Schema to the Rescue

xml schema why
XML Schema – Why?
  • Validation
  • Improvement over document type definitions (DTDs)
  • Concise reference for XML vocabulary
  • XML becoming ubiquitous
    • Storage format
    • Messaging format

DEV-13: XML Schema to the Rescue

existing xml schemas
Existing XML Schemas
  • Vertical markets standards
    • MISMO – mortgages
    • HIPAA – medical
  • Horizontal market standards
    • ebXML (e-business exchange)
    • WS-Security
  • Others
    • Commonwealth of Massachusetts

DEV-13: XML Schema to the Rescue

slide9

Using an XML Schema to Validate

XML Schema Document

XML Document

(refers to X.xsd)

Validating Parser

X.xml

X.xsd

Validated XML Document

DEV-13: XML Schema to the Rescue

xml schema compared to dtd
XML Schema Compared to DTD
  • Richer set of data types
  • More detail about data type
  • Is an XML syntax
  • Extensible

DEV-13: XML Schema to the Rescue

xml schema 1 0 specifications
XML Schema 1.0 Specifications
  • W3C Recommendation: 2001
  • Second edition: 2004

DEV-13: XML Schema to the Rescue

xml schema specifications new
XML Schema Specifications - New
  • XML Schema 1.1: 24 February 2005 (Working Draft)
    • Simplification
    • Namespace versioning
    • Corrections
    • Minor data type extensions
  • Schema Component Designators:29 March 2005 (Last Call Working Draft)

DEV-13: XML Schema to the Rescue

xml schema what does it do
XML Schema – What does it do?
  • Defines structured documents
    • Progress Tables
    • Relational Database table
    • Programming language structures
  • Defines semi-structured documents
    • XHTML
    • DocBook
    • SOAP
  • Defines an XML namespace

DEV-13: XML Schema to the Rescue

agenda1
Agenda
  • Introduction
  • Use in the 4GL
  • Namespaces
  • Simple Data Types
  • Complex Data Types
  • XML Constructs
  • Extensibility
  • Demonstration

DEV-13: XML Schema to the Rescue

use in the 4gl
Use in the 4GL
  • Currently
    • 4GL web service provider
    • 4GL web service client
  • Release 10.1A
    • DOM API
    • SAX Reader API
    • ProDataSet andTEMP-TABLE serialization

}

SOAP

}

Explicit (de)serialization

}

Automatic (de)serialization

DEV-13: XML Schema to the Rescue

agenda2
Agenda
  • Introduction
  • Use in the 4GL
  • Namespaces
  • Simple Data Types
  • Complex Data Types
  • XML Constructs
  • Extensibility
  • Demonstration

DEV-13: XML Schema to the Rescue

xml namespaces
XML Namespaces
  • Mix different XML vocabularies

<bib:book xmlns:bib=“urn:biblio” xmlns:pn=“http://schemas/personalName”>

<bib:title>Madmiration</bib:title>

<bib:author>

<pn:name>

<pn:title>Dr.</pn:title>

<pn:first>Alfred</pn:first>

<pn:middleInit>E</pn:middleInit>

<pn:last>Newman</pn:last>

</pn:name>

</bib:author>

</bib:book>

DEV-13: XML Schema to the Rescue

namespaces
Namespaces
  • Elements known by two values:Namespace (URI) Local nameurn:biblio titlehttp://schemas/personalName title
  • Prefix is an artifact of serializationbib pn
  • Prefix associated with namespace using xmlns:prefix=“namespace-uri” construct

DEV-13: XML Schema to the Rescue

default namespace
Default Namespace
  • Allows for elements without a prefix to be part of a namespace.

<title xmlns=“urn:biblio”>…</title>

DEV-13: XML Schema to the Rescue

no namespace
No Namespace
  • Use no namespace declarations.

<title>…</title>

DEV-13: XML Schema to the Rescue

namespace prefix scope
Namespace Prefix Scope

Namespace is visible for all elements appearing within its declaration

<ns:book xmlns:ns=“urn:biblio”>

<ns:title>...</ns:title>

<ns:author>

<ns:name xmlns:ns=“http://schemas/personName”>

<ns:title>...</ns:title>

...

</ns:name>

</ns:author>

</ns:book>

DEV-13: XML Schema to the Rescue

agenda3
Agenda
  • Introduction
  • Use in the 4GL
  • Namespaces
  • Simple Data Types
  • Complex Data Types
  • XML Constructs
  • Extensibility
  • Demonstration

DEV-13: XML Schema to the Rescue

simple data types
Simple Data Types
  • The string of characters within an element or an attribute value<anElement anAttribute=“simple-type”>simple-type</anElement>
  • Definition specifies
    • string representations: “0001234”, “+1234”
    • limitations (facets) on value:0 < x < 10, password 6-10 characters long

DEV-13: XML Schema to the Rescue

simple data types1
Simple Data Types

anyType

40+ simple types

anySimpleType

all complex types

dateTime

decimal

string

integer

long

DEV-13: XML Schema to the Rescue

agenda4
Agenda
  • Introduction
  • Use in the 4GL
  • Namespaces
  • Simple Data Types
  • Complex Data Types
  • XML Constructs
  • Extensibility
  • Demonstration

DEV-13: XML Schema to the Rescue

complex data types structures
Complex Data Types - Structures
  • A construct of simple types
    • sequence (data structure)
    • choice (union)
    • all (order unimportant)

<name> <first></first> <middle></middle> <last></last></name>

name

last

middle

first

DEV-13: XML Schema to the Rescue

complex data types content
Complex Data Types - Content
  • Content can be
    • elements
    • attributes
    • mixed (elements and text à la XHTML)

DEV-13: XML Schema to the Rescue

complex data model
Complex Data - Model

Element Text Attribute

DEV-13: XML Schema to the Rescue

agenda5
Agenda
  • Introduction
  • Use in the 4GL
  • Namespaces
  • Simple Data Types
  • Complex Data Types
  • XML Constructs
    • Attributes
    • Elements
    • Groups
    • Keys, Keyrefs and Unique
  • Extensibility
  • Demonstration

DEV-13: XML Schema to the Rescue

attributes
Attributes
  • Always defined by simple type
  • Specify use: optional, required or fixed
  • Specify default value

XML Schema Fragment

<attribute name=“count” type=“integer” default=“1” use=“optional”/>

XML Instance

<elementcount=“5”>content</element>

DEV-13: XML Schema to the Rescue

elements
Elements
  • Define by a type (simple or complex)
  • Expresses parent/child relationship
  • May have attributes

DEV-13: XML Schema to the Rescue

elements1
Elements
  • Can specify extent (minOccurs/maxOccurs)
    • Mandatory singleton minOccurs=1 maxOccurs=1
    • Optional singleton minOccurs=0 maxOccurs=1
    • Fixed length array minOccurs=n maxOccurs=n
    • Variable length array minOccurs=m maxOccurs=n
  • Nilability (true/false) ≈ UNKNOWN allowed?

DEV-13: XML Schema to the Rescue

defining an element
Defining an Element

XML Schema Fragment

<element name=“lineItem” type=“string” minOccurs=“1” maxOccurs=“unbounded”

nillable=“false”><attribute name=“lineNumber” type=“int”/>

</element>

XML Instance

<lineItem lineNumber=“1”>widget</lineItem>

<lineItem lineNumber=“15”>gadget</lineItem>

DEV-13: XML Schema to the Rescue

groups element and attributegroups
Groups (Element) andAttributeGroups
  • Reusable “macros”
  • Inline inclusion of elements/attributes

DEV-13: XML Schema to the Rescue

group example definition and reference
Group Example:Definition and Reference

XML Schema Fragment

<group name=“names”>

<sequence>

<element name=“firstName” type=“string”/>

<element name=“lastName” type=“string”/>

</sequence>

</group>

<element name=“name”>

<sequence>

<element name=“title” type=“string”/>

<group ref=“names”/>

</seqeuence>

</element>

DEV-13: XML Schema to the Rescue

group instance
Group Instance

XML Instance

<name>

<title>Mr.</title>

<firstName>Alfred</firstName>

<lastName>Newman</lastName>

</name>

DEV-13: XML Schema to the Rescue

unique
Unique
  • Unique
    • element or attribute values in a sequence must be unique

<recordlist>

<record><id>1</id><name>foo</name></record>

<record><id>2</id><name>bar</name></record>

<record><id>3</id><name>baz</name></record>

</recordlist>

DEV-13: XML Schema to the Rescue

keys and keyrefs
Keys and Keyrefs
  • Keys – Same as Unique plus:
    • Must not be nil
    • Can be referenced by keyref
    • Similar to XML id attributes
  • Keyrefs
    • Defines a relationship between two constructs (attributes or elements)
    • Similar to HTML href attribute

DEV-13: XML Schema to the Rescue

keys and keyrefs model
Keys and Keyrefs - Model

Element Text Attribute

Keyref

DEV-13: XML Schema to the Rescue

agenda6
Agenda
  • Introduction
  • Use in the 4GL
  • Namespaces
  • Simple Data Types
  • Complex Data Types
  • XML Constructs
  • Extensibility
    • Data types
    • Language
  • Demonstration

DEV-13: XML Schema to the Rescue

extensibility simple type derivation by restriction
Extensibility:Simple Type Derivation by Restriction

integer

…0123

-(264) <= n <= 264 - 1

long

decimal

...0123[.4560…]

DEV-13: XML Schema to the Rescue

extensibility xml schema language
Extensibility: XML Schema Language
  • Can add your own XML Schema
    • elements
    • attributes
    • annotations
  • Useful for
    • storing and retrieving extra information
    • sending extra information

DEV-13: XML Schema to the Rescue

extensibility schema language
Extensibility: Schema Language

Modularity

  • Import – Combine schema definitions
  • Include – Organize complex definition

Import Include

DEV-13: XML Schema to the Rescue

agenda7
Agenda
  • Introduction
  • Use in the 4GL
  • Namespaces
  • Simple Data Types
  • Complex Data Types
  • XML Constructs
  • Extensibility
  • Demonstration

DEV-13: XML Schema to the Rescue

new schema document
New Schema Document

DEV-13: XML Schema to the Rescue

complex name element
Complex name Element

DEV-13: XML Schema to the Rescue

fully define complex name element
Fully Define Complex name Element

DEV-13: XML Schema to the Rescue

singlechar type definition
SingleChar Type Definition

DEV-13: XML Schema to the Rescue

middle initial name type change
Middle Initial Name & Type Change

DEV-13: XML Schema to the Rescue

example document generated from schema
Example DocumentGenerated from Schema

DEV-13: XML Schema to the Rescue

complete example document
Complete Example Document

DEV-13: XML Schema to the Rescue

validation error middleinitial too long
Validation Error:middleInitial Too Long

DEV-13: XML Schema to the Rescue

corrected document successful validation
Corrected DocumentSuccessful Validation

DEV-13: XML Schema to the Rescue

in summary
In Summary
  • XML Schema is very sophisticated
  • The 4GL is becoming schema aware
  • Development and deployment benefit from XML Schema

DEV-13: XML Schema to the Rescue

questions
Questions?

DEV-13: XML Schema to the Rescue

xml schema specifications
XML Schema Specifications
  • Recommendations (standards)
    • XML Schema Part 0: Primer Second Editionhttp://www.w3.org/TR/xmlschema-0/
    • XML Schema Part 1: Structures Second Editionhttp://www.w3.org/TR/xmlschema-1/
    • XML Schema Part 2: Datatypes Second Editionhttp://www.w3.org/TR/xmlschema-2/

DEV-13: XML Schema to the Rescue

xml schema 1 1 specifications
XML Schema 1.1 Specifications
  • Working Drafts
    • Requirements for XML Schema 1.1
      • http://www.w3.org/TR/xmlschema-11-req/
    • XML Schema 1.1 Part 1: Structures
      • http://www.w3.org/TR/xmlschema11-1/
    • XML Schema 1.1 Part 2: Datatypes
      • http://www.w3.org/TR/xmlschema11-2/

DEV-13: XML Schema to the Rescue

xml schema specifications1
XML Schema Specifications
  • Ancillary
    • XML Schema: Component Designatorshttp://www.w3.org/TR/xmlschema-ref/

DEV-13: XML Schema to the Rescue

thank you for your time
Thank you for your time!

DEV-13: XML Schema to the Rescue