Per the email conversation I had with Mark Birbeck, I am posting the xhtml+xforms markup I was using with Deer Park (new Firefox alpha) and the Mozilla XForms (latest nightly build) extension.
This document leads to validation errors in the XForms Validator and I do not understand why. Note that I am a beginner with all this, so it is probably something very obvious.
This markup is a little different than the markup from the tutorial:
1. I saved the document with an extension .xhtml, else Deer Park would render it as plan HTML.
2. I added an XHTML DOCTYPE as an attempt to get it to work.
3. I added empty XML namespaces to the instances that had none.
4. I fixed the range to reference 'size' rather than 'scale'.
This is the output of the validator:
XForms Validator (beta) results:
(What is this?)
Info: Checking uploaded document
Info: xsl:id(case-busy) found 0 hits
Info: Matched IDREF to ID: <toggle> ==case-busy==> <case>
Info: xsl:id(case-done) found 0 hits
Info: Matched IDREF to ID: <toggle> ==case-done==> <case>
Info: xsl:id(sub-flickr) found 0 hits
Info: Matched IDREF to ID: <submit> ==sub-flickr==> <submission>
Validating island 0 (<model>) (line 15)
Error! Island 0 failed validation with code 1 (line 15)
Validating island 1 (<group>) (line 44)
Error! Island 1 failed validation with code 1 (line 44)
Copyright 2004 Brain Attic. Comments, questions, or suggestions for improvement? Email us.
The following XML was processed to prepare this report:
0001: <?xml version="1.0" encoding="utf-8"?>
0002: <!DOCTYPE html PUBLIC
0003: "-//W3C//DTD XHTML 1.0 Transitional//EN"
0004: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
0005: >
0006: <html
0007: xmlns="http://www.w3.org/1999/xhtml"
0008: xmlns:xf="http://www.w3.org/2002/xforms"
0009: xmlns:ev="http://www.w3.org/2001/xml-events"
0010: xmlns:xs="http://www.w3.org/2001/XMLSchema"
0011: >
0012: <head>
0013: <title>Flickr Search Form</title>
0014: <link rel="stylesheet" href="flickr.css" type="text/css" />
0015: <xf:model>
0016: <xf:instance>
0017: <instanceData xmlns="">
0018: <method>flickr.photos.search</method>
0019: <api_key>68149024a667e0be3c63708f002ffe1e</api_key>
0020: <tags />
0021: <per_page>12</per_page>
0022: </instanceData>
0023: </xf:instance>
0024: <xf:instance id="inst-rs">
0025: <dummy xmlns="" />
0026: </xf:instance>
0027: <xf:submission id="sub-flickr"
0028: method="get" action="http://www.flickr.com/services/rest/"
0029: separator="&"
0030: replace="instance" instance="inst-rs"
0031: >
0032: <xf:toggle case="case-busy" ev:event="xforms-submit" />
0033: <xf:toggle case="case-done" ev:event="xforms-submit-done" />
0034: </xf:submission>
0035: <xf:instance id="inst-control">
0036: <instanceData xmlns="">
0037: <size>75</size>
0038: </instanceData>
0039: </xf:instance>
0040: <xf:bind nodeset="instance('inst-control')/size" type="xs:integer" />
0041: </xf:model>
0042: </head>
0043: <body>
0044: <xf:group id="main-body">
0045: <xf:input ref="tags">
0046: <xf:label>Tags:</xf:label>
0047: </xf:input>
0048: <xf:submit submission="sub-flickr">
0049: <xf:label>Find</xf:label>
0050: </xf:submit>
0051: <xf:range
0052: ref="instance('inst-control')/size"
0053: incremental="true"
0054: start="1" end="200"
0055: style="width: 200px;">
0056: <xf:label>Size:</xf:label>
0057: </xf:range>
0058: <xf:switch>
0059: <xf:case id="case-start">Start</xf:case>
0060: <xf:case id="case-busy"><img src="spinner.gif" alt="Busy" /></xf:case>
0061: <xf:case id="case-done">
0062: <xf:group ref="instance('inst-rs')">
0063: <xf:output ref="err/@msg">
0064: <xf:label>Error:</xf:label>
0065: </xf:output>
0066: <xf:repeat nodeset="photos/photo">
0067: <xf:output
0068: value="concat(
0069: '<img',
0070: ' src="http://static.flickr.com/',
0071: @server, '/',
0072: @id, '_',
0073: @secret,
0074: '_',
0075: if(
0076: instance('inst-control')/scale < 100,
0077: 's',
0078: 'm'
0079: ),
0080: '.jpg"',
0081: ' style="',
0082: 'width:', instance('inst-control')/scale, ';',
0083: ' height:', instance('inst-control')/scale, ';"',
0084: '/>'
0085: )"
0086: class="image"
0087: />
0088: </xf:repeat>
0089: </xf:group>
0090: </xf:case>
0091: </xf:switch>
0092: </xf:group>
0093: </body>
0094: </html>
I have a lot of issues with Deer Park, the most important being the 'tags' input not being submitted with the instance data and the reponse not being "replaced" in the 'instance-rs' instance, but I would like to start with markup that at least validates.
Regards,
Martin Bokman

Looking at the problem a bit
Hi Martin,
This is a combination of problems, I am afraid, and is probably not a very good form to get started with, in a totally different XForms processor than the tutorial was written in.
First, on the XForms Validator: The document is not actually invalid. The first issue the Validator raises, concerning the
instanceelement and the lack of a default namespace, is a warning so it's fair enough for the Validator to flag it up. But the second errors aboutmodelandgroupI don't understand. It may be that the Validator is requiring anidonmodel(which is not required) and arefongroup(which is also, not required). If those aren't the issues then I don't know what the problem is. (We use our own schemas that combine XHTML, XForms, SVG and MathML, which we'll make available soon.)Second, on FireFox: First there seems to be a bug such that empty instance values are not serialised for submission, which is why
tagsis not being sent. You can prove this by putting a value into the instance data fortags, settingreplacetoallon thesubmission, and then doing a search, and you'll see that you do correctly search Flickr, and get some XML back.However, what you'll notice is that the
inputcontrol does not show the value you just put in the instance. This is a handy thing to remember--if you don't see a value then the control is not bound correctly, so you need to do something about the part that says:It turns out that the thing we need to do is put an explicit namespace on the XPath expression, like this:
You will also need to add a namespace prefix for
aand then ensure that you put the same value into the instance data. (There seems to be a bug in FireFox such that you can't have theanamespace set to"", but it can be anything other than that.)If you do all of this you'll see that you get the XML back for whatever you search for.
Unfortunately, that was as far as I can take it in FireFox without putting in a lot more work. The problem was that if you set
replaceback toinstance, you'll see that although you correctly get the 'in progress' graphic after you press "Find" (showing thexforms-submitis being dispatched OK), adding an event handler forxforms-submit-errorwill show you that this event is also being fired, and I can't see any reason why that is.Only default namespaces can be empty
Quick update; the point I made about there being a bug in FF such that you can't have empty namespaces is not actually a bug. I ran it in Sidewinder and got the message "Only a default namespace can have an empty URI." I'd forgotten all about that, but it means you can have this:
but you can't have this: