home -> developer -> SQL -> tutorial -> price list -> prototype

back next

Using a prototype

As soon as you have created a schema, you can create new resources of that type. The file manager will use the schema to create a skeleton file that you can then edit.

Create a new resource

Open your xdb folder. Click "new file...". Enter the file type: http://waterken.com/coffeebreak/Coffee. Note the GUID generated for the filename. Click the submit button.

The return from the "New File" form is a new resource editor. The resource editor you just created is for a skeleton instance of <Coffee>, ready to be filled in with the information for a particular coffee. You can follow this same procedure to create any type of resource. Just enter the corresponding schema identifier in the "New File" form.

The <Schema> editor that you used during the previous tutorial section is also a resource editor. The difference is that the WaterkenTM server comes with custom XSLT for rendering some types, like the <Schema> resource editor. You have seen several custom editors already. A <Coffee> resource editor, being a newly defined type, must use the default XSLT.

In this case, we do not wish to create a resource for an actual coffee, but a prototype for constructing a <Coffee> from an SQL query result set. Instead of filling in actual values for the components, we will create holes to be filled in by the SQL query resource.

For both 'name' and 'price', click the "to hole" link and enter the corresponding database column name: "COF_NAME" and "PRICE".

View the new resource

The Coffeebreak application already comes with a <Coffee> prototype, so you can use the file manager to delete the resource that you just created. The <Coffee> resource you created in the previous step is located at the same base URI as all of the other Coffeebreak resources. Navigate to the xdb folder, select the file you just made, and click delete.

As soon as you have created a resource, you can view it in your browser. Click here to see the resource on your machine.

The composite query

The price list query, <qsmgkmiqi2stxmnq7yr4y5les4.xml>, uses the <Coffee> prototype. In the value field, the composite radio button is selected. The adjacent textfield specifies the capability URI for the <Coffee> prototype.

Run it

Click here to view the representation on your machine.

As with the weekly sales, custom XSLT can be applied. Click here to view the representation on your machine.

The next section describes a parameterized query.

top

Copyright 2002 - 2003 Waterken Inc. All rights reserved.

Powered by Waterken Server! Valid XHTML 1.0! Valid CSS!