demystifying the extensible markup language nick roberts & jim few

21
Demystifying the eXtensible Demystifying the eXtensible Markup Language Markup Language Nick Roberts & Jim Few Nick Roberts & Jim Few http://ir.kennesaw.edu http://ir.kennesaw.edu

Upload: alice-williams

Post on 29-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

Demystifying the eXtensible Demystifying the eXtensible Markup LanguageMarkup Language

Nick Roberts & Jim FewNick Roberts & Jim Few

http://ir.kennesaw.eduhttp://ir.kennesaw.edu

Page 2: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

What is XML?

Why should I care?

How can I use XML?

What is XML?

Why should I care?

How can I use XML?

AgendaAgenda

Page 3: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

W3C: http://www.w3schools.com/xml/xml_whatis.asp

What is XML?What is XML?

The eXtensible Markup Language (XML) is a markup language that provides a format for describing structured data.

XML was designed to describe, store, carry, and exchange data.

XML tags are not predefined like HTML. You must define your own tags.

XML uses an XML schema to describe the data.

XML can be transformed into other formats with XSLT.

The eXtensible Markup Language (XML) is a markup language that provides a format for describing structured data.

XML was designed to describe, store, carry, and exchange data.

XML tags are not predefined like HTML. You must define your own tags.

XML uses an XML schema to describe the data.

XML can be transformed into other formats with XSLT.

Page 4: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

What XML is NotWhat XML is Not

Something to be afraid of

A replacement for HTML

A replacement for relational databases

A programming language like Java, C++, VB

A forgiving syntax

A silver bullet

Something to be afraid of

A replacement for HTML

A replacement for relational databases

A programming language like Java, C++, VB

A forgiving syntax

A silver bullet

Page 5: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

Text File FormatText File Format

ID Lname Fname GenderEthnicity

83492 Clark Betty F W

89430 Bhatt Soham M A

94032 Jones Jim M W

48392 Klein Kim F B

ID Lname Fname GenderEthnicity

83492 Clark Betty F W

89430 Bhatt Soham M A

94032 Jones Jim M W

48392 Klein Kim F B

Page 6: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

XML FormatXML Format

Page 7: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

Standard (Non-proprietary)

Extensible

Flexible

Easy to share

Web-friendly

Separates content from presentation

Richer than flat text files

It will be everywhere

Standard (Non-proprietary)

Extensible

Flexible

Easy to share

Web-friendly

Separates content from presentation

Richer than flat text files

It will be everywhere

Why should I care?Why should I care?

Page 8: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

XML documents use a self-describing syntax

All XML elements must have a closing tag

XML tags are case sensitive

All XML elements must be properly nested

All XML documents must have a root element

XML documents use a self-describing syntax

All XML elements must have a closing tag

XML tags are case sensitive

All XML elements must be properly nested

All XML documents must have a root element

XML SyntaxXML Syntax

W3C: http://www.w3schools.com/xml/xml_syntax.asp

Page 9: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

Microsoft

IBM

Oracle

SAS

SPSS

Adobe

SAP

Microsoft

IBM

Oracle

SAS

SPSS

Adobe

SAP

Who supports XML?Who supports XML?

Sun Microsystems

BEA

Business Objects

Novell

W3C

Computer Associates

PeopleSoft

Sun Microsystems

BEA

Business Objects

Novell

W3C

Computer Associates

PeopleSoft

Anyone who is a player in the computing worldAnyone who is a player in the computing world

Page 10: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

Data IslandsData Islands

Oracle

MS Excel

MSAccess

HTML

PDF

MS Word

Crystal

Page 11: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

XML Data SharingXML Data Sharing

OracleMS Word

CrystalMS Excel

SQLServer

DreamweaverMS

Access

DB2

XML

Page 12: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

Text Versus XMLText Versus XML

Student Record

Nick Roberts

0001462395

143 Main St

Paradise, CA

90210

24

3.4

3.8

Student Record

Nick Roberts

0001462395

143 Main St

Paradise, CA

90210

24

3.4

3.8

<Student>

<Last-Name>Roberts</Last-Name>

<First-Name>Nick</First-Name>

<ID>0001462395</ID>

<Street>143 Main St</Street>

<City>Paradise</City>

<State>CA</State>

<Zip-Code>90210</Zip-Code>

<Age>24</Age>

<GPA-Cumulative>3.4</GPA-Cumulative>

<GPA-Term>3.8</GPA-Term>

</Student>

<Student>

<Last-Name>Roberts</Last-Name>

<First-Name>Nick</First-Name>

<ID>0001462395</ID>

<Street>143 Main St</Street>

<City>Paradise</City>

<State>CA</State>

<Zip-Code>90210</Zip-Code>

<Age>24</Age>

<GPA-Cumulative>3.4</GPA-Cumulative>

<GPA-Term>3.8</GPA-Term>

</Student>

Page 13: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

HTML Versus XMLHTML Versus XML

<b>Student Record</b>

<br>

<br>

Nick Roberts<br>

0001462395<br>

143 Main St<br>

Paradise, CA<br>

90210<br>

24

<b>Student Record</b>

<br>

<br>

Nick Roberts<br>

