applications of xml pipelines

38
Copyright © 1999-2007 Orbeon, Inc. All rights reserv Erik Bruchez [email protected] Applications of XML Pipelines XML Prague, June 16 th , 2007

Upload: ebruchez

Post on 06-May-2015

4.782 views

Category:

Technology


0 download

DESCRIPTION

The XProc XML pipeline language is well on its way to be standardized at W3C. But, exactly, what are XML pipelines good for? And how do they work in practice? In this talk, we attempt to answer these questions by presenting use cases for XML pipelines implemented with XPL, a close cousin of XProc. We show in particular how XML pipelines fill a niche in the constantly evolving web applications ecosystem. Can XML pipelines help deal with multiple web browsers? With REST services? With the plethora of syndication formats such as RSS and Atom? With Ajax? We suggest that the answer is yes in all these cases. We also show how XML pipelines can play a particularly interesting role when used in conjunction with XForms.

TRANSCRIPT

Page 1: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Erik [email protected]

Applications of XML Pipelines

XML Prague, June 16th, 2007

Page 2: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

XPL and XProc

Page 3: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

History

• XPL stands for XML Pipeline Language

• 2002: Developed by A. Vernet and myself

• 2004: Implementation open source (LGPL)

• 2005: Specification for XPL at W3C

• We now participate in the XProc Working Group at W3C

Page 4: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Shared Features

• Same goal: performing sequences of operations on XML documents

• XML-based syntax

• Exchange of XML documents between "steps"

• Steps with multiple inputs and outputs

• Iterations and conditionals

Page 5: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

New in XProc

• Exception handling

• Viewports

• Sequences of documents between steps

• Parameters and options

• Standard step library

Page 6: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

XProc as a Superset of XPL

• Most XPL pipelines can be transformed into XProc with XSLT stylesheet (provided that the same steps are available on both sides)

• A subset of XProc can be implemented on top of XPL with XSLT

Page 7: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

XPL and Orbeon Forms

Page 8: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Orbeon Forms

• Open source platform

• Evolution– general-purpose XML transformation platform

– web presentation platform

– forms solution

Page 9: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

XPL in Orbeon Forms

• MVC architecture

• Configurable post-processing

• Ajax server hooking-up to the XForms engine

• Lightweight REST services callable from XForms submissions

Page 10: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

XML Pipelines and MVC

Page 11: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

MVC Architecture

• Separates data and presentation– Model

– View

– Controller

Page 12: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Controller Pipeline

Page 13: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Example

1."request" step extracts a portion of the URL path

2."choose" step contains one "when" branch per path to process

3.Each branch 1.Calls "model" sub-pipeline step 2.Calls "view" sub-pipeline (stylesheet or

XHTML+XForms)

4."serialize" step sends result to the browser

Page 14: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Request Step

Page 15: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Controller Language

<page id="view-account"

path-info="/atm-view-account"

model="view-account-model.xpl"

view="view-account-view.xhtml"/>

Page 16: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Document Types&

Client Capabilities

Page 17: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Post-Processing

• Pseudo-HTML document

• XHTML document – Supported by client

– Not supported by client

• XHTML + XForms– Supported by client

– Not supported by client

Page 18: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Other Document Types

• XSL-FO

• Atom and RSS

• Text and binary

• Other XML documents

Page 19: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Epilogue Pipeline

• Leverages conditionals– Root element

– Other (xforms:model)

• Configurable and expandable

Page 20: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Portal Environment

• Full HTML document

• HTML fragment

Page 21: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

REST

Page 22: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Typical REST Service

• Receives XML from client

• Returns back XML

• Variations on the payload– JSON

– HTML

– plain text / custom formats

Page 23: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

REST with Pipelines

• Rich enough steps (components)– “request” component

– “response” or “serialization” component

– XSLT does a lot already!

Page 24: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Search Results

• "request" step extracts data submitted by client

• "validation" step validates the posted data

• "SQL" step calls relational database

• "serialize" step serializes XML to HTTP

Page 25: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Adapter Service

• "request" step extracts POSTed data

• "http" step calls service with the extracted data.

• "XSLT 2.0" step (regexps)– extracts data returned by service

– format XML response

• "serialize" step serializes XML to HTTP

Page 26: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Ajax

Page 27: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Ajax Server

• Server part is just REST service

• Can be implemented natively

• Plumbing with pipelines

Page 28: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Ajax-Based XForms

Page 29: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Ajax XForms Server

• "request" step extracts request headers and HTTP method.

• Request is an HTTP POST– "request" step extracts body and exports as a URI

– "generator" step dereferences URI and parses as XML

– Payload validated with Relax NG

– "XForms server" step receives the XML payload

– Response validated with Relax NG

– "serializer" step serializes response to HTTP as XML

Page 30: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Ajax XForms Server (cont.)

• Request is a pseudo-Ajax submission– "request" step extracts request parameters

– "XSLT" step formats parameters into an XML document

– Payload validated with Relax NG

– "XForms server" step receives the XML payload

– Response validated with Relax NG

– "XSLT" step embeds XML into small XHTML document

– "serializer" step serializes response to HTTP as XML

Page 31: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Cross-Domain Proxies

• "request" step obtains relevant request data

• "http" step forwards the step to an external service

• Forward the response back to the browser through HTTP

Page 32: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Pipelines and XForms

Page 33: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

XForms Submissions

• xforms:submission

• Serializes XML instance data

• Submits the serialization with a protocol

• XML data can be returned as well

• XForms 1.1 specifies http, https, file, and mailto

• SOAP serialization

• Implementation could define serializations to and from JSON over HTTP

Page 34: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

XForms 1.1

• Extends 1.0 HTTP and HTTPS support

• Intent to support REST interfaces

• XForms applications natively talk with RESTful services that speak XML

Page 35: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Impedance Mismatch

• Missing– REST

– XML

– SOAP support

• XML pipelines = impedance adapters

Page 36: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Transformations

• XForms does not directly support XSLT 2.0 or XQuery

• Transformations can be implemented in XML pipelines called from an XForms submission

Page 37: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

i18n

• XForms resources– As XML instances

– Loaded during initialization

• Static resources– from web server

• Database, etc.– impedance mismatch solved with pipelines

Page 38: Applications of XML Pipelines

Copyright © 1999-2007 Orbeon, Inc. All rights reserved.

Conclusion

• XML pipelines can play the role of a glue

• Putting together web apps out of XML

• XProc makes one more component of this architecture a standard

• Last missing piece of the puzzle: standard specification for a web application controller!