Questo caso studio dimostra come costruire applicazioni Internet utilizzando AppML.
Parte I: Accesso ai file Internet
- Accesso a un file di testo
- Accesso a un file XML
- Accesso a un file JSON
Parte II: Accesso ai database Internet
- Listing dati del database
- dati database di filtraggio
- Modifica dei dati del database
AppML Browser e AppML Server
In questo caso di studio, AppML funziona sia nel browser (appml.js) e sul server (appml.php) .
Useremo un web server situato a http://www.w3ii.com .
Tutti i file e database si trovano sul server.
Più avanti in questo tutorial imparerete come simulare un server Web nel browser.
File di testo
Per dimostrare come accedere i file di testo, abbiamo utilizzato file di molto simile a questo:
cd_catalog.txt
Empire Burlesque,Bob Dylan,USA,Columbia,10.90,1985
Hide your heart,Bonnie
Tyler,UK,CBS Records,9.90,1988
Greatest Hits,Dolly
Parton,USA,RCA,9.90,1982
Still got the blues,Gary Moore,UK,Virgin
records,10.20,1990
.
.
Prova tu stesso " I file XML
Per dimostrare come accedere i file XML, abbiamo utilizzato un file molto simile a questo:
cd_catalog.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<PUBLISHED>1985</PUBLISHED>
</CD>
<CD>
<TITLE>Hide your heart</TITLE>
<ARTIST>Bonnie Tyler</ARTIST>
<COUNTRY>UK</COUNTRY>
<COMPANY>CBS Records</COMPANY>
<PRICE>9.90</PRICE>
<PUBLISHED>1988</PUBLISHED>
</CD>
.
.
Prova tu stesso " I file JSON
Per dimostrare come per accedere ai file JSON, abbiamo utilizzato un file molto simile a questo:
cd_catalog.js
{
"cd" : [
{ "title" : "Empire Burlesque", "artist" : "Bob Dylan",
"price" : "10.90" },
{ "title" : "Hide your heart", "artist" :
"Bonnie Tyler", "price" : "9.90" },
{ "title" : "Greatest Hits",
"artist" : "Dolly Parton", "price" : "9.90" },
{ "title" : "Still got
the blues", "artist" : "Gary Moore", "price" : "10.20" },
.
.
Prova tu stesso " Banche dati
Il nostro database di prova contiene diverse tabelle come questo:
Clienti
Cliente | Indirizzo | Città | Nazione |
---|---|---|---|
Intorno al Corno | 120 Hannover Sq. | Londra | UK |
Berglunds snabbkjop | Berguvsvagen 8 | Lulea | Svezia |
Blauer See Delikatessen | Forsterstr. 57 | Mannheim | Germania |
Blondel pere et fils | 24, Place Kleber | Strasburgo | Francia |
preparadas Bolido Comidas | C / Araquil, 67 | Madrid | Spagna |
Mercati Bottom-Dollar | 23 Tsawassen Blvd. | Tsawassen | Canada |
fornitori
Fornitore | Indirizzo | Città | Nazione |
---|---|---|---|
Liquido Exotic | 49 Gilbert S. | Londra | UK |
Nuove Cajun Delights Orleans | PO Box 78934 | new Orleans | Stati Uniti d'America |
Homestead della nonna Kelly | 707 Oxford Rd. | Ann Arbor | Stati Uniti d'America |
Tokyo Traders | 9-8 SekimaiMusashino-shi | Tokyo | Giappone |
Cooperativa de Quesos 'Las Cabras' | Calle del Rosal 4 | Oviedo | Spagna |
Mayumi | 92 Setsuko Chuo-ku | Osaka | Giappone |
Pavlova, Ltd. | 74 Stagni Rose St. Moonie | Melbourne | Australia |
Biscotti di specialità, Ltd. | 29 Way Re | Manchester | UK |
PB Kn ckebr d AB | Kaloadagatan 13 | G teborg | Svezia |
Refrescos Americanas LTDA | Av. Das Americanas 12,890 | S o Paulo | Brasile |
Prodotti
Prodotto | Quantità per unità | Prezzo unitario | Disponibilità in magazzino |
---|---|---|---|
Chai | 10 scatole x 20 sacchetti | 18 | 39 |
Chang | 24 - 12 bottiglie oz | 19 | 17 |
anice Sciroppo | 12 - 550 ml bottiglie | 10 | 13 |
Chai | 10 scatole x 20 sacchetti | 18 | 39 |
Chef di Anton Gumbo Mix | 36 scatole | 21 | 0 |
Diffusione Boysenberry della nonna | 12 - 8 vasetti oz | 25 | 120 |
Pere secche organici dello zio Bob | 12 - 1 lb pkgs. | 30 | 15 |
Northwoods Salsa di mirtillo | 12 - 12 barattoli oz | 40 | 6 |
Mishi Kobe Niku | 18 - 500 g pkgs. | 97 | 29 |
Ikura | 12 - 200 ml vasetti | 31 | 31 |