newport instruments copyright © 2002 ada & xml similarities & harmonization robert c. leif,...

43
Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments [email protected] www.newportinstruments.co m

Upload: sidney-kings

Post on 28-Mar-2015

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Ada & XMLSimilarities & Harmonization

Robert C. Leif, Ph.D.

Vice President R&D

Newport Instruments

[email protected]

www.newportinstruments.com

Page 2: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Introduction to XML

• eXtensible Markup Language

– Document (file) that describes data

– Allows sharing of data by providing a common standard, extensible way to interpret that data.

Page 3: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

W3C Goals (Requirements) for XML

• XML shall be straightforwardly usable over the Internet.

• XML shall support a wide variety of applications.

• XML shall be compatible with SGML.

• It shall be easy to write programs which process XML documents.

• The number of optional features in XML is to be kept to the absolute, minimum, ideally zero.

Page 4: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

• XML documents should be human-legible and reasonably clear.

• The XML design should be prepared quickly.

• The design of XML shall be formal and concise.

• XML documents shall be easy to create.

• Terseness in XML markup is of minimal importance.

Page 5: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Schema Element

<?xml version="1.0" encoding="UTF-8"?><!--Could be a URL"http://"--><schema targetNamespace="file://C:\

SIGAda\2002\XML\Person_Name.xsd" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:per_nam="file://C:\SIGAda\2001\XML\Person_Name.xsd" elementFormDefault="unqualified" attributeFormDefault="unqualified">

Page 6: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Person Name<simpleType name="Given_Name_Type">

<restriction base="string">

<maxLength value="50"/>

</restriction>

<!--50 characters are needed because it is possible for a person to have only one name-->

</simpleType>

Page 7: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

<complexType name="Person_Name_Type">

<all>

<element name="Given_Name" type="per_nam:Given_Name_Type"/>

<element name="Middle_Name" type="per_nam:Middle_Name_Type"/>

<element name="Family_Name" type="per_nam:Family_Name_Type"/>

</all>

</complexType>

Page 8: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

<simpleType name="Generation_Type"><restriction base="string">

<enumeration value="None"/><enumeration value="Senior"/><enumeration value="Jr."/><enumeration value="II"/><enumeration value="III"/><enumeration value="IV"/><enumeration value="V"/><enumeration value="X"/><enumeration value=“Other"/>

</restriction></simpleType>

Page 9: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

<complexType name="Person_Name_W_Generation_Type">

<complexContent> <extension base=

"per_nam:Person_Name_Type"> <all>

<element name="generation"

type="per_nam_gen:Generation_Type" minOccurs="0"/>

</all> </extension>

</complexContent></complexType>

Page 10: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Money with a range of $5.00 to $2,000.

<simpleType name="Fee_Type"> <restriction base="decimal"> <totalDigits value="6"/> <fractionDigits value="2"/> <minInclusive value="5.00"/> <maxInclusive value="2000.00"/> <pattern value="[0-9]{4}(.[0-9]{2})"/> <!--Four leading digits, decimal point, and 2

trailing digits.--> </restriction> </simpleType>

Page 11: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Harmonization of Data types

• Bounded Strings

• Numbers

Page 12: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Create XML Strings by Addition of fields to Bounded_String

• Encapsulated in generic packages, Ada.Strings.Bounded. & Wide_Bounded

• Solution:

1. Create a generic that instantiates Ada.Strings. Bounded with a generic type.

2. Add a Character_Set_Type etc. to a private tagged type.

3. Add a Modified version of all of the methods in Ada.Strings.Bounded

Page 13: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Latin_1_Range : constant Str_Maps.Character_Range :=

(Low => Latin_1.Null, High => Latin_1.Lc_Y_Diaeresis);

Latin_1_Char_Set : Character_Set_Type := Str_Maps.To_Set (Span => Latin_1_Range);

How to Create a Character Set

Page 14: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

XML Bounded Strings with Character Sets

with Ada.Strings.Bounded;

with Ada.Strings;

with Character_Sets;

with Pattern_Pkg;

generic

Max_Bd_Length : Positive;

Character_Set : Character_Sets.Character_Set_Type

:= Character_Sets.Latin_1_Char_Set;

Page 15: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Min_Bd_Length : Positive

:= Min_Bd_Length; ---1

Pattern : Pattern_Bd_Type := Null_Pattern_Bd;

Page 16: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Generic Instantiation

package Generic_Bd_W_Char_Sets is

……………………………

package Generic_Bd_Strings is newAda.Strings.Bounded.Generic_Bounded_Length

(Max => Max_Bd_Length);

Page 17: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

