+ All Categories
Home > Documents > XML Overview

XML Overview

Date post: 21-Mar-2016
Category:
Upload: thina
View: 31 times
Download: 0 times
Share this document with a friend
Description:
XML Overview. Introduction to XML for the MultiValue Developer. Why are we here?. XML is the post-SQL database environment. MultiValue developers are starting to integrate to data in this format To understand the document structure of XML files To know how XML is used - PowerPoint PPT Presentation
35
eagle rock information systems 199 So Los Robles, Suite 860, Pasadena, CA 91101 USA 626-535-9658 www.eriscorp.com XML Overview Introduction to XML for the MultiValue Developer
Transcript
Page 1: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

XML Overview

Introduction to XML for the MultiValue Developer

Page 2: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Why are we here?

• XML is the post-SQL database environment.• MultiValue developers are starting to

integrate to data in this format• To understand the document structure of

XML files• To know how XML is used • To see how it relates to MultiValue systems.• To add more buzzwords on your resume

Page 3: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

eris

• Database to Web integration since 1992• Customers with up to $2 Billion in annual revenue• Clients throughout North America• Education, Medical, Manufacturing, EDI,

Distribution, Sales Force Automation, Help Desk, and Reporting Systems

• e-Commerce and database product development, e.g., WebWizard, DataReady, mv://e-Store

• Los Angeles and Chicago offices

Page 4: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Agenda

• About eris• What is XML?• How is XML used?• Integration with MultiValue• Syntax• Advanced Issues

Page 5: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

What is XML?

XML is a cross-platform,software and hardware independent tool

for transmitting information

Page 6: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Main XML Features

• Like HTML, it's just ordinary ASCII text• It’s an Extensible Markup Language• Resembles HTML, but does not replace HTML• Delivers or describes data• It doesn't PERFORM anything• Unlike HTML, there are no standard tags.• Advanced XML users deploy Document Type

Definition (DTD) and/or XML Schema• DTD and Schema resemble MultiValue dictionaries• Can be viewed using browsers

Page 7: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

How is XML used?

• For web developers, it separates web pages from the data in the web pages

• For interdependent companies, it allows data to be exchanged between incompatible databases

• For interdependent software programs, it allows data to be exchanged between software packages

• For interdependent companies on the internet, it's the primary language for B2B

Page 8: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Other uses for XML

• XML can be used as a database directly• XML has been extended into WAP and WML

Page 9: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Syntax

• Requirements• Elements• Attributes• Validation

Page 10: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Example XML Document<?xml version="1.0" encoding="ISO-8859-1"?><note><to>Monica</to><from>Gus</from><subject>See you soon</subject><delivery date="sent">September 21, 2004</delivery>

<body>Do you want to grab a drink after the Spectrum show?</body>

</note>

Page 11: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

This line is a given

<?xml version="1.0" encoding="ISO-8859-1"?>

<note><to>Monica</to><from>Gus</from><subject>See you soon</subject><delivery date="sent">September 21, 2004</delivery>

<body>Do you want to grab a drink after the Spectrum show?</body>

</note>

Page 12: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

A new element called “note”<?xml version="1.0" encoding="ISO-8859-1"?>

<note><to>Monica</to><from>Gus</from><subject>See you soon</subject><delivery date="sent">September 21, 2004</delivery>

<body>Do you want to grab a drink after the Spectrum show?</body>

</note>

Page 13: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

5 elements that belong to note<?xml version="1.0" encoding="ISO-8859-1"?><note>

<to>Monica</to><from>Mel</from><subject>See you soon</subject><delivery date="sent">September 21, 2004</delivery>

<body>Do you want to grab a drink after the Spectrum show?</body>

</note>

Page 14: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

The end of the note tag<?xml version="1.0" encoding="ISO-8859-1"?><note><to>Monica</to><from>Gus</from><subject>See you soon</subject><delivery date="sent">September 21, 2004</delivery>

<body>Do you want to grab a drink after the Spectrum show?</body>

</note>

Page 15: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Requirements

• Unlike HTML, closing tags are required• Unlike HTML, the tags are case sensitive• Unlike HTML, the tags can nest but must

nest themselves correctly• Unlike HTML, space characters are not

ignored

Page 16: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

More Requirements

• XML documents require a root element• Descriptive attributes need quotation marks

(double or single)• <!-- Comments are similar to HTML -->

Page 17: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Elements

• Programs that deal with XML pay attention to only the element tags they care about

• For example, programs that pay attention to just "to" and "body" can ignore "from", "subject" and "delivery"

Page 18: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Element Relationships

• Parent• Child• Siblings

Page 19: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

<?xml version="1.0" encoding="ISO-8859-1"?><spectrum>

<location id="UK">London<when day="23" month="09" year="2004"></when>

</location><location id="AU">Sydney

<when day="13" month="10" year="2004"></when></location><talk>Introduction to XML

<topic>What is XML</topic><topic>XML Syntax</topic>

</talk><talk>Introduction to SQL

<topic>SQL versus Multi-Value</topic><topic>Popular SQL databases</topic>

</talk></spectrum>

