2005年11月18日 星期五

11-18-2005 Homework

LAB XSLT
reference: XML

12-02-2005 XML

XML
LAB XSLT
Lab XSLT II


sample XML file

[weather type="Current conditions"]
[temp]76[/temp]
[wind]5[/wind]
[/weather]

sample XSLT file

[xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"]

[xsl:template match="weather"]
[H1][xsl:value-of select="@type"/][/H1]
[xsl:apply-templates/]
[HR/]
[/xsl:template]

[xsl:template match="temp"]
[LI]Temperature [xsl:apply-templates/]°F[/LI]
[/xsl:template]

[xsl:template match="wind"]
[LI]Wind [xsl:apply-templates/]mph[/LI]
[/xsl:template]

[xsl:template match="text()"]
[xsl:value-of select="."/]
[/xsl:template]

[/xsl:stylesheet]

2005年11月14日 星期一

11-18-2005 HTML and CGI Form

HTML and CGI Form
XML

Web Services

References: Web Service

Extensive list
of web services

Examples
1. find the best rate of USD remission
2. Zip Code
key=eUhOTOJs9D2mcHU6SiL0CyMQvpJ3I3PqR2/fpRq4BOApWxzSzw7wD2FQ2mOmHEk+pq6iRBomQ4wuQl5EGOgfCitYgkQ3N4vl
3. Stock Quote

4. purchase a Hawaii tour with ait tkts, hotel, car rental and golf course


What is SOAP?

SOAP is the Simple Object Access Protocol. It is used for information exchange and RPC, usually (but not necessarily) over HTTP. More information can be found at:

Developmentor SOAP FAQ: http://www.soaprpc.com/faqs/SoapFAQ.html

W3C specifications: http://www.w3.org/TR/SOAP/



What is WSDL?

WSDL is the Web Service Description Language. It provides a formal description of a web service, much like CORBA's IDL. The WSDL file is all you need to know how to call the web service; toolkits can generate proxy code from a WSDL file directly. The official WSDL definition is at http://www.w3.org/TR/wsdl.

Lab Web Services: Test drive a web service with XML.

Lab Google Search Web Service

"nothing builds self-esteem and self-confidence like accomplishment"

Explore Google search web service.

Developers write software programs that connect remotely to the Google Web APIs service. Communication is performed via the Simple Object Access Protocol (SOAP), an XML-based mechanism for exchanging typed information.

If you have questions, you can check into FAQ.

1. Take a close look at Web Service Description Language (WSDL 1.1) description of interface for Google searching

2. Download the web service API of Google search at http://www.google.com/apis/download.html
The download package includes
com.google.soap.search.*;
Google's own Java wrapper for the API SOAP calls
JAF 1.0.1 (activation.jar)

3. You need to create an account at Google to use the web service. Be sure to have an email box to receive the license key.
If you don't, just use this one nQ4ETIdQFHKlGxLZjj+2c8klYflwDzoK

4. Open the DOS command window and prepare to run Java.
Usage:
java -cp googleapi.jar com.google.soap.search.GoogleAPIDemo [key] search Foo

Where [key] is your registration key and Foo is the item you wish to
search for.

5. Take a close look at the XML output, which is the result of your search.

Lab Web Services

"we make a living by what we get, we make a life by what we give"

Test Drive a web service
1. Take a look at the schema of Zip Code Web Service.
2. Use the lincense key eUhOTOJs9D2mcHU6SiL0CyMQvpJ3I3PqR2/fpRq4BOApWxzSzw7wD2FQ2mOmHEk+pq6iRBomQ4wuQl5EGOgfCitYgkQ3N4vl
to use this web service or subsbcribe to it at Zip codes lookup To apply for the license key by yourselves, be sure to have an email box to receive it.
2. Click GetPlacesInside and play with this operation
3. Enter 61801 as zip code and see what you get in the result.
4. Try again 92345 as zip code. Based on
the method of Lab XSLT,
write an XSLT and transform the result XML into an HTML.

Question: Why do you need a license key to use the service?

Lab Form and Action

"logic will get you from A to B - imagination will take you anywhere"

How to use Form to invoke a remote service through CGI.

1. Copy the search box of this search page,
inlcuding radio buttons, text input, and submit button.
2. Open your Nvu HTML editor.
3. Open a new empty HTML file.
4. Paste the search box into this new file.

5. Add a Form to this search box.

6. Set Action="http://google.com/search" and name of Form as "f" and method as "get"
(See Hint if it does not work.)
7. Run your HTML by Firefox. What do you get?

8. Set method as "post"
9. Run your HTML by Firefox. What do you get?

HTML, CGI Form

"tell me and I'll forget; show me and I may remember; involve me and I'll understand"

CGI
(page 188~193 of Text)

Lab Form and Action: Using HTML Form




Lab XSLT

1. Register and Download Xray, an XML, XSLT editor and processor.

2. Given the the XML file and XSLT file ,
use Xray to do the transformation of the XML into HTML.
You have to replace [ with <.

3. View the formatted HTML file.

XML

Take a look at islandwide temperatures of Taiwan.

What happens if you just want Taoyuan's temperature?

If you want to include Taoyuan's temperature in your Theme
Park homepage, is there any solution?

XML examples:

the need of XML

  • Separation of data from data processor
  • Seperation of data from presentation
    • HTML for machine-human interaction
    • XML can be formatted to HTML according to formartting rules called XSLT. To see it, do Lab XSLT.

  • Automation of data flow across various business systems
    • XML for machine-machine interaction
    • Without human involvement, automation of business systems can be accelerated.

    Lab XSLT: Apply an XML style sheet to generate an HTML file from XML.

    2005年11月5日 星期六

    11-04-2005 Homework

    1. Find 10 websites which are web accessible using Freego or web tool at http://enable.nat.gov.tw
    (references from http://enable.nat.gov.tw)

    2. Reading Assignments

    CGI
    (page 188~193 of Text)

    Understanding XML
    (page 187~188 of Text)

    3. Bring the Textbook on 11-18-2005.