Open Widget Engine
Home About Business Blog Developers Affiliates
Setup

Create

Data handling

File system

Components

API's

Overview

Widgets





API's / XML database API

To create a XML database is the exact same process as when you create a widget, only we use pure xml.

Once loaded into the runtime, it's accessable as a online xml database, and this example shows how to access and manipulate it throught the clientside javascript API.
You can design the xml anyway you want, there are no explicit restrictions, and the number of entries is more or less unlimited.
This example is crossdomain, and if you associate it with an account, you can also password protect it.
(See accounts).

Item no 0


Click here to view the source file used to create the database for this example.
This is the XML file we loaded into the runtime for this webapp to happen, and now we can delete it if we wish.
Removing it from it's location on the web wont matter anymore, the XML database is still accessable because it doesn't exist as a physical file anymore.


How to create and set a element/data entry

xin.create("person"); /* We create the element */
xin.append("xdata"); /* We append it to the element with the id 'xdata' */
xin.create("firstname"); /* We create a new element */
xin.set_value("first name"); /* We set the value */
xin.append("xdata.lastChild");/* We append to the lastChild, now 'person' */
xin.send("","app_id"); /* We execute the operations listed above serverside. The app_id refers to which app is to execute the previous operations. */

How to manipulate a element/data entry

xin.set_style("css_att","css_value","obj_id","app_id"); /* We set a specific css property */
xin.set_att("att","data"); /* We set the attribute as the element is created */
xin.att("obj","att","data"); /* We set the attribute once the element exist */
xin.value("obj","data"); /* We set the value once the element exist */
xin.remove("obj"); /* We remove the element */
xin.appendToTop("xdata"); /* We append the element at the top */
xin.appendToBottom("xdata"); /* We append the element at the bottom */
xin.cloneToTop("xdata", "old_tag"); /* We clone the element to the top */
xin.cloneToBottom("xdata", "old_tag"); /* We clone the element to the bottom */
xin.server("function()", "<app_id>"); /* We call the server and recieve a callback */
xin.getlength("obj", "tagName","callback"); /* We call the server, and if we include the tagName, we get the objects all children with that tagname, else, we only get all children, delivered as a number to the clientside callback function. */
xin.find("obj","attribute","callback", "<app_id>"); /* We call the server and if the attribute is not 'null', then we get the attribute value delivered to the clientside callback function, else, we get the value. */
The <app_id> must be specified, since it tells xin which app has these values.

Another way is using XML data tables.