private type Generic_Bd_W_Char_Set_Type is tagged record Generic_Bd_Part : Generic_Bd_Type :=

Null_Generic_Bd; Character_Set_Part : Character_Set_Type :=

Character_Set; --This permits the Character_Set to be

--specified at instantiation and defaults to

--Latin_1 Min_Bd_Length_Part : Positive := 1;

Pattern_Part : Pattern_Bd_Type := Null_Pattern_Bd;

end record;

Page 18: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Problem

• XML is based on Unicode– UTF-8, – UTF-16, – UTF-32

Solution

Ada.Strings.Unbounded, Ada.Strings.Bounded Ada.Strings.Maps & Ada.Characters.Handling need to have added 32 bit versions.

Translation between 8, 16 and 32 bit types

Briot’s XML/Ada does not easily interface with bounded strings.

Page 19: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Page 20: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

ECMA Types

• http://www.ecma.ch/• Originally, European Computer Manufacturers

Association• Now, ECMA International - European

association for standardizing information and communication systems.

Page 21: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Real Types are Primitive

XMLType Source ECMA

float IEEE single-precision 32-bit float32

doubleIEEE double-precision 64-bit float64

*decimal W3C decimal

*Minimum of 18 Digits. Pentium uses double extended precision floating point registers. PowerPC uses floating point registers for fixed-point.

Page 22: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Integer Types are Derived

Type & Derivation Sequence ECMA

Min-Inclusive

Max-Inclusive

*integer -infinity infinity

nonPositiveInteger 0

negativeInteger -1

long Int64 -2**63 (2**63) -1

int Int32 -2**31 (2**31) -1

short Int16 -2**15 (2**15) -1

byteSByteInt8 -2**7 (2**7)-1

*Derived From decimal; fractionDigits·= 0

Page 23: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Type & Derivation Sequence ECMA

MinInclusive

MaxInclusive

*nonNegativeInteger 0 infinity

unsignedLong UInt64 0 2**64-1

unsignedInt UInt32 0 2**32-1

unsignedShort UInt16 0 2**16-1

unsignedByte Byte UInt8 0 2**8-1

positiveInteger 1 infinity

Integer Types Cont.

*Derived from Integer

Page 24: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

XML 32 bit Integer Equivalent

<simpleType name="Int32_Type">

<restriction base="int">

<minInclusive value="-2147483648"/>

<maxInclusive value="2147483647"/>

</restriction>

</simpleType>

Page 25: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Ada Int32 Type & Subtypes

subtype Int32 is Integer; --ortype Int32 is range -2**31..2**31-1;

for Int32'SIZE use 32; subtype Natural_32 is Int32 range 0..Int32'Last;subtype Positive_32 is Int32 range 1..Int32'Last;

Page 26: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

XML Time & Date Types

XML Type XML Description & Format

Type & Standard

duration

is a six-dimensional space where the coordinates designate the Gregorian year, month, day, hour, minute, and second components respectively. These components are ordered in their significance by their order of appearance i.e. as year, month, day, hour, minute, and second.

defined in § 5.5.3.2 of [ISO 8601],

Page 27: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

XML Core Languages

• Extensible Markup Language (XML)– Schema Definition Language (XSDL)– Extensible Stylesheet Language (XSL)– Scalable Vector Graphics (SVG)– XSL Transformations (XSLT)– XML Path Language (XPath)– XML Linking Language (XLink)– XML Forms (XForms)

Page 28: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

XSL Includes:

• Screen objects which scroll

• Page objects, which can be printed;

• Blocks with various formatting properties including those representing different levels of titles (some including auto-numbering) and paragraphs (including indented block quote paragraphs);

• External graphics;

• Tables.

Page 29: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

• Bulleted and enumerated lists including nested lists;

• Generated table of contents including leaders and generated page numbers;

• Running headers and footers including use of markers;

• Multiple page layouts, folio formats;

• Page master alternation, various in-line font changes

• Hyphenation and justification and various combinations of display spacing

Page 30: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

XSLT Number Formatting

• Like Ada uses a picture string

• However is described separately from the data.

Page 31: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

<attribute name="name" type="QName"/> <attribute name="decimal-separator" type="xsl:char" use="optional" default="."/> <attribute name="grouping-separator" type="xsl:char" use="optional" default=","/><attribute name="infinity" type="string" use="optional" default="Infinity"/> <attribute name="minus-sign" type="xsl:char" use="optional" default="-"/> <attribute name="NaN" type="string" use="optional" default="NaN"/>

Page 32: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

<attribute name="percent" type="xsl:char" use="optional" default="%"/>

