RE: Displaying XML _as_ XML

Hi Shazib,

> I want my xform to show a part of my xml instance
> _as_ xml (with tags and all) in a text area.


Now, do you mean "textarea" or "text area"? ;)


"TEXT AREA"
If you are simply looking to render some output (i.e., you want a "text
area"), then there is no standard way of doing this in XForms, but
implementations can provide ways to do this if they like. I am not aware of
this feature in processors other than formsPlayer, but our solution is to
use an XPath function:

  <xforms:output value="fp:HTMLserialise(/)">
    <xforms:label>Contents of instance data</xforms:label>
  </xforms:output>

The function takes a node and 'pretty-prints' an XML version of the node and
all its children. As you'd expect since this is just a normal form control,
the output changes as the instance data changes.

A full example, showing how to use this feature for simple debugging, is
given here:

  <http://www.formsPlayer.com/community/samples/serialisexml.html>


"TEXTAREA"
However, if you are looking to use a textarea control to edit a tree, then
this is not currently possible with XForms 1.0, since controls can only bind
to simple content. However, it is an extremely important use case (required
for blogs, content management systems, and so on), so there will hopefully
be some resolution to this within the specification.

In the meantime, as an experiment - and to get feedback from forms
developers - we've added an HTML editor to formsPlayer, available as an
extension to the xf:textarea control. This will be available in 'fP:2.0 with
Custom Controls', a beta of which will be available *very* soon.

Regards,

Mark


Mark Birbeck
CEO
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
w: http://www.formsPlayer.com/

Download our XForms processor from
http://www.formsPlayer.com/ 

Received on Monday, 26 July 2004 06:34:13 UTC