Application Integration with XProc
-
Upload
vojtech-toman -
Category
Technology
-
view
2.276 -
download
2
description
Transcript of Application Integration with XProc
![Page 1: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/1.jpg)
Application Integration with XProc
Vojtech
Toman
Principal Software Engineer
EMC Corporation
![Page 2: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/2.jpg)
Overview
XProc basics
Application integration with XProc
Q/A
![Page 3: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/3.jpg)
XProc: An XML Pipeline Language
W3C Candidate Recommendation
http://www.w3.org/TR/xproc/
Language for describing operations to be performed on XML
documents
Declarative, XML-based, extensible
![Page 4: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/4.jpg)
XProc Status
XProc processor implementations
Calabash (http://xmlcalabash.com)
Calumet (http://developer.emc.com/xmltech)
…more in development
XProc.org
Informal website about XProc and its use
http://xproc.org
XProc Test Suite
http://tests.xproc.org
![Page 5: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/5.jpg)
Validate/XQuery/Transform Pipeline
Validate
XQuery
XSLT
![Page 6: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/6.jpg)
XProc Basics
StepPerforms a well-defined task
Validate, XSLT, XInclude, identity transformation, rename elements, …
Three main step types:Atomic, compound, and built-in language constructs
PipelineSequence (possibly non-linear) of steps
Is a step itself
Built-insFor-each, choose, try/catch, …
XPath as expression language
![Page 7: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/7.jpg)
Anatomy of an XProc Step
Step declarationType, input ports, output ports, options
When used in a pipeline, a step
is a black box thatExpects zero or more XML documents on
its input ports
Produces zero or more XML documents
on its output ports
Step
result
source
![Page 8: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/8.jpg)
Step Declaration –
Atomic Steps
Standard XProc step: p:add-attribute
<p:declare-step type="p:add-attribute"
xmlns:p="http://www.w3.org/ns/xproc">
<p:input
port="source"/>
<p:output
port="result"/>
<p:option
name="match" required="true"/>
<p:option
name="attribute-name" required="true"/>
<p:option
name="attribute-value" required="true"/>
</p:declare-step>
![Page 9: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/9.jpg)
Step Declaration –
Compound Steps
Pipeline that applies the p:add-attribute step
<p:declare-step>
<p:input
port="source"/>
<p:output
port="result"/>
<p:add-attribute match="book"
attribute-name="foo"
attribute-value="bar"/>
</p:declare-step>
![Page 10: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/10.jpg)
Extensibility of XProc
Custom steps
Step libraries & import functionality
Extension attributes
Implementation-defined mechanisms
I/O extensibility
Security
…
![Page 11: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/11.jpg)
Application Integration with XProc
XProc as the XML processing layer
Integration using standard XProc facilities
Interoperable
Integration using extensions
Implementation-dependent
Limited interoperability
![Page 12: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/12.jpg)
XProc –
Enabling Technology
Some XML standards depend on
XML processing capabilities
XForms
The XRX architecture
XForms/REST/X......
End-to-end XML model
XProc is a natural fit
XForms
XProc
NativeXML DB
HTTP
XML
XML
![Page 13: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/13.jpg)
Validate/XQuery/Transform Pipeline
XProc itself integrates multiple XML technologies
Easy to use, robust
Focus on WHAT, not on the low-level HOW
Better maintainability and customizability
p:validate-
with-xml-
schema
p:xquery p:xslt
![Page 14: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/14.jpg)
Validate/XQuery/Transform Pipeline
<p:for-each>
<p:validate-with-xml-schema>
<p:input
port="schema">...</p:input>
</p:validate-with-xml-schema>
</p:for-each>
<p:xquery>
<p:input
port="query">...</p:input>
</p:xquery>
<p:for-each>
<p:xslt>
<p:input
port="stylesheet">...</p:input>
</p:xslt>
</p:for-each>
![Page 15: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/15.jpg)
Executing external programs
p:exec
Program to execute
Command-line arguments
Working directory
Standard input/output
Support for non-XML data
Error handling
p:exec
cmd
![Page 16: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/16.jpg)
Executing external programs –
Example
Pipeline that counts the words in the input document
<p:declare-step>
<p:input
port="source"/>
<p:output
port="result"/>
<p:exec
command="/usr/bin/wc"
source-is-xml="false"
result-is-xml="false"/>
</p:declare-step>
![Page 17: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/17.jpg)
Integration with REST Web Services
p:http-request
Request URL
Request method
Authentication
Headers
Multipart messages
p:http-request
RESTService
Request
ResponseHTTP
![Page 18: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/18.jpg)
Integration with REST Web Services –
Example
Pipeline that retrieves the Twitter public timeline
<p:declare-step>
<p:output
port="result"/>
<p:http-request>
<p:input
port="source">
<p:inline>
<c:request
method="GET"
href="http://twitter.com/statuses/public_timeline.xml"/>
</p:inline>
</p:input>
</p:http-request>
</p:declare-step>
![Page 19: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/19.jpg)
Custom Atomic Steps
Custom step that provides the
integration logicImplementation in the processor’s host
language
Step declaration + import
Potentially not interoperablep:step-available() XPath function
EXProc.orghttp://exproc.org
ext:custom-
step
![Page 20: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/20.jpg)
Custom Atomic Steps –
Example
Custom step that triggers a workflow (xproc-wf.xpl)<p:declare-step type="wf:trigger-workflow"
xmlns:wf="http://example.com/ns/xproc-wf">
<p:input
port="source"/>
<p:option
name="workflow-type" required="true"/>
</p:declare-step>
Usage:<p:declare-step xmlns:wf="http://example.com/ns/xproc-wf">
<p:input
port="source"/>
<p:import
href="xproc-wf.xpl"/>
<wf:trigger-wf
workflow-type="translate"/>
</p:declare-step>
![Page 21: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/21.jpg)
Integration on the I/O level
Resource access in XProc is URI-based
XProc processors should support file and http(s)
Support for other URI schemes is implementation-defined
Transparent support for additional storage models/systems
p:load p:store
Storage system
![Page 22: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/22.jpg)
Integration on the I/O Level -
Example
Pipeline that loads a document from a native XML database
<p:declare-step>
<p:output
port="result"/>
<p:load href="xhive:/books/book24.xml"/>
</p:declare-step>
![Page 23: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/23.jpg)
Other Types of Integration
XML data model integration
Persistent DOM-based native XML databases
Integration via other XML languages
XSLT and XQuery extensions
![Page 24: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/24.jpg)
Conclusions
XProc deals with composing XML processes
Extensible by nature
Easy to integrate with external world
Declarative code easier to develop and maintain
![Page 25: Application Integration with XProc](https://reader035.fdocuments.in/reader035/viewer/2022062418/55493c2ab4c9050f4d8b4ccd/html5/thumbnails/25.jpg)
Questions and Answers
Vojtech Toman
http://www.emc.com
http://developer.emc.com/xmltech