<attribute name="per-mille" type="xsl:char" use="optional" default="&#x2030;"/> <attribute name="zero-digit" type="xsl:char" use="optional" default="0"/>

<attribute name="digit" type="xsl:char" use="optional" default="#"/>

<attribute name="pattern-separator" type="xsl:char" use="optional" default=";"/>

Page 33: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

XForms

• is a means for display, inputting, submitting and uploading data, without describing how the data will be presented.

• includes event handlers such as setFocus, message, and setValue.

• can: associate a schema datatype with a field, restrict a value from changing by declaring it read-only, require that a value exists before the data is submitted.

Page 34: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

XForms (Continued)

• can indicate that a field is the result of a calculation performed on other data and can describe the conditions required for the data to be considered valid.

• Includes user Interface controls, such as: text boxes including multiline content , secret boxes, buttons, and selection from multiple choices.

• Interacts with a stylesheet for display of radio buttons, checkboxes, menus, and listboxes.

Page 35: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Form Layouts

listbox checkbox radio menu

This configuration is not recommended.

A graphical browser might render form control selectMany as any of the following:

Page 36: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

XML & Ada have in common:• Separation of the declaration of public

data types from their use or display;

• Begins and ends;

• Strong typing including range checking;

• Single inheritance;

• Visibility control by the use of prefixes;

• Maximization of readability over programmer effort;

• Conformance Test Suites.

Page 37: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

XML (Packages)

• Mathematical Markup Language (MathML)

Page 38: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

•The maximization of a symbiotic relationship between XML and Ada requires the establishment of a formal liaison between SIGAda and the World Wide Web Consortium.

•Harmonization of XML and Ada

How is Ada to be called from a web page? Attribute (J code, compiled, or script)

Page 39: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Both Groups Could Learn from Each other

• XSL, XSLT & SVG would benefit from the services of an experience Ada language designer.

• Conversely, Ada presentation and GUI software should adopt as much of their formatting and design from XML technologies.

Page 40: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

XML Demolition of Ada Marketing Fallacies

• Need to minimize the number of reserved words.

• Verbosity impedes adoption.

• A language needs to be simple.

• C syntax is required for a large market.

• Small companies can not succeed. Altova, XMLSpy doing well.

• Shelve space is an absolute necessity for sales. XMLSpy sold over the Internet

Page 41: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

The XML Cover Pages, By Robin Cover (MLs)

• Markup Language for Complex Documents (Bergen MLCD Project)

• US Patent and Trademark Office Electronic Filing System

• BSML, schema for NCBI (National Center for Biotechnology Information) data model.

• Microarray Gene Expression Markup Language (MAGE-ML)

• CytometryML www.newportinstruments.com

Page 42: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Suggested Web Sites & ReadingsGeneral Principles of Software Validation; Final Guidance

for Industry and FDA Staff, January 11, 2002, www.fda.gov/cdrh/comp/guidance/938.html

Guidance for FDA Reviewers and Industry, May 29, 1998, www.fda.gov/cdrh/ode/software.pdf

N. G. Leveson"Safeware, System Safety and Computers", Addison-Wesley, Reading, MA pp. 412-413, 1995.

XML and related languages: Worldwide Web Consortium www.w3.org

P. Walmsley, “Definitive XML Schema”, ISBN 0-13-065567-8, Prentice Hall www.phptr.com

Character Model for the World Wide Web 1.0 W3C Working Draft 30 April 2002www.w3.org/TR/charmod/

Page 43: Newport Instruments copyright © 2002 Ada & XML Similarities & Harmonization Robert C. Leif, Ph.D. Vice President R&D Newport Instruments rleif@rleif.com

Newport Instruments copyright © 2002

Direct Internet Message Encapsulation (DIME) http://www.ietf.org/internet-drafts/draft-nielsen-dime-02.txt

FormsPlayer from x-port.net http://www.formsplayer.com/Scalable Vector Graphics (SVG)

http://www.w3.org/Graphics/SVG/Overview.htm8The Extensible Stylesheet Language (XSL)

http://www.w3.org/Style/XSL/K. Whistler, M. Davis „Unicode Technical Report #17,

Character Encoding Model”; http://www.unicode.org/unicode/reports/tr17/

E. Briot XML/Ada: a full XML suite: The Ada95 XML Library, Version 0.5 Date: 2001/10/30 15:01:17 http://libre.act-europe.fr/xmlada/main.html

R. C. Leif, SIGAda 2001 Workshop, “Creating a Symbiotic Relationship Between XML and Ada” Ada Letters Vol. XXII, pp 24-41 (2002).