XML Technologies Getting data to play nice with other data.

15
XML Technologies Getting data to play nice with other data

Transcript of XML Technologies Getting data to play nice with other data.

XML Technologies

Getting data to play nice with other data

Introduction

Enormous amount of topics and subtopics

Standards Popular and

important implementations of XML

Concentrate on XML Data- highly structured side of XML

XML Data

What is it What can it do Creation Validation Presentation

XML Data

What is it? XML identifies

structure Helps give

meaning to data

Glue that binds many applications together

Way of representing information as text documents

<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="license.xsl"?><license uniqueid="105"> <lictitle>Nurse, Registered</lictitle> <licdesc>Registered Nurses (RNs) administer general nursing care which includes assessing, planning, providing, delegating, teaching, and supervising care which promotes optimum health and independence for ill, injured, and well persons. They give prescribed medications and treatments, and may supervise other nursing personnel. </licdesc> <auth-statute>ORS 678.010 to 678.135</auth-statute> <soc> <soccode>291111</soccode> </soc> <cip> <cipcode>511601</cipcode> <cipcode>511602</cipcode> <cipcode>511603</cipcode>

<cipcode>511604</cipcode><cipcode>511605</cipcode><cipcode>010606</cipcode><cipcode>511606</cipcode><cipcode>511607</cipcode><cipcode>511608</cipcode><cipcode>511609</cipcode><cipcode>511610</cipcode><cipcode>511611</cipcode><cipcode>511612</cipcode>

</cip> <lic-requirements> <requirement>Be able to read and write legibly</requirement> <requirement>Be at least 18 years of age</requirement> <requirement>Be free of communicable diseases</requirement> </lic-requirements> <fees> <exam-fee>$120</exam-fee> <original-license-fee>$80</original-license-fee> <renewal-fee>$65</renewal-fee> </fees> <number-of-licenses>277</number-of-licenses></license>

XML Data What can it do?

Move data around Way to make the data platform independent Kind of like an executive summary or an

outline- Can pull data from multiple sources (even tables in a database) into a human readable, ordered

Represent data in a hierarchy Data Centric XML vs. Document Centric XML Relational databases store data in normalized tables XML documents can be created from Relational Database

queries XML documents can be stored in Relational Databases

Native XML Databases also available Relational Databases with native XML support

Text Editor (Notepad)

XML Data

Creating XML Data Any tags be used XML defines a

rigid set of rules for the syntax of markup tags

Text editor XML Tools Databases And More

XML Spy Home Edition

Exporting from Access 2003

XML Data

Validating XML Data DTD, Schema Elements are nested,

attributes they can have and values they can contain

The names of tags and how they are used is left up to the user or application and can be enforced by:

Document Type Definitions (DTDs)

XML Schema Other Alternatives:

Relax NG etc.

<!ELEMENT license (lictitle, licdesc, number-of-licenses?, places-of-employment?, auth-statute?, lic-requirements?, fees?, exam?, licensing-agency?, cistitle?, dot?, soc?, cip?)><!ATTLIST license uniqueid ID #REQUIRED><!ELEMENT lictitle (#PCDATA)><!ELEMENT licdesc (#PCDATA)><!ELEMENT number-of-licenses (#PCDATA)><!ELEMENT places-of-employment (#PCDATA)><!ELEMENT auth-statute (#PCDATA)>

DTD

<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"><xs:element name="license"> <xs:complexType> <xs:sequence> <xs:element ref="lictitle"/> <xs:element ref="licdesc"/>

<xs:element minOccurs="0" ref="number-of-licenses"/><xs:element minOccurs="0" ref="places-of-employment"/><xs:element minOccurs="0" ref="auth-statute"/><xs:element minOccurs="0" ref="lic-requirements"/><xs:element minOccurs="0" ref="fees"/><xs:element minOccurs="0" ref="exam"/><xs:element minOccurs="0" ref="licensing-agency"/><xs:element minOccurs="0" ref="cistitle"/><xs:element minOccurs="0" ref="dot"/><xs:element minOccurs="0" ref="soc"/><xs:element minOccurs="0" ref="cip"/>

</xs:sequence> <xs:attribute name="uniqueid" type="xs:ID" use="required"/> </xs:complexType></xs:element>

Schema

XML Data

Displaying XML Data on the Web Cascading Style Sheets

(CSS), simple, preferred choice (non XML structure)

