WHAT THE HELL IS XML?. What the Hell is XML? What the hell is XML? Markup Language Derived from...

9
WHAT THE HELL IS XML?

Transcript of WHAT THE HELL IS XML?. What the Hell is XML? What the hell is XML? Markup Language Derived from...

Page 1: WHAT THE HELL IS XML?. What the Hell is XML? What the hell is XML?  Markup Language  Derived from SGML (Standardized General Markup Language)  Describes.

WHAT THE HELL IS XML?

Page 2: WHAT THE HELL IS XML?. What the Hell is XML? What the hell is XML?  Markup Language  Derived from SGML (Standardized General Markup Language)  Describes.

What the Hell is XML?

What the hell is XML?

Markup Language Derived from SGML (Standardized

General Markup Language) Describes the CONTENT (stylesheet

has to be applied to format content) Structured documents, can be used

like a database that you can send to your clients/suppliers

They can then use the data in any XML-supporting database/app

Page 3: WHAT THE HELL IS XML?. What the Hell is XML? What the hell is XML?  Markup Language  Derived from SGML (Standardized General Markup Language)  Describes.

What the Hell is XML?

Like HTML?Like HTML?

Both based on SGML Both use tags < … > In both, tags enclose content.. <TAGNAME>..content..</TAGNAME> In both, tags have attributes..

<TAGNAME ATTRIBUTENAME=“attributevalue”>

Page 4: WHAT THE HELL IS XML?. What the Hell is XML? What the hell is XML?  Markup Language  Derived from SGML (Standardized General Markup Language)  Describes.

What the Hell is XML?

Like HTML?Like HTML?

XML MUST have closing tags <P>This is a paragraph <P>This is invalid in XML

MUST have quotation marks around attributes <FONT SIZE=9>No quotes</FONT>

CaSE senSiTivE! <CaSE>This will not close</CASE>

XML has a strict syntax Documents must be well-formed! XML documents must start with an xml tag..

<?xml version=“1.0” standalone=“yes” ?>

Page 5: WHAT THE HELL IS XML?. What the Hell is XML? What the hell is XML?  Markup Language  Derived from SGML (Standardized General Markup Language)  Describes.

What the Hell is XML?

Object ModellingObject Modelling

<APOGEE> <EMPLOYEE> <NAME>Irfan</NAME> <PHONE>770-980-0099</PHONE> </EMPLOYEE> <EMPLOYEE> <NAME>Michelle</NAME> <PHONE>678-357-3661</PHONE> </EMPLOYEE> </APOGEE>

In a database, Apogee would be the database name, Employee would be the Table, Name and Phone would be columns

In object models, Employee would be the object, Name and Phone would be Properties

Page 6: WHAT THE HELL IS XML?. What the Hell is XML? What the hell is XML?  Markup Language  Derived from SGML (Standardized General Markup Language)  Describes.

What the Hell is XML?

AttributesAttributes

<APOGEE> <EMPLOYEE role=“programmer”> <NAME>Irfan</NAME> <PHONE type=“home”>678-981-0193</PHONE> <PHONE type=“cell”>770-980-0099</PHONE> </EMPLOYEE> <EMPLOYEE role=“director”> <NAME>Joel</NAME> <PHONE type=“cell”>678-357-3661</PHONE> </EMPLOYEE> </APOGEE>

Debate over when to use attributes and when to use elements MS XML tends to use attributes by default (faster to process?) Standard XML used elements more

Page 7: WHAT THE HELL IS XML?. What the Hell is XML? What the hell is XML?  Markup Language  Derived from SGML (Standardized General Markup Language)  Describes.

What the Hell is XML?

XML – The RulesXML – The Rules

Document Type Definitions (DTDs) Give the rules for validating documents A bit like a database schema/object model Describes the rules of the structure

• Relationships between elements (e.g. one to many)• Which elements contain which other elements• In Backus Naur Form (BNF) – obscure?

XML Schemas For a similar purpose to DTDs Are taking over from DTDs Are expressed in XML

• <xsd:schema>…</xsd:schema>

Page 8: WHAT THE HELL IS XML?. What the Hell is XML? What the hell is XML?  Markup Language  Derived from SGML (Standardized General Markup Language)  Describes.

What the Hell is XML?

XML – The RulesXML – The Rules

Referencing a DTD <!DOCTYPE DOCUMENT PUBLIC “-//W3C//DTD HTML

4.0//EN” “http://www.w3.org/TR/REC-html/strict.dtd”> The above is the strict DTD for DHTML (HTML 4)

Page 9: WHAT THE HELL IS XML?. What the Hell is XML? What the hell is XML?  Markup Language  Derived from SGML (Standardized General Markup Language)  Describes.

What the Hell is XML?

XML EditorsXML Editors

Schema Editors Some allow you to turn a DTD into a schema XML Spy Turbo XML

Schema Verifiers Only check the doc is well formed Expat http://www.jclark.com/xml/expat.html

Schema Validator World Wide Web Consortium

• http://www.w3.org/2000/09/webdata/xsv XML Parser

Xerces Java http://xml.apache.org/xerces-j/