4.8. < AppML > case study-Application Model

发布时间 :2025-10-25 12:24:26 UTC      

This case study demonstrates how to build a complete < AppML > Internet application with the ability to enumerate, edit, and search for information against several tables in the database.

4.8.1. Application model

In this chapter, we will build a complete application model for the Customers table in the database.

4.8.2. < AppML > filter

To allow filtering of < AppML > data, simply add a < filters > element to the model:

Example:

<filters>
<query>
<field label="Customer">CustomerName</field>
<field>City</field>
<field>Country</field>
</query>
<order>
<field label="Customer">CustomerName</field>
<field>City</field>
<field>Country</field>
</order>
</filters>

For a comprehensive understanding, see < AppML > 参考手册 .

4.8.3. < AppML > Update

To allow < AppML > data to be updated, simply add a < update > element to the model:

Example:

<update>
<item><name>LastName</name></item>
<item><name>FirstName</name></item>
<item><name>BirthDate</name></item>
<item><name>Photo</name></item>
<item><name>Notes</name></item>
</update>

And add a < maintable > and < keyfield > element to the < database > element:

Example:

<maintable>Customers</maintable>
<keyfield>CustomerID</keyfield>

For a comprehensive understanding, see < AppML > 参考手册 .

4.8.4. < AppML > Security

You can easily add security to the < AppML > model by adding a security attribute to the < AppML > tag.

Example:

<appml **security="admin"**>

In the above example, the model can be accessed only if the user logs in to become a member of the user group “admin”.

To set security for the < update > element, simply add a security attribute to the < update > element:

Example:

<update **security="admin"**>
<item><name>LastName</name></item>
<item><name>FirstName</name></item>
<item><name>BirthDate</name></item>
<item><name>Photo</name></item>
<item><name>Notes</name></item>
</update>

4.8.5. Complete Customers model

In this chapter, we will set up an application model for each table in the database.

Create a new folder called Models. In the Models folder, create a model for each application.

模型:Customers.xml

<appml security="">
<datasource>
<database>
<connection>Demo</connection>
<maintable>Customers</maintable>
<keyfield>CustomerID</keyfield>
<sql>SELECT \* FROM Customers</sql>
<orderby>CustomerName,City,Country</orderby>
</database>
</datasource>
<filters>
<query>
<field label="Customer">CustomerName</field>
<field>City</field>
<field>Country</field>
</query>
<order>
<field label="Customer">CustomerName</field>
<field>City</field>
<field>Country</field>
</order>
</filters>
<update security="admin">
<item><name>CustomerName</name></item>
<item><name>ContactName</name></item>
<item><name>Address</name></item>
<item><name>PostalCode</name></item>
<item><name>City</name></item>
<item><name>Country</name></item>
</update>
</appml>

4.8.6. Model view

Create a model view, save it as Demo_Model.html, and give it a try:

视图:Demo_Model.htm

<h1>Customers</h1>
<div id="List01"></div>
<script src="appml.js"></script>
<script>
customers=new AppML("appml.htmlx","Models/Customers");
customers.run("List01");
</script>

尝试一下 »

4.8.7. Now put it all together.

Then, with a small amount of JavaScript coding, create a test page for all models:

Demo_Model_Views.htm

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="appml.css" />
</head>
<body>
<h1>Demo Applications</h1>
<button onclick='myOpen("Customers")'>Customers</button>
<button onclick='myOpen("Products")'>Products</button>
<button onclick='myOpen("Suppliers")'>Suppliers</button>
<button onclick='myOpen("Shippers")'>Shippers</button>
<button onclick='myOpen("Categories")'>Categories</button>
<button onclick='myOpen("Employees")'>Employees</button>
<button onclick='myOpen("Orders")'>Orders</button>
<button onclick='myOpen("OrderDetails")'>OrderDetails</button>
<br><br>
<div id="Place01"></div>
<script src="appml.js"></script>
<script>
function myOpen(pname)
{
var app_obj
app_obj=new AppML("appml.php","Models/" + pname);
app_obj.run("Place01");
}
</script>
</body>
</html>

显示结果 »

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.