Extensible Style Sheet Language (XSL), more complex formatting (XML structure)

These two technologies can be used as alternative methods of formatting an XML document or they can work together

Examples CSS XSL

/* license xml casstyle sheet */license {font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 11pt; margin-top: 12pt; margin-left: 12pt; margin-bottom: 4pt}

lictitle, licdesc, number-of-licenses, places-of-employment, auth-statute, lic-requirements, fees, exam-fee, original-license-fee, renewal-fee, exam, licensing-agency, cistitle, dot, soc, cip {display: block; font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 11pt; margin-top: 12pt; margin-left: 12pt; margin-bottom: 4pt}auth-statute:before {content: "Authorizing Statue: "; font-weight:bold;}soc:before {content: "SOC Codes: "; font-weight:bold;}dot:before {content: "DOT Codes: "; font-weight:bold;}cip:before {content: "CIP Codes: "; font-weight:bold;}lictitle {display: block; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 20px; font-weight: bold; color: #336600; padding-top: 35px; text-align:center; margin-top: 12pt;

CSS

<?xml version='1.0'?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <HTML> <STYLE> dd {text-align: center} body {font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 11pt;} .title { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 20px; font-weight: bold; color: #336699; padding-top: 35px; } </STYLE> <BODY> <center class="title"><xsl:value-of select="license/lictitle"/></center> <br/>

<p><xsl:value-of select="license/licdesc"/></p> <p><b>Authorizing Statute: </b> <xsl:value-of select="license/auth-statute"/></p> <p><b>SOC Codes: </b> <xsl:for-each select="license/soc/soccode"> <xsl:if test="position() > 1">,</xsl:if> &#160; <xsl:value-of select="."/> </xsl:for-each> </p>

XSL

XML Data Applications

Information Sharing (RSS, ATOM, RDF) Data Sharing (Namespaces and XSLT) Application Integration (Web Services) Information Aggregation (MS Office) Data Integration (XML and Databases)

XML Data Applications

Information Syndication Federal

government using RSS

State government using RSS

Growing number of users consuming RSS

CensusOregon

SharpReader

XML Data Applications

Data Sharing Delivery of structured

information that can be manipulated

Namespaces distinguish different

elements and attributes that have the same name but different meaning

groups all the elements and attributes together

XSLT to translate one XML format to another

<licensexmlns:22=“http://www.almisdb.org/ns/

license21/1.5”xmlns:23=“http://www.almisdb.org/ns/

license23/1.0”>

Namespaces

<xsl:stylesheet xmlns: xsl=“http://www.w3.org/1999/XSL/Transform”

version=“1.0”><xsl:template match=“lictitle”><xsl:apply-templates/></xsl:template></xsl:stylesheet>

XSLT

XML Data Applications

Application Integration Web Services

Key components- XML, HTTP, SOAP, WSDL, UDDI

still at early stages EXCEPT for RSS

Major chunks Building web services i.e. I

have one Publishing web services

i.e. I want one Or I want to let others know I have one

Consuming Web Services i.e. I get oneIf computers get too

powerful, we can organize them into a committee -- that will do them in. Bradley's Bromide

Building

Publishing

XML Data Applications

Data Integration XML and

databases Data residing in

different platforms Customized data

formats Desired information

normally resides in multiple databases

Even can span across states

Xquery/Xpath View raw results

with a browser

Import Access

XML Data Applications

Information Aggregation XML and MS

Office Share data across

software applications including desktop applications

View raw results with a browser

XML

Web Services

XML Technology Watch Top 5 things to watch for as relate to XML Data

Semantic Web What it is: Way to give full meaning to XML elements using

inheritance relationships Reason to watch: W3C project, Make better searching for relevant

information

RDF What it is: Way to describe resources especially Web documents and

sites Reason to watch: W3C project, Representing normalized data, (Xml topic

maps) capture a lot of basic infrastructure for data, Support is growing

Web Ontologies (OWL) What it is: Means of representing complex information Reason to watch: More detail on relationships than RDF, can express

cardinality restraints

XQuery What it is: Uses SQL-like query language, combined with XPATH

expressions for querying XML documents Reason to watch: Full query and reporting from XML documents, May

replace primitive searching and querying of XML done by XSLT

MetaData What it is: information that describes data Reason to watch: Gives meaning to data, consistent way to work with vast

amount of data, foundation for contextual searching