Markup Support for Sensor Data Upload in Forms.

John J. Barton John_Barton@hpl.hp.com
Hewlett Packard Labs

Copyright 2001 Hewlett Packard

Introduction

To allow digital appliances to interact directly with web services we extend form-fill-in markup semantics to support "sensor data". If the sensor is an image sensor, then the data corresponds to an image and posting a form with the image filled in amounts to image upload. Many other kinds of sensors can be supported and the results of including their output in forms can be more elaborate than storage. Our proposal offers a way to support simple image upload in the general framework of forms that is capable of many additional applications.

Our proposal works within the ongoing development of a new generation of forms based in XML, the XFORMs work at W3C. We propose a new xform element entitled "input" to compliment the existing "output" element in XFORMs.

XFORMs

XFORMs separates the form schema, instance values, and presentation. In the form schema or model, XFORMs supports a "binary" datatype. There isn't a corresponding solution for the instance values or presentation.

Binary values as instance data

For instance values we propose that binary data be referenced by URI. Here is an example:

<model>
  <string name="album_id" />
  <binary name="photo">
    <mediaType>image/jpeg</mediaType>
    <mediaType>image/png</mediaType>
  </binary>
</model>
<instance>
  <album_id>John's Great Adventure</album_id>
  <photo href="G122F.jpeg"></photo>
</instance>

The href attribute is URI for a default value in the form in the same sense that the text in the album_id field is a default text value. The appearance of a URI in the instance does not obligate the user agent to access the named resource. The resolution rules for the URI are exactly the same ones that apply to URIs that appear in the presentation markup.

This approach to binary instance data parallels a separate proposal for XFORMs to send XMLP (aka SOAP) messages when the user submits the form. Binary data can be carried with the submitted form using the SOAP Messages with Attachments approach. This approach hyperlinks the XML message carried in one part of a multipart/related MIME message to binary data carried in another part. The hyperlink URI can be absolute and globally unique or relative to the message. By using a URI for the binary data in the instance, all of the issues of mixing binary and XML data are handled by the same proven methods.

The button element action for binary values

To solicit the input of sensor data we use a button form control element with an action attribute value of "getLocal". The ref attribute for this same button form control element will point to the value in the form that is to be supplied. The mapping of particular sensors to particular form values is entirely determined by the client. For example, when the form has a getLocal button that calls for an image type, a camera XFORMs user agent software will provide a means for the user to associate a image with the value that corresponds to the button.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"     
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"  
      xmlns:xform="http://www.w3.org/2001/02/xforms"
      xmlns:pxml="http://schemas.xmlsoap.org/soap/envelope/">
<head>
<xform  xmlns="http://www.w3.org/2000/xforms"  
  id="photo_upload"
  action="http://myphotoservice.com/addphoto.asp"
  method="postXMLP">
<model>
<string name="album_id" />  
  <binary name="photo">
    <mediaType>image/jpeg</mediaType>
    <mediaType>image/png</mediaType>
  </binary>
</model>
<instance>
   <pxml:Envelope
        xmlns:pxml="http://schemas.xmlsoap.org/soap/envelope/">
   <pxml:Body>
     <album_id>John's Great Adventure</album_id>
     <photo></photo>    
   </pxml:Body>
   </pxml:Envelope>
   </instance>
</xform>
</head>
<body>
  <xform:button action="getLocal" ref="photo_upload/pxml:Envelope/pxml:Body/photo">
Select Photo
</xform:button> <xform:submit xform="photo_upload"> Add to <xform:output ref="photo_upload/pxml:Envelope/pxml:Body/album_id" /> photo album </xform:submit> </body> </html>

References:

[1] XML Protocol Activity
http://www.w3.org/2000/xp/

[2] XForms - the next generation of Web forms
http://www.w3.org/MarkUp/Forms/

[3] XForms 1.0: Data Model
W3C Working Draft, 6 April 2000
http://www.w3.org/TR/2000/WD-xforms-datamodel-20000406/

[4] XForms Requirements
W3C Working Draft, 21 August 2000
http://www.w3.org/TR/2000/WD-xhtml-forms-req-20000821/

[5] SOAP - Simple Object Update Protocol
http://www.w3.org/TR/SOAP/

[6] SOAP Messages with Attachments
http://www.w3.org/TR/SOAP-attachments/

[XSchema-2]
Paul V. Biron and Ashok Malhotra. Candidate Recommendation: XML Schema Part 2: Datatypes. Available at: http://www.w3.org/TR/xmlschema-2. 2000.

[XHTML Forms]
Form content types of the HTML 4.0.1 specfication.
http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4