Sei sulla pagina 1di 7

XML

XML = Extensible Markup Language


tag based
Define data in a format that is machine AND
human readable
Fully portable
Independent of platform (e.g., Windows/Unix/Palm)
Independent of language (e.g., Java, C++, VB)

fileName.xml

<studentBill>
<billingDate>2003-12-1</billingDate>
<billingPeriod>
<startBillingPeriod>2003-11-1</startBillingPeriod>
<endBillingPeriod>2003-11-30</endBillingPeriod>
</billingPeriod>
<dueDate>2003-12-15</dueDate>
<currentBalance>120.45</currentBalance>
<lineItem>
<amt>870.20</amt>
<desc>Bookstore purchase</desc>
<transDate>2003-11-4</transDate>
<payeeName>Princeton U-Store</payeeName>
<payeeAcct>000987345</payeeAcct>
</lineItem>
<lineItem>
<amt>50.00</amt>
<desc>Student Union Dues Nov 2003</desc>
<transDate>2003-11-1</transDate>
<payeeAcct>ust001</payeeAcct>
</lineItem>
</studentBill>

An XML document

Meta data
An XML document holds the data. We also need a
way to describe how the data is laid out in that
document. What structures are allowed, what is
not allowed. This is so we can validate the xml
document.
This is called a Schema. There are 2 schema
languages:
DTD (Document Type Definition)
XML Schema

<!ELEMENT studentBill (billingDate, billingPeriod, dueDate,


currentBalance, lineItem*)>
<!ELEMENT billingPeriod (startBillingPeriod, endBillingPeriod) >
<!ELEMENT startBillingPeriod (#PCDATA) >
<!ELEMENT endBillingPeriod (#PCDATA) >
<!ELEMENT billingDate (#PCDATA) >
An XML Schema
<!ELEMENT dueDate (#PCDATA) >
described in DTD
<!ELEMENT currentBalance (#PCDATA) >
<!ELEMENT lineItem (amt, desc, transDate, payeeName, payeeAcct) >
<!ELEMENT amt(#PCDATA) >
<!ELEMENT desc(#PCDATA) >
<!ELEMENT transDate(#PCDATA) >
<!ELEMENT payeeName?(#PCDATA) >
<!ELEMENT payeeAcct(#PCDATA) >

So what?
XML documents are great at enabling system
integration
XML files are self describing, they are better than
regular flat files (think: flat files +)
If 2 systems agree on an XML schema, they can
easily share data
Even better, have all of the systems within an
enterprise (e.g., a school) agree upon a schema so
they all can share
student.dtd

How do these XML documents get shared?


WEB SERVICES

Web Services
What is a Web Service?
A discreet piece of functionality (a services) that is
available via the web (via the HTTP protocol)
Input XML file
Output XML file

Any software that can talk HTTP and handle XML


files can participate in a web service
It is platform and language independent!
Usually used when some application wants to call
on the service of another application
Typically not for direct user interaction

Web Service Example


Student Portal

Transcript.xm
l

Student Transcript
Web Service

Scholarship System

The Student Transcript service provides a students transcript


in XML format (agreed upon by everyone in the university)
other systems can now get that transcript information and do
whatever they want with it.
Each of these systems can be developed in any language on any
kind of platform.

Potrebbero piacerti anche