As I have not been able to find pointers in the documentation or email archive
let me post this question: Using XFORMS it is possible to use namespace and xsi types in instance definitions and use xpath to refer to the elements in ref and nodeset references. Eg, I can have <dc:title xsi:type="a" /> and <dc:title xsi:type="b" /> elements defined in an instance and refer to them using dc:title[@xsi:type='something'] . See working example in below handcrafted code. I am trying to use the same mechanism in form builder ( tried both the developer version and the nightly build ) but it seems that form builder does not have gui support for use of custom namespaces and xsi types . Is my understanding correct or am I overlooking something ? Thanks, Rolf Kwakkelaar +++ XFORMS Example: <html xmlns:ev="http://www.w3.org/2001/xml-events" xmlns="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dc="http://purl.org/DC/terms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns:xhtml="http://www.w3.org/1999/xhtml"> <head> <title>XForms Bookcast</title> <xforms:model> <xforms:instance id="testrecs-instance"> <testrecs xmlns=""> <testrec> <dc:title xsi:type="a" /> <dc:title xsi:type="b" /> </testrec> </testrecs> </xforms:instance> <xforms:bind nodeset="testrec"> <xforms:bind nodeset="dc:title[@xsi:type='a']" required="true()"/> <xforms:bind nodeset="author" required="true()"/> </xforms:bind> <xforms:submission id="save-submission" ref="instance('testrecs-instance')" resource="/exist/rest/db/orbeon/recs/testrecs.xml" method="put" replace="none"/> </xforms:model> </head> <body> <xforms:submit submission="save-submission"> <xforms:label>Save</xforms:label> </xforms:submit> <xforms:group ref="testrec"> <xforms:input ref="dc:title[@xsi:type='a']"> <xforms:label>Title(LCSH)</xforms:label> </xforms:input> <xforms:input ref="dc:title[@xsi:type='b']"> <xforms:label>Title(LCNA)</xforms:label> </xforms:input> </xforms:group> </body> </html> +++++ records submitted to exist using above code: <testrecs> <testrec> <dc:title xsi:type="a">val1</dc:title> <dc:title xsi:type="b">val2</dc:title> </testrec> </testrecs> -- 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 |
Administrator
|
Rolf,
Form Builder binds controls to data using the @bind attribute on controls and <xforms:bind> elements. At the moment, Form Builder creates its own flat-ish data structure when you insert sections and controls. It also inserts <xforms:bind> elements for all the controls. What's clearly missing at this point in Form Builder is the ability of putting your own data model. We hope to improve this in the future (and it's even better if somebody helps sponsor that!). But the fact that Form Builder uses binds already gets you halfway there, as you could: * create your form with Form Builder * substitute, by editing the form produced, your own binds @nodeset expressions pointing to your own data model * substitute, by editing the form produced, your own form instance Another option would be to add a translation layer, e.g. in the Form Runner persistence layer. I.e. you would provide an XSLT transformation converting between the flat Form Builder format and your own format and the other way around. -Erik On Sat, Dec 12, 2009 at 4:19 PM, <[hidden email]> wrote: > As I have not been able to find pointers in the documentation or email archive > let me post this question: > > Using XFORMS it is possible to use namespace and xsi types in instance > definitions and use xpath to refer to the elements in ref and nodeset > references. Eg, I can have <dc:title xsi:type="a" /> and <dc:title xsi:type="b" > /> elements defined in an instance and refer to them using > dc:title[@xsi:type='something'] . See working example in below handcrafted > code. > > I am trying to use the same mechanism in form builder ( tried both the > developer version and the nightly build ) but it seems that form builder does > not have gui support for use of custom namespaces and xsi types . Is my > understanding correct or am I overlooking something ? > > Thanks, > Rolf Kwakkelaar > > +++ XFORMS Example: > > <html xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns="http://www.w3.org/1999/xhtml" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:dc="http://purl.org/DC/terms" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > xmlns:xhtml="http://www.w3.org/1999/xhtml"> > <head> > <title>XForms Bookcast</title> > <xforms:model> > <xforms:instance id="testrecs-instance"> > <testrecs xmlns=""> > <testrec> > <dc:title xsi:type="a" /> > <dc:title xsi:type="b" /> > </testrec> > </testrecs> > </xforms:instance> > <xforms:bind nodeset="testrec"> > <xforms:bind nodeset="dc:title[@xsi:type='a']" > required="true()"/> > <xforms:bind nodeset="author" required="true()"/> > </xforms:bind> > <xforms:submission id="save-submission" > ref="instance('testrecs-instance')" > resource="/exist/rest/db/orbeon/recs/testrecs.xml" method="put" > replace="none"/> > </xforms:model> > > </head> > <body> > <xforms:submit submission="save-submission"> > <xforms:label>Save</xforms:label> > </xforms:submit> > <xforms:group ref="testrec"> > <xforms:input ref="dc:title[@xsi:type='a']"> > <xforms:label>Title(LCSH)</xforms:label> > </xforms:input> > <xforms:input ref="dc:title[@xsi:type='b']"> > <xforms:label>Title(LCNA)</xforms:label> > </xforms:input> > </xforms:group> > </body> > </html> > > +++++ records submitted to exist using above code: > > <testrecs> > <testrec> > <dc:title xsi:type="a">val1</dc:title> > <dc:title xsi:type="b">val2</dc:title> > </testrec> > </testrecs> > > > -- > 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 > > -- 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 |
Free forum by Nabble | Edit this page |