Water Type and Water Contract
I created a new XML schema language called Water Contract and a new XML type language called Water Type. These solutions could be used to describe ConciseXML or XML documents. Water Type and Water Contract documents can be expressed in ConciseXML or XML syntax. I've put some description below as well as links to documents describing them. Water Type http://www.waterlang.org/water_book_2002/ch04.pdf Water Contract http://www.waterlang.org/water_book_2002/ch05.pdf _Mike Plusch -------------- WATER CONTRACT A contract is an agreement that formalizes a set of expectations between two or more parties. Water Contract takes the ideas behind a legal contract and applies them to software. Every Web service has an application programming interface (API) for calling that service. In the past, a service's API was described in a human-readable text document. With Web services, the API is described in a text document as well as in a machine-readable form. DTD and XML Schema are two examples of formal languages for describing the structure of an XML document. Water Contract is a formal language for fully describing a data structure or API. It uses the ConciseXML syntax and Water Contract and is both easier to create and use than either DTD or XML Schema, as well as providing greater rigor and precision for describing an interface or data structure. Most languages have some way to constrain the fields of an object as well as the values of any particular field. Languages use different terms to describe the object that defines these constraints. For example, SQL has table definitions, Java has classes, Cobol has record definitions, C has structs, and XML has schema languages such as W3C XML schema or DTD's (Document Type Definitions). Water Contract uses defclass to define constraints on data objects. A defclass represents a class, and instances created from that class must obey the constraints defined in defclass . The following uses defclass to define a person class: <defclass person name born_on/> All instances of this class must supply values for the name and born_on fields, so both fields are required. Here is an example of creating an instance of the person class: <person name="Mike" born_on=<date 2002 10 10/> /> Required fields can be specified two ways: 1. By just listing the name and not supplying any value. 2. By explicitly putting required as the value of the field. The following two lines are equivalent: <defclass person name born_on/> <defclass person name=required born_on=required/> Optional fields can be specified two ways: 1. By giving a value to the field that is the field's default value. 2. By using optional as the value of the field. The following two classes both have two optional fields: <defclass person name="" status=="living "/> <defclass person name=optional status=optional/> The first line has an optional name field with a default value of the empty string "". The status field has a default value of "living ". The second line uses optional for both fields to say that the fields are not required. Each field can also have an associated type. The following example shows a person defclass with two fields: fname and born_on . fname has a required value and the value must be of type string . born_on has an optional value, but if a value is given, it must be of type date . Each field follows the key=value=type form. <defclass person fname=required=string born_on=optional=date /> If no type is specified for a field, it can hold any object; therefore, the default type is thing . WATER TYPE A type is a description for categorizing value. Water Type defines a set of core classes and types that represent common values. A type is an object which can be used to describe the possible values in a field. Water Type also defines the way in which new types can be created. Water Type defines primitive classes and objects as several non-primitive classes. The three primitive objects are true, false, and null . The four classes that have instances that are primitive objects are number, boolean, char, and string . Primitive objects form the base for constructing all other objects. Primitive objects have a _parent field and no other fields, while non-primitive objects can have other fields. In every other respect, primitive objects share the same properties as every other object. Water Type defines several non-primitive objects including hypertext, vector, thing, date, time, datetime, datetime_interval, and duration. Here are a few examples of defining new types: <one_of "red " "green " "blue "/> <one_of string hypertext/> <set uppercase=type.<one_of <char "A "/> <char "B "/> <char "C "/>/> <set uppercase_ABC=type.<vector_of uppercase min=2 max=15/>/>
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format