Another Example

Page 20: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

The Element jargon continues

• element content - <spectrum>• simple or text content - <topic>• mixed content - <talk> and <location>• empty content - <when>• attributes - month and year• values for the attributes - "09", "10" and

"2004"

Page 21: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Element – Naming Rules

• Names can contain letters, numbers, and other characters (except spaces and colons)

• Names must begin with a letter• Names must not begin with the letters "XML"

in any case combination• Suggestions

– Don't use periods or hyphens– Keep them simple but descriptive– Try to use names similar to how the data– Perhaps use underscores instead of periods

Page 22: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Attributes

[<when day="23" month="09" year="2004"></when>

]

Page 23: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Elements versus Attributes

[<when day="23" month="09" year="2004"></when>]

[<when> <day>23</day> <month>09</month> <year>2004</year></when>]

Page 24: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Why Avoid Attributes?

• Might be obvious for MultiValue developers– They cannot contain multiple values (child

elements can)– They are not easily expandable (for future

changes)– They cannot nest– Document Type Definition have a harder time

validating attributes

Page 25: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Imagine the following bad attribute situation

<?xml version="1.0" encoding="ISO-8859-1"?><note to="Monica" from=“Mel" subject="See you soon" delivery_day="23" delivery_month="09" delivery_year="2004" body="Do you want to grab a drink after the Spectrum show?"

</note>

Page 26: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

When attributes make sense:Describing the element, not the data

<location id="UK">London<when day="23" month="09" year="2004"></when>

</location>

<location id="AU">Sydney<when day="13" month="10" year="2004"></when>

</location>

Page 27: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Advanced Issue: Validation

• Valid documents have rules that they can be compared against

• Documents that have any errors whatsoever are supposed to be rejected

Page 28: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Example for validation<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE note SYSTEM "note.dtd"><note to="Monica" from=“Mel" subject="See you soon" delivery_day="23" delivery_month="09" delivery_year="2004" body="Do you want to grab a drink after the Spectrum show?"

</note>

Page 29: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Two types of advanced XML design

• Document Type Definition (DTD) allows you to create a validation– Internal Definition– External Definition

• Schemas allow you to create validations and database structures

Page 30: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

DTD Syntax

• Internal

<!DOCTYPE root-element [element-declarations]>

• External

<!DOCTYPE root-element SYSTEM "filename">

Page 31: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Example of an Internal DTD<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE note [ <!ELEMENT note (to,from,subject,delivery,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT subject (#PCDATA)> <!ELEMENT delivery (#PCDATA)> <!ELEMENT body (#PCDATA)>]><note><to>Monica</to><from>Mel</from><subject>See you soon</subject><delivery date="sent">September 21, 2004</delivery><body>Do you want to grab a drink after the Spectrum show?</body></note>

Page 32: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Example of an External DTD<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE note SYSTEM "http://somewhere.com/note.dtd"

><note><to>Monica</to><from>Mel</from><subject>See you soon</subject><delivery date="sent">September 21, 2004</delivery>

<body>Do you want to grab a drink after the Spectrum show?</body>

</note>

Page 33: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Sample Product Catalog (Page 1 of 2)<!DOCTYPE CATALOG [

<!ENTITY AUTHOR "John Doe"><!ENTITY COMPANY "JD Power Tools, Inc."><!ENTITY EMAIL "[email protected]">

<!ELEMENT CATALOG (PRODUCT+)><!ELEMENT NOTES (#PCDATA)>

<!ELEMENT PRODUCT (SPECIFICATIONS+,OPTIONS?,PRICE+,NOTES?)><!ATTLIST PRODUCTNAME CDATA #IMPLIEDCATEGORY (HandTool|Table|Shop-Professional) "HandTool"PARTNUM CDATA #IMPLIEDPLANT (Pittsburgh|Milwaukee|Chicago) "Chicago"INVENTORY (InStock|Backordered|Discontinued) "InStock">

Page 34: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Sample Product Catalog (Page 2 of 2)<!ELEMENT SPECIFICATIONS (#PCDATA)><!ATTLIST SPECIFICATIONSWEIGHT CDATA #IMPLIEDPOWER CDATA #IMPLIED>

<!ELEMENT OPTIONS (#PCDATA)><!ATTLIST OPTIONSFINISH (Metal|Polished|Matte) "Matte" ADAPTER (Included|Optional|NotApplicable) "Included"CASE (HardShell|Soft|NotApplicable) "HardShell">

<!ELEMENT PRICE (#PCDATA)><!ATTLIST PRICEMSRP CDATA #IMPLIEDWHOLESALE CDATA #IMPLIEDSTREET CDATA #IMPLIEDSHIPPING CDATA #IMPLIED>]>

Page 35: XML Overview

eagle rock information systems199 So Los Robles, Suite 860, Pasadena, CA 91101 USA

626-535-9658www.eriscorp.com

Contact usMain Office: 199 S. Los Robles Ave, Suite 860

Pasadena, CA 91101Tel: (626) 535-9658 Fax: (626) 628-3229

www.eriscorp.cominfo @ eriscorp.com


Recommended