W3C home > Mailing lists > Public > www-forms@w3.org > July 2007

WADL and XForms

From: Klotz, Leigh <Leigh.Klotz@xerox.com>
Date: Wed, 25 Jul 2007 10:57:06 -0700
Message-ID: <E254B0A7E0268949ABFE5EA97B7D0CF4035536AC@usa7061ms01.na.xerox.net>
To: <www-forms@w3.org>

I found the following article on WADL a good introduction:


The sample WADL example looked a lot like an XForms model.  It contains
a data definition, links to schemas, model item properties such as
required, data type definitions on nodes, and a submission method.

It was so similar, in fact, that I thought I'd re-write it as XForms,
hosted in XHTML.  There are a couple of things that are missing from the
XForms version, such as links between the sections defining operations,
but I've replaced those with a submit button (not strictly the same).

Here it is, mechanically translated.  A sufficiently clever programmer
could probably write an XSLT to do this.

The original remains in the link above.


<?xml version="1.0"?>
<html xmlns:ev="http://www.w3.org/2001/xml-events" 
    <title>WADL Example</title>

    <!-- the schema attribute does what the grammars/include elements do
in WADL -->
    <model xmlns="http://www.w3.org/2002/xforms"
schema="NewsSearchResponse.xsd NewsSearchError.xsd">

      <!-- this instance contains the implied data in the method/request
element of WADL -->
      <instance id="searchRequest">
        <data xmlns="">
          <appid />
          <query />
          <type />
          <results />
          <start />
          <sort />
          <language />

      <!-- this instance is the place where the data in the
method/response goes -->
      <instance id="searchResponse">
        <data xmlns="" />

      <!-- this bind contains the type and property declarations from
method/request of WADL -->
      <bind nodeset="instance('searchData')">
        <bind nodeset="appid" type="xsd:string" required="true()"/>
        <bind nodeset="query" type="xsd:string" required="true()"/>
        <bind nodeset="type" type="xsd:string"/>
        <bind nodeset="results" type="xsd:int"/>
        <bind nodeset="start" type="xsd:int"/>
        <bind nodeset="sort" type="xsd:string"/>
        <bind nodeset="language" type="xsd:string"/>

      <!-- This submission replaces the method attributes from WADL -->
      <submission id="search" method="get"
                  replace="instance" instance="searchResponse" />

    <group xmlns="http://www.w3.org/2002/xforms">
      <!-- this group is generated from the
method/request/query_variables with label==name -->
      <group ref="instance('searchRequest')">
        <input ref="appid">
        <input ref="query">
        <input ref="results">
        <input ref="start">
        <input ref="sort">
        <input ref="language">
        <submit submission="search">
      <!-- The WADL has no information about the response other than
element name, so we do the same here.
           Any UI put here will display only in case of good result
though -->
      <group ref="instance('searchResponse')/yn:ResultSet">
      <!-- The WADL has no information about the error other than
element name, so we do the same here.
           Any UI put here will display only in case of error result
though -->
      <group ref="instance('searchResponse')/ya:Error">

Received on Wednesday, 25 July 2007 17:57:32 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:20 UTC