0001462395<br>

143 Main St<br>

Paradise, CA<br>

90210<br>

24

<Student>

<Last-Name>Roberts</Last-Name>

<First-Name>Nick</First-Name>

<ID>0001462395</ID>

<Street>143 Main St</Street>

<City>Paradise</City>

<State>CA</State>

<Zip-Code>90210</Zip-Code>

<Age>24</Age>

</Student>

<Student>

<Last-Name>Roberts</Last-Name>

<First-Name>Nick</First-Name>

<ID>0001462395</ID>

<Street>143 Main St</Street>

<City>Paradise</City>

<State>CA</State>

<Zip-Code>90210</Zip-Code>

<Age>24</Age>

</Student>

Page 14: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

What is XML Schema?What is XML Schema?

An XML schema describes the structure of an XML document

An XML schema defines: Elements that can appear in a document

Attributes that can appear in a document

Which elements are child elements

The order of child elements

The number of child elements

Whether an element is empty or can include text

Data types for elements and attributes

Default and fixed values for elements and attributes

An XML schema describes the structure of an XML document

An XML schema defines: Elements that can appear in a document

Attributes that can appear in a document

Which elements are child elements

The order of child elements

The number of child elements

Whether an element is empty or can include text

Data types for elements and attributes

Default and fixed values for elements and attributesW3C: http://www.w3schools.com/schema/schema_why.asp

Page 15: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

So, What is XML Schema?So, What is XML Schema?

An XML schema manages the expectations of those sharing an XML document

The sender can describe the data in a way that the receiver can understand

A schema enforces business constraints and ensures data validation

For example, we can create a standard definition for social security number (data type is string, format=###-##-####, required field, etc.).

An XML schema manages the expectations of those sharing an XML document

The sender can describe the data in a way that the receiver can understand

A schema enforces business constraints and ensures data validation

For example, we can create a standard definition for social security number (data type is string, format=###-##-####, required field, etc.).

W3C: http://www.w3schools.com/schema/schema_intro.asp

Page 16: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">

<xsd:element name="ID" minOccurs="1" od:jetType="text“ od:sqlSType="nvarchar" od:nonNullable="yes"> <xsd:simpleType> <xsd:restriction base="xsd:string">  <xsd:maxLength value="9" />   </xsd:restriction>  </xsd:simpleType>  </xsd:element></xs:schema>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:od="urn:schemas-microsoft-com:officedata">

<xsd:element name="ID" minOccurs="1" od:jetType="text“ od:sqlSType="nvarchar" od:nonNullable="yes"> <xsd:simpleType> <xsd:restriction base="xsd:string">  <xsd:maxLength value="9" />   </xsd:restriction>  </xsd:simpleType>  </xsd:element></xs:schema>

XML Schema ExampleXML Schema Example

Page 17: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

What is XSL?What is XSL?

XSL stands for eXtensible Stylesheet Language

Think of XSL as a set of languages that can:

Transform XML into XHTML

Filter and sort XML data

Define parts of an XML document

Format XML data based on the data value, like displaying negative numbers in red

Output XML data to different media, like web browsers, screens, paper, or voice.

XSL stands for eXtensible Stylesheet Language

Think of XSL as a set of languages that can:

Transform XML into XHTML

Filter and sort XML data

Define parts of an XML document

Format XML data based on the data value, like displaying negative numbers in red

Output XML data to different media, like web browsers, screens, paper, or voice.

W3C: http://www.w3schools.com/xsl/xsl_languages.asp

Page 18: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/"> <html> <body> <strong>Student Record</strong> <br /> <br /> <xsl:value-of select="Student/First-Name" /> <xsl:value-of select="Student/Last-Name" /> <br /> <xsl:value-of select="Student/Street" /> <br /> <xsl:value-of select="Student/City" />, <xsl:value-of select="Student/State" /> <xsl:value-of select="Student/Zip-Code" /> <br /> <xsl:value-of select="Student/Age" /> </body> </html> </xsl:template></xsl:stylesheet>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/"> <html> <body> <strong>Student Record</strong> <br /> <br /> <xsl:value-of select="Student/First-Name" /> <xsl:value-of select="Student/Last-Name" /> <br /> <xsl:value-of select="Student/Street" /> <br /> <xsl:value-of select="Student/City" />, <xsl:value-of select="Student/State" /> <xsl:value-of select="Student/Zip-Code" /> <br /> <xsl:value-of select="Student/Age" /> </body> </html> </xsl:template></xsl:stylesheet>

XSL ExampleXSL Example

Page 19: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

XMLDocument

XML WorkflowsXML Workflows

DatabaseText or

XML Editor

SchemaValidation

StylesheetTransformation

XMLDocument

PrintDocument

WebBrowser

DatabaseXMLApplication

Page 20: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

XMLDocument

XML Workflow ExampleXML Workflow Example

Database

ASP.NET

XSLStylesheet

WebBrowser

Page 21: Demystifying the eXtensible Markup Language Nick Roberts & Jim Few

Questions?Questions?

Comments?Comments?

Angry Outbursts?Angry Outbursts?

The EndThe End

http://ir.kennesaw.eduhttp://ir.kennesaw.edu