XForms bind element error - data-binding

I am changing my code to use binds in XForms (which is better practice than using nodesets everywhere!) but I am getting errors.
The error message I receive is: "Error: XForms Error (8): id (data_criterion) does not refer to a bind element..."
From tutorials/guides I have been using, it seems as though this should work, but clearly I am missing something! (btw, I was modeling my binding code after the examples here: http://en.wikibooks.org/wiki/XForms/Bind)
I originally thought the problem was due to the fact I was using xf:select controls as opposed to xf:input like the examples, but even once I dumbed down my code to the most simplistic code, I still receive errors!
This is the model code I am using:
<xf:model id="select_data">
<xf:instance id="criteria_data" xmlns="">
<file>
<criteria>
<criterion></criterion>
</criteria>
</file>
</xf:instance>
<bind id="data_criterion" nodeset="instance('criteria_data')/criteria/criterion"/>
</xf:model>
As for the ui code, this is what I have:
<xf:input bind="data_criterion">
<xf:label>Enter criteria:</xf:label>
</xf:input>
The error message I receive is: "Error: XForms Error (8): id (data_criterion) does not refer to a bind element..."
Anyone have any insight to what the problem is? Also, is there any special usage of bindings and xf:select (with xf:itemset) controls that I should be aware of? (I am ultimately using a lot of xf:select controls on my form..)
Thanks in advance!
EDIT:
I ran the code through this validator, and I got this message (refers to the bind line):
"Warning: Should the following element have the XForms namespace applied?: bind (line 66)"

A couple of things you might want to change:
Not sure of this is the reason for the error, but the nodeset expression should be instance('criteria_data')/criteria/..., without file. Remember: instance() returns the root element, not the document node. (This one you took care by updating the question; good)
You are missing the xf on the bind. It should be: <xf:bind id="data_criterion" nodeset="instance('criteria_data')/criteria/criterion"/>.
See below a full example with your code, which works fine for me under Orbeon Forms:
<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
<xhtml:head>
<xhtml:title>SO Bind</xhtml:title>
<xf:model id="select_data">
<xf:instance id="criteria_data" xmlns="">
<file>
<criteria>
<criterion>Gaga</criterion>
</criteria>
</file>
</xf:instance>
<xf:bind id="data_criterion" nodeset="instance('criteria_data')/criteria/criterion"/>
</xf:model>
</xhtml:head>
<xhtml:body>
<xf:input bind="data_criterion">
<xf:label>Enter criteria:</xf:label>
</xf:input>
</xhtml:body>
</xhtml:html>

Related

ASP. NET Error: XML literal cannot appear here unless it is enclosed in parentheses

I am attempting to port some old asp to asp.net. Following this Microsoft tutorial! I am going through the errors and this XML one has me stuck. I have placed the opening and closing parenthesis in several places, but I am still getting the error. I'm sure this is something I'm overlooking, so any help is welcomed.
IF AAP><"" or EXECCOMM><"" or Immigration><"" or MgrMember><"" or OSHA><"" or StratPlan><"" or WageHour><"" or ERISA><"" or Health><"" or Litig><"" or OffHead><"" or PICCOMM><"" or Traditional><"" or WorkComp><"" then
BodyText=Replace(BodyText, "###SPECEmail###", "<b>Special E-mail Groups: </b>")
Please read this FAQ entry on MSDN:
An XML literal declaration is used in an expression in a location that
is ambiguous to the Visual Basic compiler. That is, the Visual Basic
compiler cannot determine whether the less-than character (<) is
intended as a comparative operator or the start of an XML literal.
You have a lot of < and > characters in your statement and that confuses the compiler.
Also: >< needs to be <> as explained in the comment by Andrew Morton.
So try changing your code to:
IF (AAP<>"") OR (EXECCOMM<>"") OR (Immigration<>"") OR (MgrMember<>"") OR (OSHA<>"") OR (StratPlan<>"") OR (WageHour<>"") OR (ERISA<>"") OR (Health<>"") OR (Litig<>"") OR (OffHead<>"") OR (PICCOMM<>"") OR (Traditional<>"") OR (WorkComp<>"") THEN
BodyText=Replace(BodyText, "###SPECEmail###", "<b>Special E-mail Groups: </b>")

Flex. Incorrect XML deserialization. & (&) and other special chars

I'm a newbie in Flex and I encountered the following problem.
When deserializing an XML with FlexXB I get different results from the tag and it's attributes.
For example:
<line text="A&amp;B">C&amp;D</line>
After deserialization I expect
text: A&B
line: C&D
but as a result I get
text: A&B
line: C&amp;D
After sources have been investigated I found that in XmlMemberSerializer.as used
child.toXMLString();
but in XmlAttributeSerializer.as
value = valueXML[0];
which is equivalent to .toString();
I don't understand whether it is correct or not. And I need help how to get expected results in this case.
Thanks.
Google developers fixed this issue in r744 revision. XmlMemberSerializer.as diff

IMFMediaSourceTopologyProvider::GetMediaSourceTopology always fails, why?

Under what circumstances the IMFMediaSourceTopologyProvider::GetMediaSourceTopology() does not fail? It always fails with code 0xc00d36e6 (MF_E_ATTRIBUTENOTFOUND).
Please do not answer with a link to MSDN.
Here is the solution after pissing blood for hours.
You have to call QueryInterface() on IMFSequencerSource object to get the IMFMediaSource like this:
hr = pMFSequencerSrc->QueryInterface( __uuidof( IMFMediaSource ), (void**)&pMediaSource );
Now on pMediaSource object call CreatePresentationDescriptor() to get the presentation descriptor required for the GetMediaSourceTopology() call.
voila...
P.S.
That MF_E_ATTRIBUTENOTFOUND error... nice work M$

A simple AMZI prolog recursion, but is not giving the correct result as expected

So this is my .pro file content (AMZI PROLOG) :
room(kitchen).
room(office).
room(hall).
room('dining room').
room(cellar).
door(office, hall).
door(kitchen, office).
door(hall, 'dining room').
door(kitchen, cellar).
door('dining room', kitchen).
location(desk,office).
location(apple,kitchen).
location(flashlight,desk).
location('washing machine',cellar).
location(nani,'washing machine').
location(broccoli,kitchen).
location(crackers,kitchen).
location(computer,office).
location(envelope,desk).
location(stamp,envelope).
location(key,envelope).
edible(apple).
edible(crackers).
tastes_yucky(broccoli).
here(kitchen).
is_located_in(T1,T2):-location(X,T2),is_located_in(T1,X).
What I want to achieve is that if I use, for example, is_located_in(X,office), then the result will be :
X=desk,
X=flashlight,
X=computer,
X=envelope,
X=stamp,
X=key,
no
(in no particular order).
That way, the result will include things that basically located in / on the object in the office, instead of things that located directly in the office.
This is the source : http://www.amzi.com/AdventureInProlog/a8recurs.php
There is stated that the code are fine, but when I test it, it just returned :
no
Please help. Thanks.
Try this (in this order):
is_located_in(T1,T2):-location(T1,T2).
is_located_in(T1,T2):-location(X,T2),is_located_in(T1,X).

Where is keywords code assist and letter not allowed problem(Aptana Studio 3)

I recently switched from Aptana2 to version3.0.3, and the first thing i did was to install the sdomcl. file to get jQuery code assist.It works fine for jQuery, but there is no code assist for many keywords.For exymple there is no support for var,while,throw,try,break,case,catch etc.
Also there is no function, instead intellisense sugests Function.
The second problem is that i am constantly getting this warning '<' + '/' +letter not allowed here when typing something valid like this:
confirmDiv =$("")-sorry for this,but it wont let me type what i want, basically i am just creating a new div with the correct syntax.
Could it be something with Html Tidy?Anyways, big thanks in advance!
Aptana Studio 3.0.4 includes code assist for JavaScript keywords.
I've read that for Javascript the slashes / must be escaped with backslashes \ as it says here
Doing so the warning dissapears ;)

Resources