Cannot create InstanceData on node type: Text

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot create InstanceData on node type: Text

quinquin2209
Hi,

I have an xform and an input text defined as follow:

<xforms:input  ref="*[local-name()='Book']/*[local-name()='Name']/text()">
        <xforms:label class="form-label">Date</xforms:label>
</xforms:input >

When I lose focus from this input field, error dialog is prompted saying that "Cannot create InstanceData on node type: Text".

in my xpath, function text() is used because the xml instance may contains element that contains both text node and child node like the following:

<Book>
    <Name>ABC
          <Diff>
             <oldValue>DEF</oldValue>
          </Diff>
    </Name>
</Book>

Does anyone have suggestion on how it can be solved?

Thanks in advance
Reply | Threaded
Open this post in threaded view
|

Re: Cannot create InstanceData on node type: Text

Erik Bruchez
Administrator
XForms does not allow you to:

1. Bind a control to a text node
2. Bind a control to an element which contains children elements

This has been make clearer in XForms 1.1 after long discussions in the  
XForms Working Group.

So what you want to achieve here won't work (our error message should  
be clearer though) in XForms.

What you could do is bind the control to another instance, then copy  
the value back to the other instance.

-Erik

On Feb 5, 2008, at 12:47 AM, quinquin2209 wrote:

>
> Hi,
>
> I have an xform and an input text defined as follow:
>
> <xforms:input  ref="*[local-name()='Book']/*[local-name()='Name']/
> text()">
> <xforms:label class="form-label">Date</xforms:label>
> </xforms:input >
>
> When I lose focus from this input field, error dialog is prompted  
> saying
> that "Cannot create InstanceData on node type: Text".
>
> in my xpath, function text() is used because the xml instance may  
> contains
> element that contains both text node and child node like the  
> following:
>
> <Book>
>    <Name>ABC
>          <Diff>
>             <oldValue>DEF</oldValue>
>          </Diff>
>    </Name>
> </Book>
>
> Does anyone have suggestion on how it can be solved?
>
> Thanks in advance
> --
> View this message in context: http://www.nabble.com/Cannot-create-InstanceData-on-node-type%3A-Text-tp15285659p15285659.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Cannot create InstanceData on node type: Text

quinquin2209
Thanks for your reply.

I am not so sure how can I  bind the control to another instance, then copy  
the value back to the other instance.

can you explain a bit on it?

Thanks.

Queenie


Erik Bruchez wrote
XForms does not allow you to:

1. Bind a control to a text node
2. Bind a control to an element which contains children elements

This has been make clearer in XForms 1.1 after long discussions in the  
XForms Working Group.

So what you want to achieve here won't work (our error message should  
be clearer though) in XForms.

What you could do is bind the control to another instance, then copy  
the value back to the other instance.

-Erik

On Feb 5, 2008, at 12:47 AM, quinquin2209 wrote:

>
> Hi,
>
> I have an xform and an input text defined as follow:
>
> <xforms:input  ref="*[local-name()='Book']/*[local-name()='Name']/
> text()">
> <xforms:label class="form-label">Date</xforms:label>
> </xforms:input >
>
> When I lose focus from this input field, error dialog is prompted  
> saying
> that "Cannot create InstanceData on node type: Text".
>
> in my xpath, function text() is used because the xml instance may  
> contains
> element that contains both text node and child node like the  
> following:
>
> <Book>
>    <Name>ABC
>          <Diff>
>             <oldValue>DEF</oldValue>
>          </Diff>
>    </Name>
> </Book>
>
> Does anyone have suggestion on how it can be solved?
>
> Thanks in advance
> --
> View this message in context: http://www.nabble.com/Cannot-create-InstanceData-on-node-type%3A-Text-tp15285659p15285659.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.com.
>
>
> --
> You receive this message as a subscriber of the ops-users@ow2.org  
> mailing list.
> To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
> For general help: mailto:sympa@ow2.org?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Cannot create InstanceData on node type: Text

Alessandro Vernet
Administrator
On Feb 5, 2008 7:30 PM, quinquin2209 <[hidden email]> wrote:
> Thanks for your reply.
>
> I am not so sure how can I  bind the control to another instance, then copy
> the value back to the other instance.
>
> can you explain a bit on it?

You could create another instance (say id="book-shadow"):

<BookShadow>
    <Name>ABC</Name>
</BookShadow>

Then you bind your input to instance('book-shadow')/Name. Before
submitting the instance "book" you would copy the data in
instance('book-shadow')/Name to your other instance using a sequence
of actions xforms:delete and xforms:insert. This is most likely more
complex that what you would like :).

Alternatively, you can just work entirely with an instance which is
not in the format you want but which is in a format that makes you job
easy in XForms (like book-shadow) and transform it in the format you
need with XSLT on the server.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws