23
XForms and eXist A perfect couple Erik Bruchez [email protected]

XForms and eXist: A Perfect Couple

  • Upload
    ebruchez

  • View
    247.620

  • Download
    1

Embed Size (px)

DESCRIPTION

These are the slides I presented on December 3, 2007 at the XForms Evening / XML 2007 event in Boston.

Citation preview

Page 1: XForms and eXist: A Perfect Couple

XForms and eXist A perfect couple

Erik [email protected]

Page 2: XForms and eXist: A Perfect Couple

A demo

Page 3: XForms and eXist: A Perfect Couple

XForms

• Represents form data as XML

• But how do you persist it?

Page 4: XForms and eXist: A Perfect Couple

XForms Persistence

There is no such thing!

Page 5: XForms and eXist: A Perfect Couple

<xforms:submission>

• Allows XForms to “talk” to the world

• Fully supports REST in XForms 1.1

Page 6: XForms and eXist: A Perfect Couple

REST

• Using HTTP the way it was meant to be

• Identify resources with URIs

• Methods: GET, PUT, DELETE, POST

Page 7: XForms and eXist: A Perfect Couple

Traditionally

• UI written with Java, Ruby, ...

• Data captured as objects

• Relational database

• O-R mapping to bridge the gap

Page 8: XForms and eXist: A Perfect Couple

Issues

• Middleware to do the mapping

• More software

Page 9: XForms and eXist: A Perfect Couple

What about XForms?

• Implement a REST service

• XML-relational mapping

• Or store in BLOB columns

Page 10: XForms and eXist: A Perfect Couple

Is there a better way?

Page 11: XForms and eXist: A Perfect Couple

eXist

• Native XML database

• Open source

• XQuery

• REST API

Page 12: XForms and eXist: A Perfect Couple

2 + 2 = ?

Page 13: XForms and eXist: A Perfect Couple

Perfect Match

• XML

• REST

Page 14: XForms and eXist: A Perfect Couple
Page 15: XForms and eXist: A Perfect Couple

No need for a middle man!

Page 16: XForms and eXist: A Perfect Couple

GET

<xforms:submission serialization=”none” method=”get” action=”http://localhost/exist/db/docs/form1.xml” replace=”instance” instance=”form-instance”/>

Page 17: XForms and eXist: A Perfect Couple

PUT

<xforms:submission ref=”instance(‘form-instance’)” method=”put” action=”http://localhost/exist/db/docs/form1.xml” replace=”none”/>

Page 18: XForms and eXist: A Perfect Couple

DELETE

<xforms:submission serialization=”none” method=”delete” action=”http://localhost/exist/db/docs/form1.xml” replace=”none”/>

Page 19: XForms and eXist: A Perfect Couple

POST

<xforms:submission ref=”instance(‘search-query’)” method=”post” action=”http://localhost:8080/exist/db/docs/” replace=”instance” instance=”query-results”/>

Page 20: XForms and eXist: A Perfect Couple

XQuery

<xforms:instance id=”search-query”> <exist:query> <exist:text> xquery version "1.0"; <documents>{ for ... return ... }</documents> </exist:text> </exist:query></xforms:instance>

Page 21: XForms and eXist: A Perfect Couple

Using XQuery results

• Output values with <xforms:output>

• Iterate with <xforms:repeat>

Page 22: XForms and eXist: A Perfect Couple

Conclusion

Using XForms and eXist allows you to do all the Create/Read/Update/Delete (CRUD) and search operations without any middleware.

The result is increased simplicity.

Page 23: XForms and eXist: A Perfect Couple

Q & A