Your SlideShare is downloading. ×
Dxl As A Lotus Domino Integration Tool
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Dxl As A Lotus Domino Integration Tool

4,607
views

Published on

Dxl As A Lotus Domino Integration Tool

Dxl As A Lotus Domino Integration Tool

Published in: Technology

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,607
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Transcript

    • 1. DXL as a Lotus Domino Integration Tool Dick Annicchiarico IBM
    • 2.  
    • 3. Agenda
      • Quick review of XML, DXL, and XSLT
      • Overview of the Domino application used in the demos – Customer Orders
      • Demos and source code overview of using DXL
        • as input or output from Web service APIs (USPS and Amazon)
        • to create a PDF (Portable Document Format) report document
        • to export data to or import data from an OpenOffice spreadsheet
      • Q & A
    • 4. XML
      • eXtensible Markup Language
      • By itself, just a set of rules for properly formed elements, content, attributes, and attribute values
      • There are many, many XML vocabularies, e.g. DXL, XSL, Web service APIs, OpenOffice, etc.
      • XML vocabularies are specified via a DTD or schema
    • 5. DXL – Domino XML Language
      • DXL is XML
      • DXL defines XML elements for most Domino constructs, e.g. database, acl, document, form, view, agent, etc.
      • <document>s are very general; mainly a collection of <item>s
      • Other elements are much more abstract; not just a collection of <item>s
      • Lowest form of any note is the <note> element
        • slightly more general than <document>
      • This presentation focuses on <document>s
    • 6. Example DXL Document
      • <?xml version='1.0' encoding='utf-8'?>
      • <!DOCTYPE document SYSTEM 'xmlschemas/domino_6_5.dtd'>
      • < document xmlns='http://www.lotus.com/dxl' version='7.0' replicaid='85256DF8005772E9' form=' Customer '>
      • < item name='customerid'><text> 00925264444 </text></item>
      • < item name='name'><text> Robert Harold </text></item>
      • < item name='address'><text> 34 Grand Blvd </text></item>
      • < item name='city'><text> Oklahoma City </text></item>
      • < item name='state'><text> OK </text></item>
      • < item name='zip'><text> 73116 </text></item>
      • </document>
    • 7. Example DXL Form
      • <?xml version='1.0' encoding='utf-8'?>
      • <!DOCTYPE form SYSTEM 'xmlschemas/domino_6_5.dtd'>
      • < form name='Simple' xmlns='http://www.lotus.com/dxl' version='7.0' replicaid='85256DF8005772E9‘ publicaccess='false' designerversion='6.5'>
      • < actionbar bgcolor='#ece9d8' bordercolor='black'>
      • < action title='Hello'>< code event='click' >< formula >@Prompt([Ok]; &quot;Sample Action&quot;; &quot;Hello, World&quot;)</formula></code></action>
      • </actionbar>
      • < body >
      • < richtext >
      • <pardef id='1'/>
      • <par def='1'>Text field:
      • < field type='text' kind='editable' name='fieldText'/>
      • </par>
      • </richtext>
      • </body>
      • </form>
    • 8. Example DXL Form as a Note
      • <?xml version='1.0' encoding='utf-8'?>
      • <!DOCTYPE note SYSTEM 'xmlschemas/domino_6_5.dtd'>
      • < note class='form' xmlns='http://www.lotus.com/dxl' version='7.0' replicaid='85256DF8005772E9'>
      • < item name='$HTMLCode' sign='true'>
      • <itemdata type='1'>X/8QAAIADwAHAAAAAAAAAA==</itemdata></item>
      • < item name='$TITLE'><text>Simple</text></item>
      • < item name='$Info' sign='true'><itemdata type='1'>
      • hhgBAIAAAAAAgAAAAQABAP///wAQAAAA</itemdata></item>
      • < item name='$Flags'><text/></item>
      • < item name='$DesignerVersion'><text>6.5</text></item>
      • < item name='$Fields'><text>fieldText</text></item>
      • < item name='$Body' sign='true'><richtext> ... </richtext></item>
      • < item name='$V5ACTIONS' sign='true'>
      • <itemdata type='1'> ... </itemdata></item>
      • </note>
    • 9. XSLT – eXtensible Stylesheet Language Transformations
      • A language and tool for transforming XML into different XML data or other formats (HTML, CSV, etc.)
      • Uses XPath (XML Path Language) to access parts of an XML document (e.g. a specific attribute value)
      XSLT Processor XML document XSLT stylesheet Output document
    • 10. Overview of the Application - Customer Orders
      • Customer and order information in a Domino database
      • Interacts with a USPS (United States Postal Service) server to get shipping rates
      • Generates a report of selected orders in PDF format
      • Exports data to and imports data from an OpenOffice spreadsheet
      • Browses products on amazon.com and generates summary documents
    • 11. Overview of the Database – orders.nsf
      • Customers and Orders views contain the customer data
      • Search Results view contains results of browsing for products
      • Stylesheets view contains XSL stylesheets for the various data transformations in the demos
      • Agents and script libraries contain the code (Java and LotusScript) to export, import, transform to/from DXL
      • Programs view contains configuration information
        • Used by agent and script library code to interface with other software products used in the demos
    • 12. Setup Steps Before Using orders.nsf (1)
      • Download and install prerequisite software
        • PDF Composer – demo uses FOP, Formatting Objects Processor, http://xml.apache.org/fop
        • PDF Viewer – demo uses Adobe Reader, http://www.abobe.com/products/acrobat/readermain.html
        • OpenOffice – http://www.openoffice.org
        • Zip and Unzip utilities
      • Create/edit documents in Programs view that specify location of and how to invoke the above programs
    • 13. Setup Steps Before Using orders.nsf (2)
      • Obtain a USPS UserId and Password for making Web service rate requests
        • http://www.uspswebtools.com/registration
        • Demo code obtains this data from plain text files C:demoUspsUserId.txt and C:demoUspsPassword.txt
      • Obtain an Amazon Developer Token for making Web service product searches
        • http://www.amazon.com – click on Web Services link
        • Demo code obtains this data from plain text file C:demoAmazonDeveloperToken.txt
    • 14. Summary of Demos
      • Use a USPS Web service API to obtain postage amounts for packages, and update the Domino order documents
      • Format order information into XSL:FO (Formatting Objects) and use a third party tool to translate into a PDF document
      • Export order information to an OpenOffice spreadsheet; Modify orders and import changes back into Domino
      • Use an Amazon Web service to browse for products and summarize results in a tabular format in a Domino document
    • 15. Demo 1: USPS Web Service
      • USPS provides a Web service for calculating shipping costs based on size and weight of package, source and destination shipping locations, and other parameters
        • Request is made via a standard URL that contains a <RateRequest> in XML format
        • USPS Web server answers back with a <RateResponse> in XML format
      • Domino XSLT and DXL support is used to update order documents with shipping cost
    • 16. Demo 1: USPS Web Service DXL Importer RateRequest URL Domino Order documents USPS Web Service Rate Response XML RateResponse 2Document XSL DXL documents (updates) XSLT Processor
    • 17. Demo 1: Code Summary
      • Calculate Shipping agent (Java)
      • See Java Debug Console for URL built by the code from data in Domino documents
      • URLLoader class from JavaUtilClasses script library loads the URL – response captured in C: mpRateResponse.xml
      • XSLTTransformer class from JavaUtilClasses script library transforms the response into DXL – see C: mpUpdates.dxl
        • Uses transformXML method of Item class to do transform
      • Transform used is RateResponse2Document.xsl in Stylesheets view
      • DxlImporter updates documents with shipping data
    • 18. Demo 1: Calculate Shipping agent (Java)
      • // Build the request URL.
      • ...
      • // Load rate request URL and capture the response to a file.
      • URLLoader urlLoader = new URLLoader();
      • urlLoader.load(url, rateResponseXmlFile);
      • ...
      • // Transform the response into DXL to update order documents.
      • XSLTTransformer transformer = new XSLTTransformer(session);
      • transformer.transform(rateResponseXmlFile, db, response2DocumentXsl, updatesDxlFile);
      • ...
      • // Import the DXL file in UPDATE_ELSE_IGNORE mode.
      • DxlImporter importer = session.createDxlImporter();
      • importer.importDxl(dxlStream, db);
    • 19. Demo 1: Sample Request URL
      • http://production.shippingapis.com/ShippingAPI.dll?API=Rate&XML=< RateRequest %20USERID=‘XXXXXXXXXXXX'%20PASSWORD=‘XXXXXXXXXXXX'>< Package %20ID=' 31D95736B4AC17F985256E000055258D '><Service> Priority </Service><ZipOrigination> 01886 </ZipOrigination><ZipDestination> 53204 </ZipDestination><Pounds> 3 </Pounds><Ounces> 0 </Ounces><Container> None </Container><Size> Regular </Size><Machinable> True </Machinable>< /Package > </RateRequest >
    • 20. Demo 1: URLLoader class
      • public class URLLoader
      • {
      • public void load(String urlString, String filename) throws java.net.MalformedURLException, java.io.IOException
      • {
      • InputStream in = null;
      • OutputStream out = null;
      • // A nice Java class makes this easy to do.
      • URL url = new URL(urlString);
      • in = url.openStream();
      • out = new FileOutputStream(filename);
      • // Read up the response and write it to the specified file.
      • ...
      • }
      • }
    • 21. Demo 1: Sample RateResponse.xml
      • <?xml version=&quot;1.0&quot; ?>
      • <RateResponse>
      • < Package ID=&quot; 31D95736B4AC17F985256E000055258D &quot;>
      • <Service> Priority </Service>
      • <ZipOrigination> 01886 </ZipOrigination>
      • <ZipDestination> 53204 </ZipDestination>
      • <Pounds> 3 </Pounds>
      • <Ounces> 0 </Ounces>
      •   <Container> NONE </Container>
      • <Size> REGULAR </Size>
      • <Machinable> TRUE </Machinable>
      • <Zone> 5 </Zone>
      • < Postage > 6.85 </Postage>
      • </Package>
      • </RateResponse>
    • 22. Demo 1: XSLTTransformer class
      • public void transform(String xmlFilename, Database xsltDb, String xsltDocumentName, String outFilename)
      • throws NotesException, FileNotFoundException, IOException
      • {
      • Database db = mSession.getDatabase(null, scratchDbName, true);
      • Document doc = db.createDocument();
      • // Copy the input file to a text item.
      • ...
      • Item xmlItem = doc.replaceItemValue(&quot;XMLSource&quot;, sb.toString());
      • // Create an InputSource from the String containing the XSLT.
      • String xsltStr = Util.getStylesheet(xsltDb, xsltDocumentName);
      • StringReader xsltRdr = new StringReader(xsltStr);
      • InputSource xslt = new InputSource(xsltRdr);
      • // Create an XSLTResultTarget from a FileOutputStream for the output file.
      • FileOutputStream outStm = new FileOutputStream(outFilename);
      • XSLTResultTarget out = new XSLTResultTarget(outStm);
      • // Transform the XML in the item, using the xslt object, to the output object.
      • xmlItem.transformXML(xslt, out);
      • }
    • 23. Demo 1: Sample Updates.dxl
      • <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
      • <!DOCTYPE database SYSTEM &quot;xmlschemas/domino_6_5.dtd&quot;>
      • < database xmlns=&quot;http://www.lotus.com/dxl&quot; version=&quot;6.0&quot;>
      • < document >
      • <noteinfo unid =&quot; 5B4B18957C93FA5E85256DF8005B8D17 &quot;/>
      • < item name=&quot; shipping &quot;><number> 4.90 </number></item>
      • </document>
      • < document >
      • <noteinfo unid =&quot; 31D95736B4AC17F985256E000055258D &quot;/>
      • < item name=&quot; shipping &quot;><number> 6.85 </number></item>
      • </document>
      • </database>
    • 24. Demo 1: RateResponse2Document.xsl
      • <xsl:template match=&quot;Package&quot;>
      • <xsl:element name=&quot; document &quot; namespace=&quot;http://www.lotus.com/dxl&quot;>
      • <xsl:element name=&quot; noteinfo &quot; namespace=&quot;http://www.lotus.com/dxl&quot;>
      • <xsl:attribute name=&quot; unid &quot;>
      • <xsl:value-of select=&quot;@ID&quot;/>
      • </xsl:attribute>
      • </xsl:element>
      • <xsl:apply-templates select=&quot;Postage&quot;/>
      • </xsl:element>
      • </xsl:template>
      • <xsl:template match=&quot;Postage&quot;>
      • <xsl:element name=&quot; item &quot; namespace=&quot;http://www.lotus.com/dxl&quot;>
      • <xsl:attribute name=&quot; name &quot;>shipping</xsl:attribute>
      • <xsl:element name=&quot; number &quot; namespace=&quot;http://www.lotus.com/dxl&quot;>
      • <xsl:value-of select=&quot;text()&quot;/>
      • </xsl:element>
      • </xsl:element>
      • </xsl:template>
    • 25. Demo 2: XSL:FO and PDF
      • XSL:FO (Formatting Objects) describes the visual layout of a document in XML
      • PDF (Portable Document Format) is a widely used document format on the Web
      • Various utilities are available to translate from XSL:FO to PDF (and other formats)
      • Domino DXL and XSLT support is used to generate a PDF report from selected Domino documents
    • 26. Demo 2: XSL:FO and PDF DXL Exporter FOP (Apache) Domino Order documents XSLT Processor Orders2FO XSL orders.pdf orders.fo DXL documents
    • 27. Demo 2: Code Summary
      • CreatePDFReport agent (LotusScript)
      • ExportAndTransform subroutine in ls2004 script library runs NotesDXLExporter and NotesXSLTransformer in a pipeline; result is XSL:FO document in C: mporders.fo
      • Transform used is orders2fo.xsl in Stylesheets view
      • RunProgramMin subroutine in ls2004 script library translates this using FOP (Apache Formatting Objects Processor); result is PDF document in C: mporders.pdf
      • PDF document is automatically displayed
    • 28. Demo 2: CreatePDFReport agent
      • Sub Initialize
      • Dim session As New NotesSession
      • Dim db As NotesDatabase
      • Set db = session.CurrentDatabase
      • Call ExportAndTransform(db.UnprocessedDocuments, &quot;orders2fo.xsl&quot;, &quot;c: mporders.fo&quot;)
      • Call RunProgramMin(&quot;PDF COMPOSER&quot;, &quot;c: mp&quot;, &quot;-fo orders.fo&quot;, &quot;-pdf orders.pdf&quot;)
      • Call RunProgramMax(&quot;PDF READER&quot;, &quot;c: mp&quot;, &quot;orders.pdf&quot;, &quot;&quot;)
      • End Sub
    • 29. Demo 2: ExportAndTransform
      • Sub ExportAndTransform(collection As NotesDocumentCollection, stylesheet As String, outputFile As String)
      • Dim session As New NotesSession
      • Dim exporter As NotesDXLExporter
      • Dim xslt As NotesXSLTransformer
      • Dim ostream As NotesStream
      • ' Create DXLO->XSLT->File pipeline that processes the specified collection
      • Set exporter = session.CreateDXLExporter(collection)
      • exporter.OutputDOCTYPE = False
      • Set xslt = session.CreateXSLTransformer(exporter, GetStylesheet(stylesheet))
      • Set ostream = session.CreateStream
      • ostream.Open (outputFile)
      • ostream.Truncate
      • Call xslt.SetOutput(ostream)
      • ' Run the pipeline
      • On Error Goto errh
      • exporter.Process
      • End Sub
    • 30. Demo 2: Sample orders.fo fragment
      • <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
      • < fo:root xmlns:fo=&quot;http://www.w3.org/1999/XSL/Format&quot; xmlns:dxl=&quot;http://www.lotus.com/dxl&quot;>
      • < fo:layout-master-set >
      • <fo:simple-page-master margin-right=&quot;1in&quot; margin-left=&quot;1in&quot; ... master-name=&quot;first&quot;>
      • <fo:region-body region-name=&quot;body&quot;/>
      • </fo:simple-page-master>
      • < /fo:layout-master-set >
      • < fo:page-sequence master-reference=&quot;first&quot;>
      • < fo:flow flow-name=&quot;body&quot;>
      • < fo:block ... color=&quot;blue&quot;>Order: 10092919922 < /fo:block >
      • < fo:block ... font-weight=&quot;bold&quot;>date: 20031006 < /fo:block >
      • ...
      • < /fo:flow >
      • < /fo:page-sequence >
      • < /fo:root >
    • 31. Demo 2: orders2fo.xsl fragment
      • <xsl:template match=&quot;dxl:item&quot;>
      • <xsl:choose>
      • <xsl:when test=&quot;@name = 'total' or @name = 'shipping'&quot; >
      • <xsl:call-template name=&quot;currencyfield&quot;>
      • <xsl:with-param name=&quot;name&quot; select=&quot;@name&quot; />
      • <xsl:with-param name=&quot;value&quot;>
      • <xsl:value-of select=&quot;.&quot;/> </xsl:with-param>
      • </xsl:call-template>
      • </xsl:when>
      • <xsl:otherwise>
      • <xsl:call-template name=&quot;field&quot;>
      • <xsl:with-param name=&quot;name&quot; select=&quot;@name&quot; />
      • <xsl:with-param name=&quot;value&quot;>
      • <xsl:value-of select=&quot;.&quot;/> </xsl:with-param>
      • </xsl:call-template>
      • </xsl:otherwise>
      • </xsl:choose>
      • </xsl:template>
    • 32. Demo 2: RunProgram
      • Sub RunProgram (description As String, wdir As String,
      • Arg1 As String, Arg2 As String, mode As Integer)
      • ...
      • Set db = session.currentdatabase
      • Set view = db.getView (&quot;Programs&quot;)
      • Set doc = view.getDocumentByKey(description)
      • programName = doc.GetItemValue(&quot;program&quot;)
      • fullProgramName = programName(0) & &quot; &quot; & Arg1 & &quot; &quot; & Arg2
      • Chdir wdir
      • result = Shell (fullProgramName, mode)
      • End Sub
    • 33. Demo 3: OpenOffice Spreadsheet
      • OpenOffice is an open-source, multi-platform office productivity suite
        • OpenOffice data is natively stored in XML
        • “ subdocument format” of OpenOffice file used in demo is a zip file of 4 .xml files – meta, styles, content, and settings
          • demo assumes pre-existing document and only modifies content.xml
      • Domino DXL and XSLT support is used to export to a spreadsheet, modify some data, and import back into Domino
    • 34. Demo 3: OpenOffice Spreadsheet DXL Exporter DXL Importer XSL Transformer ZIP UNZIP update/ create mode Edit existing orders or create new orders Domino Order documents DXL docs O2S XSL S2O XSL content .xml orders.sxc
    • 35. Demo 3: Code Summary
      • ExportToSpreadsheet agent (LotusScript)
      • ExportAndTransform subroutine runs DXL Exporter and XSL Transformer (with orders2spreadsheet.xsl) yielding C: mpcontent.xml (content portion of OpenOffice file)
      • Zip utility replaces content.xml in content.sxc, which can then be edited using OpenOffice
      • ImportFromSpreadsheet agent (LotusScript)
      • Unzip utility extracts content.xml from content.sxc
      • Transformer (with spreadsheet2orders.xsl) creates DXL
      • DXL is processed with NotesDOMParser to add unids
      • DXL Importer updates/creates order documents
    • 36. Demo 3: ExportToSpreadsheet
      • Sub Initialize
      • Dim session As New NotesSession
      • Dim db As NotesDatabase
      • Set db = session.CurrentDatabase
      • Call ExportAndTransform(db.UnprocessedDocuments, &quot;orders2spreadsheet.xsl&quot;, &quot;c: mpcontent.xml&quot;)
      • Call RunProgramMin(&quot;ZIP&quot;, &quot;c: mp&quot;, &quot;orders.sxc&quot;, &quot;content.xml&quot;)
      • Call RunProgramMax(&quot;SPREADSHEET&quot;, &quot;c: mp&quot;, &quot;orders.sxc&quot;, &quot;&quot;)
      • End Sub
    • 37. Demo 3: Sample content.xml fragment
      • < office:document-content … >
      • < office:body >
      • < table:table table:name=&quot;Sheet1&quot;>
      • < table:table-column … />
      • < table:table-row >
      • < table:table-cell table:value-type=&quot;currency&quot; table:currency=&quot;USD&quot; table:value=&quot; 6.85 &quot;/>
      • </ table:table-row >
      • </ table:table >
      • </ office:body >
      • </ office:document-content >
    • 38. Demo 3: orders2spreadsheet.xsl fragment
      • <xsl:template match=&quot;dxl:database&quot;>
      • < office:document-content office:class=&quot;spreadsheet&quot; office:version=&quot; 1.0 &quot;>
      • < office:body >
      • < table:table table:name=&quot;Sheet1&quot;>
      • <!-- Insert the header row   -->
      • <xsl:apply-templates select=&quot;dxl:document&quot; />
      • < /table:table >
      • < /office:body >
      • < /office:document-content >
      • </xsl:template>
    • 39. Demo 3: ImportFromSpreadsheet agent
      • Sub Initialize
      • Set xslt = session.CreateXSLTransformer(istream, GetStylesheet(&quot;spreadsheet2orders.xsl&quot;))
      • Set parser = session.CreateDOMParser(xslt)
      • Set importer = session.CreateDXLImporter(parser, db)
      • importer.DocumentImportOption = DXLIMPORTOPTION_REPLACE_ELSE_CREATE
      • importer.ReplicaRequiredForReplaceOrUpdate = False
      • On Event PostDOMParse From parser Call processTree
      • ' Run the pipeline
      • On Error Goto errh
      • xslt.Process
      • End Sub
    • 40. Demo 3: processTree
      • Sub processTree (parser As NotesDOMParser)
      • ...
      • ' Walk all documents in the tree and insert UNID attrs based on orderid
      • Set documents = parser.Document.GetElementsByTagName(&quot;document&quot;)
      • For i = 1 To documents.NumberOfEntries
      • ' Lookup <item> with name='orderid' and get orderid value
      • ...
      • ' Lookup document by orderid
      • Set doc = view.GetDocumentByKey(orderid)
      • ' If found then add a <noteinfo> child element with the unid to docEl
      • If Not doc Is Nothing Then
      • Set el = parser.Document.CreateElementNode(&quot;noteinfo&quot;)
      • Call el.SetAttribute(&quot;unid&quot;, doc.UniversalID)
      • ...
      • End If
      • Next
      • ' Write the DOM tree to the parser's output object
      • parser.Serialize
      • End Sub
    • 41. Demo 3: spreadsheet2orders.xsl fragment
      • <xsl:variable name=&quot;SheetName&quot;>Sheet1</xsl:variable>
      • <xsl:template match=&quot;office:document-content&quot;>
      • < database version=&quot;7.0&quot;>
      • <!-- Map each row in the table to a document -->
      • <xsl:apply-templates select=&quot;office:body/table:table[@table:name = $SheetName]/table:table-row[position() > 1]&quot;/>
      • < /database >
      • </xsl:template>
      • <xsl:template match=&quot;table:table-row&quot;>
      • < document form=&quot;Order&quot;>
      • <xsl:apply-templates select=&quot;table:table-cell[position() &lt; 8]&quot;/>
      • < /document >
      • </xsl:template>
    • 42. Demo 4: Amazon Web Service
      • amazon.com provides a Web service API for searching for product information
        • request is made via a standard URL that specifies the parameters of the search
        • Amazon Web server answers back with a <ProductInfo> document in XML format
      • Domino XSLT and DXL support is used to create a SearchResult document in Domino with a rich, tabular format of the search results
        • for simplicity, only the first 10 matches are captured in the results
    • 43. Demo 4: Amazon Web Service Amazon Web service XSLT Processor Keyword Search URL DXL Importer Browse Products dialog Product Info XML ProductInfo 2Document XSL Domino Search Result document DXL Search Result Document
    • 44. Demo 4: Code Summary
      • Search Products agent (Java)
      • Builds a request URL from data provided in a Browse Products document (see Java Debug Console for URL)
      • URLLoader class from JavaUtilClasses script library loads the URL – response in C: mpSearchResponse.xml
      • XSLTTransformer class from JavaUtilClasses transforms response into DXL – see C: mpResponseDocument.dxl
      • Transform uses ProductInfo2Document.xsl in Stylesheets view
      • DxlImporter is used to create a Domino Search Result document summarizing the search results in a table
    • 45. Demo 4: Search Products agent
      • ...
      • // Build the request URL.
      • url += &quot;http://xml.amazon.com/onca/xml3?t=XYZ&dev-t=&quot;;
      • ...
      • // Load the URL for the rate request and capture the response to a file.
      • URLLoader urlLoader = new URLLoader();
      • urlLoader.load(url, searchResponseXmlFile);
      • // Transform the response into a DXL document containing the links in a
      • // tabular format within rich text.
      • XSLTTransformer transformer = new XSLTTransformer(session);
      • transformer.transform(searchResponseXmlFile, agentContext.getCurrentDatabase(), productInfo2DocumentXsl, documentDxlFile);
      • // Open the DXL file just created.
      • Stream dxlStream = session.createStream();
      • dxlStream.open(documentDxlFile);
      • // Import the DXL file which will create a new Search Result document.
      • Database db = agentContext.getCurrentDatabase();
      • DxlImporter importer = session.createDxlImporter();
      • importer.importDxl(dxlStream, db);
      • ...
    • 46. Demo 4: Sample URL
      • http://xml.amazon.com/onca/xml3?t=XYZ&dev-t=XXXXXXXXXXXXXX&KeywordSearch= meyers %20 effective &mode= books &type=lite&page=1&f=xml
    • 47. Demo 4: Sample SearchResponse.xml
      • < ProductInfo ...>
      • <Request> ... </Request>
      • <TotalResults>10</TotalResults>
      • <TotalPages>1</TotalPages>
      • < Details url=&quot; http://www.amazon.com/exec/obidos/ASIN/... &quot;>
      • ...
      • < ProductName > Effective C++: 50 Specific Ways to Improve Your Programs and Design (2nd Edition) </ProductName>
      • <Catalog>Book</Catalog>
      • <Authors>
      • < Author > Scott Meyers </Author>
      • </Authors>
      • ...
      • < OurPrice > $35.50 </OurPrice>
      • ...
      • < /Details >
      • ...
      • < /ProductInfo >
    • 48. Demo 4: Sample ResponseDocument.dxl
      • <document xmlns=&quot;http://www.lotus.com/dxl&quot; version=&quot;6.5&quot; form=&quot;Search Result&quot;>
      • <item name=&quot;Keywords&quot;><text>meyers effective</text></item>
      • <item name=&quot;ProductType&quot;><text>books</text></item>
      • <item name=&quot;SearchResults&quot;>
      • <richtext>
      • <pardef keeptogether=&quot;true&quot; keepwithnext=&quot;true&quot; id=&quot;2&quot;/>
      • <table columnspacing=&quot;0.1000in&quot; rowspacing=&quot;0.0500in&quot; widthtype=&quot;fitmargins&quot;>
      • <tablecolumn width=&quot;55%&quot;/>
      • <tablecolumn width=&quot;45%&quot;/>
      • <tablecolumn width=&quot;0.75in&quot;/>
      • ...
      • <tablerow>
      • <tablecell>
      • <par def=&quot;2&quot;>
      • <urllink href= &quot;http://www.amazon.com/exec/obidos/ASIN/...&quot; >
      • <run><font color=&quot;system&quot;/> Effective C++: 50 Specific Ways to Improve Your Programs and Design (2nd Edition) </run>
      • </urllink>
      • </par>
      • </tablecell>
      • ...
      • </document>
    • 49. Demo 4: ProductInfo2Document.xsl fragment
      • <xsl:template match=&quot;Details&quot;>
      • <xsl:element name=&quot; tablerow &quot; xmlns=&quot; http://www.lotus.com/dxl &quot;>
      •   <xsl:apply-templates select=&quot;ProductName|Manufacturer|OurPrice&quot; />
      •   </xsl:element>
      • </xsl:template>
      • <!-- Map the product name to a URL link which links to the product info.   -->
      • <xsl:template match=&quot;ProductName&quot;>
      • <xsl:element name=&quot; tablecell &quot; xmlns=&quot; http://www.lotus.com/dxl &quot;>
      • < par def=&quot; 2 &quot;>
      • <xsl:element name=&quot; urllink &quot; xmlns=&quot; http://www.lotus.com/dxl &quot;>
      • <xsl:attribute name=&quot; href &quot;>
      • <xsl:value-of select=&quot;../@url&quot; />
      • </xsl:attribute>
      • < run >
      • < font color=&quot;system&quot; />
      •   <xsl:value-of select=&quot;text()&quot; />
      •   </run>
      •   </xsl:element>
      •   </par>
      •   </xsl:element>
      • </xsl:template>
    • 50. Summary
      • DXL was used to integrate with several applications
        • Made possible by the wide use of XML as a standard data format
      • XSLT was a central player because it is a powerful tool for transforming XML
        • Also possible to use DOM or SAX parsers or to process XML directly
      • Java examples illustrated the Item.transformXML method and the DxlImporter class
      • LotusScript examples showed the NotesDXLExporter, NotesXSLTransformer, NotesDOMParser, and NotesDXLImporter classes
      • DXL is a powerful integration tool
    • 51. Q & A
      • [email_address]
      • Use the Notes/Domino forum to exchange ideas
        • Uses of DXL
        • Things you’d like to see demoed in the future
        • DXL and XML features you’d like to see in Notes/Domino
        • Problems and workarounds
        • Etc.