w3pop.com :: ÍøÂçѧԺ :: APPML :: °¸ÀýÑо¿£ºÄ¿Â¼
This chapter demonstrates AppML on the Categories table in the Northwind database.
ÕâÕ½«½éÉÜ»ùÓÚNorthwind Êý¾Ý¿âĿ¼±íµ¥µÄAppML¡£
The "Categories" AppML description:
“Ŀ¼”AppMLÃèÊö£º
<?xml version="1.0" encoding="ISO-8859-1" ?> <title>CATEGORIES</title> <database> <htmllist edit="true" /> </appml> |
View XML source: northwind/categories.xml
²é¿´XMLÔ´Îļþ£ºnorthwind/categories.xml
HTML Report: appml.asp?appname=northwind/categories&displaytype=report
HTML ±¨¸æ£ºappml.asp?appname=northwind/categories&displaytype=report
The link above runs the AppML HTML report service. To be able to run an AppML HTML report, the AppML description must contain an <htmlreport> tag.
ÉÏÊöÁ´½ÓÔËÐÐÁËAppML HTML±¨¸æ·þÎñ£¬ÎªÁËÄܹ»ÔËÐÐAppML HTML ±¨¸æ£¬AppMLÃèÊö±ØÐë°üº¬Ò»¸ö<htmlreport>±êÇ©¡£
We see that the report contains a header ("Categories"), a table listing the different categories along with a description, and the number of records in the report. The title and sql selection shown in the report, is taken from the <title> tag and the <sql> tag inside <database>. The number of records are automatically added by AppML.
ÎÒÃǶ¼¿´µ½£¬Õâ·Ý±¨¸æ°üº¬ÁËÒ»¸öҳü£¨“Ŀ¼”£©£¬Ò»¸ö¸ù¾ÝÃèÊöÁоٲ»Í¬Ä¿Â¼µÄ±í¸ñ£¬ÒÔ¼°±¨¸æÖмǼµÄÊýÁ¿¡£±¨¸æÖÐչʾµÄ±êÌâºÍSQLÑ¡¼¯ÊÇ´Ó<database>ÄÚ²¿µÄ<title>±êÇ©ºÍ<sql>±êÇ©ÌáÈ¡³öÀ´µÄ¡£
HTML Form: appml.asp?appname=northwind/categories&displaytype=form
HTML ±íµ¥£ºappml.asp?appname=northwind/categories&displaytype=form
The link above runs the AppML form service. To be able to run AppML form, the AppML description must contain an <htmlform> tag. The AppML description must also contain a <maintable> tag and a <keyfield> tag (inside the <database> tag).
ÉÏÊöÁ´½ÓÔËÐÐÁËAppML±íµ¥·þÎñ¡£ÎªÁËÄܹ»ÔËÐÐAppML±íµ¥£¬AppMLÃèÊö±ØÐë°üº¬<htmlform>±êÇ©¡£AppMLÃèÊöͬÑù±ØÐë°üº¬Ò»¸ö<maintable>±êÇ©ºÍÒ»¸ö<keyfield>±êÇ©£¨Î»ÓÚ<database>±êÇ©ÄÚ²¿£©¡£
The link above takes you to a page with a blank form. Here you can add a new record. AppML automatically adds New, Submit, and Delete buttons.
ÉÏÊöÁ´½Ó¿ÉÒÔʹÄãÖØÐ´ò¿ªÒ»¸öȫеĿհ×Ò³Ãæ¡£Äã¿ÉÒÔÔÚÀïÃæÌí¼ÓȫеļǼ¡£AppML»á×Ô¶¯Ìí¼ÓмǼ°´Å¥¡¢Ìá½»°´Å¥ºÍɾ³ý°´Å¥¡£
HTML List: appml.asp?appname=northwind/categories&displaytype=list
HTML ÁÐ±í£ºappml.asp?appname=northwind/categories&displaytype=list
The link above runs the AppML list service. To be able to run AppML list, the AppML description must contain an <htmllist> tag.
ÉÏÊöÁ´½ÓÔËÐÐÁËAppMLÁбí·þÎñ¡£ÎªÁËÄܹ»ÔËÐÐAppMLÁÐ±í£¬AppMLÃèÊö±ØÐëǶÌ×ÔÚÒ»¸ö<htmllist>±êÇ©ÄÚ¡£
We see that the list contains a header ("Categories"), the number of records in the list, a New button, a Save button, a Report button, and a table listing the different categories along with a description.
ÎÒÃÇ¿´µ½£¬ÁбíÖаüº¬ÁËÒ»¸öҳü£¨“Ŀ¼”£©£¬ÁбíÖмǼµÄÊýÁ¿£¬Ò»¸ö Р°´Å¥£¬´¢´æ °´Å¥£¬±¨¸æ °´Å¥ºÜ¸ù¾ÝÃèÊöÀ´ÏÔʾ²»Í¬Ä¿Â¼µÄ±í¸ñÁÐ±í¡£
The title and sql selection shown in the report, is taken from the <title> tag and the <sql> tag inside <database>. The number of records and the buttons are automatically added by AppML.
±¨¸æÖÐչʾµÄ±êÌâºÍSQLÑ¡¼¯ÊÇ´Ó<database>ÄÚ²¿µÄ<title>±êÇ©ºÍ<sql>±êÇ©ÌáÈ¡³öÀ´µÄ¡£¼Ç¼µÄÊýÁ¿ºÍ°´Å¥ÊÇ×Ô¶¯Ìí¼Óµ½AppMLÖеġ£
The New button is automatically added because the AppML description contains an <htmlform> tag.
Р°´Å¥ÊÇ×Ô¶¯Ìí¼ÓµÄ£¬ÒòΪAppMLÃèÊö°üº¬ÁËÒ»¸ö<htmlreport>±êÇ©¡£
The Report button is automatically added because the AppML description contains an <htmlreport> tag.
±¨¸æ°´Å¥ÊÇ×Ô¶¯Ìí¼ÓµÄ£¬ÒòΪAppMLÃèÊö°üº¬ÁËÒ»¸ö<htmlreport>±êÇ©¡£
The Folder image to the left of each records is automatically added because the AppML description contains an <htmlform> tag. If you click on the Folder image, you will be taken to the AppML form.
ÿÌõ¼Ç¼×ó±ßµÄÎļþ¼ÐͼÏñÊÇ×Ô¶¯Ìí¼ÓµÄ£¬ÒòΪAppMLÃèÊö°üº¬ÁËÒ»¸ö<htmlform>±êÇ©¡£Èç¹ûÄãµã»÷ÁËÎļþ¼ÐͼÏñ£¬Ä㽫»á½øÈëAppML±íµ¥¡£
Notice the edit="true" attribute inside the <htmllist> tag. This attribute automatically makes the list editable. You can modify the data directly in the list. After modifying the data, you can save the changes by clicking on the floppy disk image to the left of each record, or you can click on the Save button on the top of the list (this button saves all changes).
ÌØ±ð×¢Òâ<htmllist>±êÇ©ÄÚ²¿µÄ edit="true" ÊôÐÔ¡£Õâ¸öÊôÐÔ¿ÉÒÔʹÁбí³ÊÏÖ×Ô¶¯¿É±à¼×´Ì¬¡£Äã¿ÉÒÔÖ±½ÓÐÞ¸ÄÁбíÖеÄÊý¾Ý¡£ÐÞ¸ÄÍêÊý¾ÝÖ®ºó£¬Äã¿ÉÒÔµã»÷¼Ç¼×ó±ßµÄÈíÇýͼÏñÀ´±£´æÄãÒѾ¸ü¸ÄµÄ¼Ç¼£¬»òÕßµã»÷ÁÐ±í¶¥¶ËµÄ ±£´æ °´Å¥À´´¢´æ£¨Õâ¸ö°´Å¥½«±£´æËùÓеĸü¸ÄÐÅÏ¢£©¡£
You can also delete records by clicking on the trashcan to the right of each record.
ÄãͬÑù¿ÉÒÔµã»÷ÿÌõ¼Ç¼µÄÓұߵÄÀ¬»øÍ°À´É¾³ý¼Ç¼¡£
XML Report:
XML ±¨¸æ£º
appml.asp?appname=northwind/categories&displaytype=report&type=xml
The link above runs the AppML XML service.
ÉÏÊöÁ´½ÓÔËÐÐÁËAppML XML ·þÎñ¡£
The AppML XML report service will generate an XML report based on the sql defined in the <database> element. The XML report's root element is <table>. The first element after <table> is <sql>, which lists the sql used in the description. Then there will be one <row> element for each record in the sql. The <row> element contains one element for each field in the sql.
AppML XML±¨¸æ·þÎñ½«»á²úÉúÒ»¸ö»ùÓÚÔÚ<database>ÔªËØÖж¨ÒåµÄsqlÀ´²úÉúÒ»¸öXML±¨¸æ¡£XML±¨¸æµÄ¸ùÔªËØÊÇ<table>¡£ÔÚ<table>Ö®ºóµÄµÚÒ»¸öÔªËØÊÇ<sql>£¬ËüÂÞÁÐÁËÔÚÃèÊöÖÐʹÓõÄsql¡£¶ÔÓÚsqlÖÐÿһÌõ¼Ç¼¶øÑÔ£¬¶¼»á°üº¬Ò»¸ö<row>ÔªËØ¡£<row>ÔªËØÎªsqlÖеÄÿÌõ×ֶΰüº¬ÁËÒ»¸öÔªËØ¡£
To run all the AppML services above (except XML report) in one, use the following link: appml.asp?appname=northwind/categories
Ï£ÍûÔËÐÐÉÏÃæµÄAppML·þÎñ£¨³ýÁËXML±¨¸æ£©£¬¿ÉÒÔµã»÷ÏÂÃæµÄÁ´½Ó£ºappml.asp?appname=northwind/categories
ÆÀÂÛ (0)
All