Top Banner
XML and Enterprise Computing
26

XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

Dec 14, 2015

Download

Documents

Micah Wen
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

XML and Enterprise Computing

Page 2: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

What is XML?

• Stands for “Extensible Markup Language”– similar to SGML and HTML– document “tags” are used to define content not

just formatting– can be defined for individual industries

• Allows e-commerce applications to publish databases to Web more easily– merging of relational, O-O, and XML models

Page 3: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

What is meant by a “document”?

• A form of presentation– paper, browser screen, voice, etc.

• Structure and organization of elements– memo, contract, recipe, etc.

• Informational content– text and numbers organized in relation to each

other

Page 4: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

Relationship Among Markup Languages

SGML

HTML

XML

Page 5: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

What are some current XML applications?

• On-line banking

• Push technology

• Web automation

• Database Publishing

• Software Distribution

Page 6: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

Some sample HTML<!-- snippet of HTML -->

<h1>Personal Computers For Sale</h1>

<h2>Maker: Acme PC Inc.</h2>

<h3>Model: Blaster 555</h3>

<table border = 1>

<tr>

<td>Storage:</td>

</tr>

<tr>

<td>RAM<td>72 MB</td>

<tr>

<td>Hard Disk</td><td>2 GB</td>

</tr>

</table>

Page 7: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

XML Sample

<!--Snippet of an XML Document -->

<PcForSale>

<Make>Acme PC Inc</Maker>

<Model>Blaster 555</Model>

<Storage>

<Ram Units = “MB”>72</Ram>

<HardDisk Unites = “GB”>2</HardDisk>

</Storage>

</PcForSale>

Page 8: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

How is XML Presented?

• XML includes a DTD (Document Type Definitions)– lists the element types and the order you are

allowing them to occur– XML parser tests to see them are valid DTDs

• XSL (XML Style Language)– similar to cascading style sheets– contain presentation information

Page 9: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.
Page 10: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.
Page 11: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.
Page 12: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

Another Example

• Convert a business card into an XML document– start with representative XML content– define DTD elements

Page 13: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

XML Rules

• Open and close tags define “elements” and each element must have a closing tag (except for “empty” elements)

• Elements appear in a strict hierarchy; upper elements are parents of lower “child” elements.

• DTD is not mandatory but it ensures two parties define a docement’s contents the same.– DTDs constrain the data, the hierarchy of

content, and the number of times it may appear

Page 14: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

XML Rules (cont.)• Elements

– XML is case sensitive– must have 1 and only 1 “root” element– elements consist of an “element name” and “element

content”– element content may consist of character or other data or

even other elements embedded– an XML schema or “tree” describes hierarchy of

elements– empty elements are indicated by a trailing backslash

Page 15: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

Well-Formed XML Documents

• Have one root element

• All non-empty elements have start and stop tags that match exactly

• All empty elements have correct trailing slash

• Elements are strictly nested with no overlapping elements

Page 16: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

Attributes• Allow designer to add richer metadata to elements• Consist of attribute name and attribute value

– attribute values are bounded by quotes

– can specify as many attributes for each element as you want

– some authors use UC text for attribute names to easily distinguish

<addresses>

<address ADDTYPE=“shipto”

<firstname>Robert</firstname>

………

</address>

</addresses>

Page 17: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

Defining a DTD• Element declaration begins with “<!ELEMENT”

and ends with >– this contains an element name and content model

surrounded by parentheses

– elements can contain data or other elements or be empty

• to indicate it contains data we use (#PCDATA)

• if it contains other elements we list them in brackets (name, title, address, etc)

• empty elements use the key word “EMPTY”

Page 18: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

Further DTD Specifications• Designer can specify the number of times an element may

appear

– “?” means it may occur 0 or 1 times in document

– “*” means it may occur 0 or more times

– “+” means it may appear 1 or more times

– can enumerate possible alternative with “|”

– can specify an attribute is required with #REQUIRED

– #IMPLIED means attribute may not have a value

Page 19: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

Try another example

• Think of your resume, posted say on Monster.com– What does html for this look like?

• Write your resume in XML????– What is the “root” element?

• Why would this be valuable?

Page 20: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

Another Example

• Creating an “order” in XML– include a “prolog”of XML document

• header information before root element

• may include processing instructions and DTD declaration

ex. <?xml version=“1.0”?>

<!DOCTYPE order SYSTEM “order.dtd”>

• may include comments in prolog or after– start with <!- and end with ->

Page 21: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.
Page 22: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.
Page 23: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.
Page 24: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.
Page 25: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

XML Document

XML

DTD

XML

Processor

XML

App

Page 26: XML and Enterprise Computing. What is XML? Stands for “Extensible Markup Language” –similar to SGML and HTML –document “tags” are used to define content.

Some XML Processors

• Processors are either “validating” or “non-validating”

• Msxml– developed by MS Corp. Java and ActiveX versions

• Aelfred– Java-based XML. Microstar Corp.

• XP– Java-based XML processor by James Clark