W3C home > Mailing lists > Public > www-forms@w3.org > September 2010

Re: invalid binding expression error

From: John Boyer <boyerj@ca.ibm.com>
Date: Wed, 15 Sep 2010 08:05:15 -0700
To: e-letter <inpost@gmail.com>
Cc: Swithun Crowe <swithun@swithun.servebeer.com>, www-forms@w3.org
Message-ID: <OFA4362AA3.7D411BED-ON8825779F.00503328-8825779F.0052E278@ca.ibm.com>
Dear e-letter,

The replace attribute describes what will be replaced, not what will be 
submitted.  The default is replace="all" meaning that all of an instance 
will be replaced by whatever comes back from the submission.  The 
attribute which controls what gets submitted is ref, and if you leave out 
the ref, then all of the data in an instance is submitted.

I didn't catch the name of the processor you are using that had the crash; 
maybe you could mention it again next time.  However, I suspect it crashed 
when you properly identified the node you were interested in *because* it 
is an attribute, whereas the writer is expecting to output XML.  At the 
end of your email you said that you wanted to select an "option" (an 
attribute analysis/@type) then output that option as XML.  The problem is 
that the serialization of an attribute does not produce a well-formed XML 
document and therefore I would not expect XForms processors to produce an 
output.  We generally expect processor implementers to trap errors that 
lead to crashes, so it shouldn't crash, but nor should it have produced an 
output.

If you want to select one analysis element that has a particular type 
attribute value and output the whole analysis element, then you can do 
that with a predicate, like this

<xf:submission ref="analysis[@type = 'some value']" ... />

Since this attempts to output an XML element, and an element is a 
well-formed XML document, you'd be good to go.

However, in your last email it looked like you had more than one analysis 
element with the same type value.  In that case, the above ref would match 
more than one element, in which case processors are automatically 
programmed to select the first one (first node rule).  You can't output 
multiple XML elements without a wrapping containing element.  Multiple XML 
elements is a well-formed external general parsed entity, but not a 
well-formed XML document matching BNF rule #1 in the XML spec.  So, if you 
did need to output multiple matching analysis elements that have the same 
type attribute, you'd have to match the analysis element containing 
document with the submission ref, then use a relevant rule to prune the 
analysis elements you don't want.

Finally, with regard to the purpose of the mail list, I agree the term 
'technical discussions' is perhaps confusing.  The working group has 
technical discussions about building xforms processors, such as new 
features for the next version of the language or errata for existing 
feature specifications.  The public, who may be building xforms processors 
but not on the working group or who may be trying to build a solution with 
xforms and find language features to be missing or hard to use, can 
participate in those technical discussions too.  By comparison, though, 
the above would be considered tutorial/debugging in nature.  Maybe the 
working group should set up a tutorial/debuggin discussion mail list. I'll 
mention it on the call today.

Cheers,
John Boyer



From:
e-letter <inpost@gmail.com>
To:
John Boyer/CanWest/IBM@IBMCA
Cc:
Swithun Crowe <swithun@swithun.servebeer.com>, www-forms@w3.org
Date:
09/15/2010 02:06 AM
Subject:
Re: invalid binding expression error



On 14/09/2010, John Boyer <boyerj@ca.ibm.com> wrote:
> Dear e-letter,
>
> This is not really a forum for debugging your XForms forms, or the 
XPaths
> they contain.
>
May I suggest better explanation of the purpose of the mailing list is
published. I will continue in another resource elsewhere; thanks to
all.

> It is not clear why your xforms:submission should work without adding
> replace="none" to it because it is a method="put" submission. 
Particularly
> with a file scheme, I wouldn't expect anything to come back.
>
According to the specification, if the replace attribute is absent,
all data is submitted (my interpretation of xforms1 section3.3.3;
cited because writer complies with version1).

> However, the reason you're getting nothing is that you seem to be using 
an
> element reference "type" that does not exist as a child element of
> "analysis".
>
Understood

> It seems you are trying to ref the *attribute* called type, so you would
> have to use analysis/@type to reference that node.
>
Tried that causing crash, will try to repeat to see if bug with writer
or my user error.

> That being said, XForms submissions write an XML document.  If you were 
to
> ref to analysis/@type, the result is not serializable as XML because it 
is
> only a (textual) attribute value.  So, this leaves the question of what
> you are trying to write.
>
In summary, to select an option from a list menu and the save the data
value associated with that option as an xml file.
Received on Wednesday, 15 September 2010 15:06:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:21 GMT