AD212 Introduction to DXL Dick Annicchiarico Software Engineer IBM Lotus Domino
Agenda <ul><li>What is DXL? </li></ul><ul><li>How do I use it? </li></ul><ul><li>What can it do for me? </li></ul>Agenda s...
What is DXL?
DXL is XML <ul><li>DXL is the Domino XML Language </li></ul><ul><li>DXL is an XML representation of Domino data </li></ul>...
What is XML?
XML: eXtensible Markup Language <ul><li>XML is a markup language </li></ul><ul><li>A markup language </li></ul><ul><ul><li...
Key XML Concepts <ul><li>XML represents data and structure, not presentation/formatting </li></ul><ul><ul><li>HTML can def...
Markup Example (HTML) <ul><li><html> </li></ul><ul><li><body> </li></ul><ul><li><h2> </li></ul><ul><li>This is a level 2 h...
Markup Example (XML) <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> <...
XML Basic Constructs <ul><li>XML declaration </li></ul><ul><li>Elements </li></ul><ul><li>Attributes </li></ul><ul><li>Tex...
XML Declaration <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> </li><...
Elements <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> </li></ul><ul...
Root Element <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> </li></ul...
Attributes <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> </li></ul><...
Text Content <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> </li></ul...
A Quick Note on White Space <ul><li>Maybe. </li></ul><ul><li>Yes, if schema allows for mixed content (elements and text) w...
Tree Structure of XML <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <presentation> <slide title=&quot;Markup ...
A Quick Note on DTDs and Schemas <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><pre...
Well-formed vs. Valid XML <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <presentation> <slide title=&quot;Mar...
<ul><li>You now know all of the important </li></ul><ul><li>things about XML.  So… </li></ul>What is DXL?
You Already Know A Lot About DXL Earlier, we learned that: <ul><li>DXL is the Domino XML Language </li></ul><ul><li>DXL is...
What Data Can DXL Represent? <ul><li>Documents </li></ul><ul><ul><li>including rich text </li></ul></ul><ul><li>Most desig...
About the Examples <ul><li>Examples are in a database  Baseball2004.nsf </li></ul><ul><ul><li>Major League Baseball battin...
A First DXL Example <ul><li>Open the baseball database in the Designer </li></ul><ul><li>Select a form and do Tools – DXL ...
How do I use DXL?
Tools for Processing XML and DXL XML DXL Application-specific (e.g.  DXL Importer ) Import some data from XML format XSLT ...
How do I use XML? First of all:
DOM: Document Object Model <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <presentation> <slide title=&quot;Ma...
SAX: Simple API for XML <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <presentation> <slide title=&quot;Marku...
XSLT: Extensible Stylesheet Language:   Transformations <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <presen...
How do I use DXL? Now back to:
Tools for Processing DXL <ul><li>Designer Tools – DXL Utilities menu </li></ul><ul><li>Web server URL command: ?ReadViewEn...
Designer Tools – DXL Utilities menu <ul><li>Exporter: exports the design note to a file in DXL format </li></ul><ul><li>Vi...
Example:  Tools – DXL Utilities – Exporter <ul><li>Export PlayerBasic form to file C:ls06PlayerBasic.xml </li></ul><ul><li...
Tips on Using DXL and Other XML Files <ul><li>Name DXL files with  .xml  extension for XML-aware tools </li></ul><ul><li>S...
Example:  Tools – DXL Utilities – Transformer <ul><li>Sample result on right </li></ul><ul><li>FormFieldSummary.xslt is th...
Domino Web Server Command:  ReadViewEntries <ul><li>Request view entries in DXL format with URL command: http:// server-na...
LotusScript APIs <ul><li>Export, Import, XSLT, SAX, DOM </li></ul>
Java APIs - Domino <ul><li>Export, Import, XSLT, DOM </li></ul>DxlExporter DxlImporter Document generateXML Session Item p...
C APIs <ul><li>Export, Import, XSLT </li></ul>XSLTAddParameter XSLTCreateTransform XSLTGetTransformProperty XSLTSetTransfo...
Conceptual View of DXL Exporter Exporter Input Object Output Object (contains DXL) <ul><li>database </li></ul><ul><li>docu...
Conceptual View of DXL Importer Importer Input Object (Contains DXL) <ul><li>database </li></ul>Options <ul><li>create/rep...
Tips on API Language Trade-offs <ul><li>LotusScript has the most options for output objects </li></ul><ul><li>LotusScript ...
What Can DXL Do For Me?
Some Uses For DXL <ul><li>Reporting </li></ul><ul><li>Integration with other apps </li></ul><ul><li>Archival and restoring...
DXL is an Alternative to Other Mechanisms <ul><li>DXL is not necessarily the best choice </li></ul><ul><ul><li>LotusScript...
Let’s Look at Some API Examples <ul><li>Examples are all agents in the Baseball2004 database </li></ul><ul><li>Available o...
Example: Archival and Restoring <ul><li>This Java agent imports the DXL into a new database, DXLCopy.nsf </li></ul><ul><li...
The Java DXL Exporter Code from Action 1 <ul><li>later </li></ul>public class JavaAgent extends AgentBase { public void No...
Tips on Archival and Restoring With DXL <ul><li>Not the best solution if 100% full fidelity is required </li></ul><ul><li>...
Replacing Notes With DXL <ul><li>Currently, the PlayerBasic form looks like this </li></ul><ul><li>I’d like to improve the...
Figuring Out How to Specify Changes in DXL <ul><li>See the view:  4. Rich Text Sandbox </li></ul><ul><ul><li>contains docu...
Import Example: Replace Form <ul><li>We determined that the changes needed are: </li></ul><ul><ul><li>add  color=‘blue’  o...
Import Example: Create View <ul><li>Suppose we want to  programmatically create a view similar to  2. Basic Statistics  wi...
Tips For Importing Design Notes <ul><li>DXL Importer  ignores  design notes by default </li></ul><ul><ul><li>use DesignImp...
LotusScript Code for Import/Replace demo <ul><li>Dim session As New NotesSession </li></ul><ul><li>Dim db As NotesDatabase...
Programmatic Examples of Modifying the DXL <ul><li>We cheated on the last example </li></ul><ul><ul><li>we did the DXL Imp...
Updating Notes With DXL <ul><li>Pretend David Ortiz really hit 50 homeruns </li></ul><ul><li>Import this DXL in UPDATE mod...
Update/Replace Document Demo <ul><li>Select David Ortiz document from  2. Basic Statistics  view </li></ul><ul><li>Run  3....
Tips For Importing Documents <ul><li>DXL Importer  creates  new documents by default </li></ul><ul><ul><li>use DocumentImp...
Transforming DXL to Other XMLs <ul><li>Select some documents </li></ul><ul><li>Run  8. Export selected documents (PlayersD...
How To Transform DXL to Excel XML Format <ul><li>Learn Excel’s XML format the easy way </li></ul><ul><ul><li>create a mini...
DXL to Excel XML Mapping Armed with this data, I created an XSLT style sheet to convert a set of DXL documents to an Excel...
Transforming DXL to Excel Demo <ul><li>Run  9. Export/Transform selected documents (PlayersExcel.xml) </li></ul><ul><li>In...
Tips On Transforming Between XMLs  <ul><li>Learn XSLT </li></ul><ul><li>Buy books to help you </li></ul><ul><li>Develop yo...
Want More? <ul><li>Meet the Speakers –  Europe 8 </li></ul><ul><li>Meet the Developers lab –  Dolphin Asia 1 </li></ul><ul...
Upcoming SlideShare
Loading in …5
×

Lotusphere 2006 AD212 Introduction to DXL

2,223 views

Published on

Published in: Technology, News & Politics
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,223
On SlideShare
0
From Embeds
0
Number of Embeds
24
Actions
Shares
0
Downloads
49
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Lotusphere 2006 AD212 Introduction to DXL

  1. 1. AD212 Introduction to DXL Dick Annicchiarico Software Engineer IBM Lotus Domino
  2. 2. Agenda <ul><li>What is DXL? </li></ul><ul><li>How do I use it? </li></ul><ul><li>What can it do for me? </li></ul>Agenda slide
  3. 3. What is DXL?
  4. 4. DXL is XML <ul><li>DXL is the Domino XML Language </li></ul><ul><li>DXL is an XML representation of Domino data </li></ul><ul><li>To understand DXL, you need to understand the basics of XML </li></ul>
  5. 5. What is XML?
  6. 6. XML: eXtensible Markup Language <ul><li>XML is a markup language </li></ul><ul><li>A markup language </li></ul><ul><ul><li>is a text format </li></ul></ul><ul><ul><li>has special syntax (“markup”) for the structure and meaning of the data </li></ul></ul><ul><ul><li>also represents the data itself </li></ul></ul><ul><li>Markup languages are popular because </li></ul><ul><ul><li>they are plain text </li></ul></ul><ul><ul><li>they are easy to use </li></ul></ul><ul><ul><li>parsers and tools are usually widely available </li></ul></ul>
  7. 7. Key XML Concepts <ul><li>XML represents data and structure, not presentation/formatting </li></ul><ul><ul><li>HTML can define both </li></ul></ul><ul><li>XML is not a single language, it provides for a family of languages </li></ul><ul><ul><li>XML spec. defines syntax and structure rules, but no specific markup </li></ul></ul><ul><ul><li>application designer defines specific markup </li></ul></ul><ul><ul><li>that is why XML is extensible </li></ul></ul><ul><ul><li>the number of XML vocabularies is unlimited </li></ul></ul>
  8. 8. Markup Example (HTML) <ul><li><html> </li></ul><ul><li><body> </li></ul><ul><li><h2> </li></ul><ul><li>This is a level 2 heading. </li></ul><ul><li></h2> </li></ul><ul><li><p> </li></ul><ul><li>This is a paragraph with some <i> italic </i> text. </li></ul><ul><li></p> </li></ul><ul><li></body> </li></ul><ul><li></html> </li></ul>Some HTML markup specifies presentation details. Here, <i> specifies italic text. <ul><li>The actual data is shown in color </li></ul><ul><li>The rest is markup </li></ul><ul><ul><li>HTML spec. defines this markup </li></ul></ul>
  9. 9. Markup Example (XML) <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> </li></ul><ul><li><slide title=&quot; Markup Example ”> </li></ul><ul><li><bullet> Captivating point 1. </bullet> </li></ul><ul><li><bullet> Captivating point 2. </bullet> </li></ul><ul><li></slide> </li></ul><ul><li></presentation> </li></ul><ul><li>The actual data is shown in color </li></ul><ul><li>The rest is markup </li></ul><ul><ul><li>XML spec. does not define this markup </li></ul></ul><ul><ul><li>This is a hypothetical XML “vocabulary” that I made up </li></ul></ul>
  10. 10. XML Basic Constructs <ul><li>XML declaration </li></ul><ul><li>Elements </li></ul><ul><li>Attributes </li></ul><ul><li>Text Content </li></ul>
  11. 11. XML Declaration <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> </li></ul><ul><li><slide title=&quot;Markup Example”> </li></ul><ul><li><bullet>Captivating point 1.</bullet> </li></ul><ul><li><bullet>Captivating point 2.</bullet> </li></ul><ul><li></slide> </li></ul><ul><li></presentation> </li></ul><ul><li>Specifies the version and encoding of the XML document </li></ul><ul><li>Latest XML version is 1.1 but 1.0 is still the most widely used </li></ul><ul><li>utf-8 and utf-16 are the most popular character encodings </li></ul>
  12. 12. Elements <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> </li></ul><ul><li><slide title=&quot;Markup Example” > </li></ul><ul><li><bullet> Captivating point 1. </bullet> </li></ul><ul><li><bullet> Captivating point 2. </bullet> </li></ul><ul><li></slide> </li></ul><ul><li></presentation> </li></ul><ul><li>Begin with a start tag (<name>) and end with an end tag (</name>) </li></ul><ul><li>Have content between the start and end tags </li></ul><ul><li>Describe a hierarchical structure of the data </li></ul><ul><li>XML spec. does not define the element (tag) names; the developer of the XML vocabulary does </li></ul><ul><li>A DTD or schema formally defines the XML vocabulary – what it can and can’t contain </li></ul>
  13. 13. Root Element <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> </li></ul><ul><li><slide title=&quot;Markup Example”> </li></ul><ul><li><bullet>Captivating point 1.</bullet> </li></ul><ul><li><bullet>Captivating point 2.</bullet> </li></ul><ul><li></slide> </li></ul><ul><li></presentation> </li></ul><ul><li>The entire XML is called the XML document </li></ul><ul><li>An XML document has exactly one root element </li></ul><ul><li>The root element is also called the document element </li></ul>
  14. 14. Attributes <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> </li></ul><ul><li><slide title=&quot;Markup Example” > </li></ul><ul><li><bullet>Captivating point 1.</bullet> </li></ul><ul><li><bullet>Captivating point 2.</bullet> </li></ul><ul><li></slide> </li></ul><ul><li></presentation> </li></ul><ul><li>Have the syntax attribute-name =“ attribute-value ” </li></ul><ul><li>Value contains additional data for the element </li></ul><ul><li>XML spec. does not define attribute names; the developer of the XML vocabulary does </li></ul><ul><li>Use of attributes versus elements is a design trade-off; could have done: <title> Markup Example </title> </li></ul>
  15. 15. Text Content <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> </li></ul><ul><li><slide title=&quot;Markup Example”> </li></ul><ul><li><bullet> Captivating point 1. </bullet> </li></ul><ul><li><bullet> Captivating point 2. </bullet> </li></ul><ul><li></slide> </li></ul><ul><li></presentation> </li></ul><ul><li>Text that is between an element’s start and end tags </li></ul><ul><li>Comprises most of the real data in typical XML documents </li></ul><ul><li><bullet> element contains text </li></ul><ul><li>Does <slide> element contain text? </li></ul>
  16. 16. A Quick Note on White Space <ul><li>Maybe. </li></ul><ul><li>Yes, if schema allows for mixed content (elements and text) which is fairly rare </li></ul><ul><li>No, if schema allows for element content only </li></ul><ul><li>Something to be careful about! </li></ul>Is this white space significant? It is convenient to indent your XML to reflect the structure, but don’t do it within elements that allow mixed content or text content only (like <bullet>)
  17. 17. Tree Structure of XML <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <presentation> <slide title=&quot;Markup Example”> <bullet>Captivating point 1.</bullet> <bullet>Captivating point 2.</bullet> </slide> </presentation> If <slide> does not allow mixed content If <slide> allows mixed content (text and elements) presentation slide bullet bullet text text presentation slide text bullet text text bullet text text
  18. 18. A Quick Note on DTDs and Schemas <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> </li></ul><ul><li><presentation> </li></ul><ul><li><slide title=&quot;Markup Example”> </li></ul><ul><li><bullet>Captivating point 1.</bullet> </li></ul><ul><li><bullet>Captivating point 2.</bullet> </li></ul><ul><li></slide> </li></ul><ul><li></presentation> </li></ul><ul><li><presentation> is the root element </li></ul><ul><li>it contains a sequence of <slide> elements </li></ul><ul><li>a <slide> element has </li></ul><ul><ul><li>a title attribute that takes a text value </li></ul></ul><ul><ul><li>A sequence of <bullet> elements </li></ul></ul><ul><li>a <bullet> element contains text </li></ul>Pseudo-code for a DTD/schema for the above XML <ul><li>Document Type Definitions (DTDs) and XML Schemas are ways to define an XML “vocabulary” </li></ul><ul><li>XML schemas are themselves XML documents and allow for more rigid definition than DTDs </li></ul>
  19. 19. Well-formed vs. Valid XML <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <presentation> <slide title=&quot;Markup Example”> <bullet>Captivating point 1.</bullet> </slide> </mess> <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <presentation> <slide title=&quot;Markup Example”> <callout>Look here!</callout> </slide> </presentation> <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <presentation> <slide title=&quot;Markup Example”> <bullet>Captivating point 1.</bullet> </slide> </presentation> This XML is not well-formed . The <presentation> start tag does not have a matching end tag. This XML is well-formed but not valid . Our hypothetical schema does not allow a <slide> to contain a <callout>. This XML is both well-formed and valid
  20. 20. <ul><li>You now know all of the important </li></ul><ul><li>things about XML. So… </li></ul>What is DXL?
  21. 21. You Already Know A Lot About DXL Earlier, we learned that: <ul><li>DXL is the Domino XML Language </li></ul><ul><li>DXL is an XML representation of Domino data </li></ul>Now that you understand the fundamentals of XML: <ul><li>You understand the fundamentals of DXL as well! </li></ul><ul><li>But you still need to learn </li></ul><ul><ul><li>what data can DXL represent? </li></ul></ul><ul><ul><li>what are the tools for processing DXL and how do I use them? </li></ul></ul><ul><ul><li>what could I use DXL for? </li></ul></ul>
  22. 22. What Data Can DXL Represent? <ul><li>Documents </li></ul><ul><ul><li>including rich text </li></ul></ul><ul><li>Most design notes </li></ul><ul><ul><li>form, subform, page, frameset, view, folder, shared field, shared actions, image resource, applet resource, agent, script library, database script, Help Using document, Help About document, data connection </li></ul></ul><ul><li>Database properties </li></ul><ul><li>Database ACL </li></ul><ul><li>Special objects </li></ul><ul><ul><li>profile document </li></ul></ul><ul><ul><li>agent data </li></ul></ul><ul><li>Notes </li></ul><ul><ul><li>catch-all for things that don’t yet have a DXL representation </li></ul></ul>
  23. 23. About the Examples <ul><li>Examples are in a database Baseball2004.nsf </li></ul><ul><ul><li>Major League Baseball batting statistics for the year 2004 </li></ul></ul><ul><ul><li>See the Help About document for instructions </li></ul></ul><ul><li>Available on DeveloperWorks about one month after Lotusphere </li></ul><ul><ul><li>http://www-10.lotus.com/ldd/sandbox.nsf/ViewByConferencesNonJava </li></ul></ul><ul><li>Examples assume input files are in C:ls06 </li></ul><ul><li>Presentation focus is on concepts, not fine details </li></ul><ul><li>For more info, please visit the Meet the Developers lab </li></ul><ul><ul><li>Dolphin Asia 1 </li></ul></ul>
  24. 24. A First DXL Example <ul><li>Open the baseball database in the Designer </li></ul><ul><li>Select a form and do Tools – DXL Utilities – Viewer </li></ul><ul><li>Look at the DXL for the form </li></ul><ul><li>Repeat the exercise for other design notes </li></ul>
  25. 25. How do I use DXL?
  26. 26. Tools for Processing XML and DXL XML DXL Application-specific (e.g. DXL Importer ) Import some data from XML format XSLT Transform it DOM SAX Parse and process it Network protocols Send it Files and Databases Store it Application-specific (e.g. DXL Exporter ) Export some data to XML format Tools Use
  27. 27. How do I use XML? First of all:
  28. 28. DOM: Document Object Model <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <presentation> <slide title=&quot;Markup Example”> <bullet>Captivating point 1.</bullet> <bullet>Captivating point 2.</bullet> </slide> </presentation> DOM Parser Application- Specific results presentation (DOM Element) slide (DOM Element) bullet (DOM Element) bullet (DOM Element) Captivating point 1. (DOM Text) Captivating point 2. (DOM Text) Markup Example (DOM Attribute)
  29. 29. SAX: Simple API for XML <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <presentation> <slide title=&quot;Markup Example”> <bullet>Captivating point 1.</bullet> </slide> </presentation> SAX Parser Start Element: presentation Application- Specific results Start Element: slide (with attribute list) End Element: slide Text: Captivating point 1. End Element: bullet Start Element: bullet End Element: presentation Application- Specific Event Processing Code
  30. 30. XSLT: Extensible Stylesheet Language: Transformations <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <presentation> <slide title=&quot;Markup Example”> <bullet>Captivating point 1.</bullet> <bullet>Captivating point 2.</bullet> </slide> </presentation> XSLT Processor Application- Specific results <ul><li>A set of instructions for transforming the data: </li></ul><ul><li>Match patterns in the input XML </li></ul><ul><li>Generate output data </li></ul>XML document XSLT style sheet Often another XML file, but can be HTML or any text
  31. 31. How do I use DXL? Now back to:
  32. 32. Tools for Processing DXL <ul><li>Designer Tools – DXL Utilities menu </li></ul><ul><li>Web server URL command: ?ReadViewEntries </li></ul><ul><li>XML APIs – DOM, SAX, XSLT </li></ul><ul><li>DXL APIs – Export, Import </li></ul><ul><li>Text processing tools, editors, search, diff, etc. </li></ul><ul><ul><li>depending on the character encoding of XML documents </li></ul></ul><ul><ul><li>utf-8 may be your best bet </li></ul></ul><ul><li>Third-party XML tools (e.g. XML Spy) </li></ul>
  33. 33. Designer Tools – DXL Utilities menu <ul><li>Exporter: exports the design note to a file in DXL format </li></ul><ul><li>Viewer: exports and displays the DXL </li></ul><ul><li>Transformer: exports and does an XSLT transformation </li></ul>
  34. 34. Example: Tools – DXL Utilities – Exporter <ul><li>Export PlayerBasic form to file C:ls06PlayerBasic.xml </li></ul><ul><li>Open and view the file in your favorite text editor </li></ul>
  35. 35. Tips on Using DXL and Other XML Files <ul><li>Name DXL files with .xml extension for XML-aware tools </li></ul><ul><li>Some editors may display “newline” characters strangely </li></ul><ul><li>Lines can get very long in XML </li></ul><ul><ul><li>check for editor “wrap lines” option </li></ul></ul><ul><ul><li>tends to make “diff” tools less effective </li></ul></ul><ul><ul><li>DXL Exporter inserts newlines to help alleviate this </li></ul></ul><ul><li>IE and other tools automatically indent </li></ul><ul><li>Consider a real XML editor such as XML Spy </li></ul><ul><li>Windows Notepad can edit utf-16 (Unicode) files </li></ul>
  36. 36. Example: Tools – DXL Utilities – Transformer <ul><li>Sample result on right </li></ul><ul><li>FormFieldSummary.xslt is the XSLT style sheet that is the “program” for the transform </li></ul><ul><ul><li>Only about 20 lines of code </li></ul></ul><ul><ul><li>XSLT is a powerful tool </li></ul></ul>Select one or more forms Select style sheet FormFieldSummary.xslt
  37. 37. Domino Web Server Command: ReadViewEntries <ul><li>Request view entries in DXL format with URL command: http:// server-name / db-name / view-name ?ReadViewEntries </li></ul><ul><li>Append optional URL arguments for more control over the data: & argument-name = argument-value </li></ul><ul><ul><li>starting and ending points </li></ul></ul><ul><ul><li>number of entries to return </li></ul></ul><ul><ul><li>sorting by column </li></ul></ul><ul><ul><li>restrict to a single category </li></ul></ul>Try these examples now in a browser: http ://server/ Baseball2004.nsf/basicStats?ReadViewEntries http ://server/ Baseball2004.nsf/basicStats?ReadViewEntries&ResortDescending=3
  38. 38. LotusScript APIs <ul><li>Export, Import, XSLT, SAX, DOM </li></ul>
  39. 39. Java APIs - Domino <ul><li>Export, Import, XSLT, DOM </li></ul>DxlExporter DxlImporter Document generateXML Session Item parseXML transformXML EmbeddedObject parseXML transformXML MIMEEntity parseXML transformXML RichTextItem parseXML transformXML <ul><li>Export via DxlExporter or Document.generateXML </li></ul><ul><li>Parse with DOM using parseXML methods in conjunction with org.w3c.dom.Document classes </li></ul><ul><li>Process with XSLT using transformXML methods </li></ul>Any industry standard XML Java APIs can be used also!
  40. 40. C APIs <ul><li>Export, Import, XSLT </li></ul>XSLTAddParameter XSLTCreateTransform XSLTGetTransformProperty XSLTSetTransformProperty XSLTTransform XSLTTransformDeleteTransform DXLCreateImporter DXLDeleteImporter DXLGetImporterProperty DXLImport DXLSetImporterProperty DXLCreateExporter DXLDeleteExporter DXLExportACL DXLExportDatabase DXLExportIDTable DXLExportNote DXLGetExporterProperty DXLSetExporterProperty XSLT Import Export
  41. 41. Conceptual View of DXL Exporter Exporter Input Object Output Object (contains DXL) <ul><li>database </li></ul><ul><li>document </li></ul><ul><li>document collection </li></ul><ul><li>note collection </li></ul>Options <ul><li>schema/DTD </li></ul><ul><li>bitmap to GIF </li></ul><ul><li>force note format </li></ul><ul><li>string </li></ul><ul><li>richtext item </li></ul><ul><li>stream </li></ul><ul><li>other XML processor </li></ul>Log
  42. 42. Conceptual View of DXL Importer Importer Input Object (Contains DXL) <ul><li>database </li></ul>Options <ul><li>create/replace/update </li></ul><ul><li>create FT index </li></ul><ul><li>schema/DTD validation </li></ul><ul><li>replace db properties </li></ul><ul><li>replica req’d for replace/update </li></ul><ul><li>string </li></ul><ul><li>richtext item </li></ul><ul><li>stream </li></ul><ul><li>other XML processor </li></ul>Log List of note IDs Output Object
  43. 43. Tips on API Language Trade-offs <ul><li>LotusScript has the most options for output objects </li></ul><ul><li>LotusScript supports pipelining </li></ul><ul><ul><li>output from one XML processor “pipes” directly into the input of another </li></ul></ul><ul><li>LotusScript and Java DOM object models are different </li></ul><ul><ul><li>can currently do more with the Java API </li></ul></ul><ul><li>C API input and output DXL is provided using callback functions </li></ul><ul><li>C API doesn’t support SAX or DOM </li></ul>Generally, use the language that you are most accustomed to. If you are “language-agnostic”, here are some considerations.
  44. 44. What Can DXL Do For Me?
  45. 45. Some Uses For DXL <ul><li>Reporting </li></ul><ul><li>Integration with other apps </li></ul><ul><li>Archival and restoring </li></ul><ul><li>Replacing or updating notes </li></ul><ul><li>Web applications </li></ul><ul><li>Source control and comparison </li></ul><ul><li>Transforming DXL to other XMLs </li></ul><ul><li>Transforming DXL to other formats </li></ul><ul><li>Creating design and documents from scratch </li></ul>
  46. 46. DXL is an Alternative to Other Mechanisms <ul><li>DXL is not necessarily the best choice </li></ul><ul><ul><li>LotusScript, Java, or C APIs may do the job easier </li></ul></ul><ul><li>Some cases where DXL might be the way to go are </li></ul><ul><ul><li>when DXL can accomplish something the other APIs cannot </li></ul></ul><ul><ul><li>when you’re working with other XML formats </li></ul></ul><ul><ul><li>when you want to share data in a platform-independent format </li></ul></ul><ul><ul><li>for a document-centric rather than API-centric processing model </li></ul></ul>
  47. 47. Let’s Look at Some API Examples <ul><li>Examples are all agents in the Baseball2004 database </li></ul><ul><li>Available on the Actions menu as shown on the left </li></ul><ul><li>All of these agents use the LotusScript or Java APIs shown in earlier slides </li></ul>
  48. 48. Example: Archival and Restoring <ul><li>This Java agent imports the DXL into a new database, DXLCopy.nsf </li></ul><ul><li>Open DXLCopy.nsf and verify contents </li></ul><ul><li>This Java agent exports the entire database to DXL </li></ul><ul><li>Results in file DXLCopy.xml </li></ul><ul><li>Delete DXLCopy.nsf if it exists </li></ul>
  49. 49. The Java DXL Exporter Code from Action 1 <ul><li>later </li></ul>public class JavaAgent extends AgentBase { public void NotesMain() { Session session = getSession(); AgentContext agentContext = session.getAgentContext(); Database db = agentContext.getCurrentDatabase(); String filename = &quot;C:s06XLCopy.xml&quot;; Stream stream = session.createStream(); if (stream.open(filename)) { stream.truncate(); // Any existing file is erased DxlExporter exporter = session.createDxlExporter(); System.out.println(&quot;Exported &quot; + stream.writeText( exporter.exportDxl(db) ) + &quot; bytes to &quot; + filename); } } }
  50. 50. Tips on Archival and Restoring With DXL <ul><li>Not the best solution if 100% full fidelity is required </li></ul><ul><li>DXL does not retain signatures </li></ul><ul><li>DXL does not decrypt/encrypt documents </li></ul><ul><ul><li>stores encrypted data in Base64 </li></ul></ul><ul><li>DXL does not represent some special database objects </li></ul><ul><ul><li>e.g. unread lists </li></ul></ul><ul><li>DXL strives for 100% fidelity elsewhere </li></ul>
  51. 51. Replacing Notes With DXL <ul><li>Currently, the PlayerBasic form looks like this </li></ul><ul><li>I’d like to improve the look: </li></ul><ul><ul><li>player name in blue </li></ul></ul><ul><ul><li>space between table border and text </li></ul></ul><ul><ul><li>silver background on heading row </li></ul></ul><ul><li>But how do I know what to change in DXL? </li></ul><ul><ul><li>could become a DXL DTD/schema expert </li></ul></ul><ul><ul><li>or, could just learn by example </li></ul></ul>Probably for the DXL power user only
  52. 52. Figuring Out How to Specify Changes in DXL <ul><li>See the view: 4. Rich Text Sandbox </li></ul><ul><ul><li>contains documents that use form Rich Text Example </li></ul></ul><ul><ul><li>first document is similar to PlayerBasic form </li></ul></ul><ul><ul><li>second document is what I want it to look like </li></ul></ul><ul><li>Try this now: </li></ul><ul><ul><li>select the two documents and run 3. Export selected documents to file(s) </li></ul></ul><ul><ul><li>use a diff utility to compare them </li></ul></ul><ul><ul><li>determine the DXL changes that are necessary for changes on left </li></ul></ul>
  53. 53. Import Example: Replace Form <ul><li>We determined that the changes needed are: </li></ul><ul><ul><li>add color=‘blue’ on <font>s preceding first and last name </li></ul></ul><ul><ul><li>add <table> columnspacing=‘.05in’ </li></ul></ul><ul><ul><li>R7 only: change <table> refwidth from ‘3.0in’ to ‘3.3in’ (or remove) </li></ul></ul><ul><ul><li>add bgcolor=‘silver’ to <tablecell>s in the first <tablerow> </li></ul></ul><ul><li>Try this now: </li></ul><ul><li>Make the above changes to PlayerBasic.xml </li></ul><ul><li>Run 4. Import: Replace form (PlayerBasic.xml) </li></ul><ul><li>See that the form has changed </li></ul>
  54. 54. Import Example: Create View <ul><li>Suppose we want to programmatically create a view similar to 2. Basic Statistics with an additional column for At Bats </li></ul><ul><li>Try this now: </li></ul><ul><li>Tools – DXL Utilities – Exporter on view: 2. Basic Statistics </li></ul><ul><ul><li>save as BasicStatsAB.xml </li></ul></ul><ul><li>Edit BasicStatsAB.xml in a text editor </li></ul><ul><ul><li>change <view> name to 3. Basic Statistics (w/ AB) and alias to basicStatsAB </li></ul></ul><ul><ul><li>copy and paste the Homerun <column> and its contents </li></ul></ul><ul><ul><li>change new <column>’s itemname and title, and the <formula> to AtBats </li></ul></ul><ul><li>Run 5. Import: Create view (BasicStatsAB.xml) </li></ul><ul><li>Use the new view in the Notes client </li></ul>
  55. 55. Tips For Importing Design Notes <ul><li>DXL Importer ignores design notes by default </li></ul><ul><ul><li>use DesignImportOption to create or update </li></ul></ul><ul><li>DXL Importer does not sign design notes </li></ul><ul><ul><li>sign programmatically or with Admin client </li></ul></ul><ul><ul><li>Importer provides imported note IDs </li></ul></ul><ul><li>Use a REPLACE option to replace an existing design note </li></ul><ul><ul><li>match by unid attribute (Universal Note ID), or </li></ul></ul><ul><ul><li>match by name / alias + language + note type </li></ul></ul><ul><li>May need ReplicaRequiredForReplaceOrUpdate = False </li></ul>
  56. 56. LotusScript Code for Import/Replace demo <ul><li>Dim session As New NotesSession </li></ul><ul><li>Dim db As NotesDatabase </li></ul><ul><li>Dim importer As NotesDXLImporter </li></ul><ul><li>Dim stream As NotesStream </li></ul><ul><li>Dim filename As String </li></ul><ul><li>Set stream = session.CreateStream </li></ul><ul><li>filename = &quot;C:ls06PlayerBasic.xml&quot; </li></ul><ul><li>stream.Open(filename) </li></ul><ul><li>Set importer = session.CreateDXLImporter </li></ul><ul><li>Call importer.SetInput(stream) </li></ul><ul><li>Set db = session.CurrentDatabase </li></ul><ul><li>Call importer.SetOutput(db) </li></ul><ul><li>importer.DesignImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE </li></ul><ul><li>Call importer.Process </li></ul>
  57. 57. Programmatic Examples of Modifying the DXL <ul><li>We cheated on the last example </li></ul><ul><ul><li>we did the DXL Import programmatically </li></ul></ul><ul><ul><li>but we changed the DXL by hand </li></ul></ul><ul><li>We could have changed the DXL programmatically using </li></ul><ul><ul><li>DOM </li></ul></ul><ul><ul><li>SAX </li></ul></ul><ul><ul><li>XSLT </li></ul></ul><ul><li>These are advanced examples for you to look at later </li></ul><ul><ul><li>Agent A1. Change and replace form with Java and DOM </li></ul></ul><ul><ul><li>Agent A2. Change and create view with LS and SAX </li></ul></ul><ul><ul><li>View 5. Additional info – C API XSLT utility </li></ul></ul>
  58. 58. Updating Notes With DXL <ul><li>Pretend David Ortiz really hit 50 homeruns </li></ul><ul><li>Import this DXL in UPDATE mode to perform the update </li></ul><document> <noteinfo unid=' 2FA75A266F437F58852570D7000BA960 '/> <item name=&quot;Homeruns&quot;><number>50</number></item> </document> <ul><li>The DXL unid is used to locate an existing document </li></ul><ul><li>Only items specified in DXL are updated, others are unchanged </li></ul>DocUpdate.xml
  59. 59. Update/Replace Document Demo <ul><li>Select David Ortiz document from 2. Basic Statistics view </li></ul><ul><li>Run 3. Export selected documents to file(s) </li></ul><ul><ul><li>This writes a file named after the document’s note ID </li></ul></ul><ul><ul><li>copy this file to Doc.xml </li></ul></ul><ul><li>Review Doc.xml and DocUpdate.xml if desired </li></ul><ul><li>Run 6. Import DocUpdate.xml (update mode) </li></ul><ul><ul><li>David Ortiz changes from 41 to 50 homeruns </li></ul></ul><ul><li>Run 7. Import Doc.xml (replace/create mode) </li></ul><ul><ul><li>David Ortiz changes back from 50 to 41 homeruns </li></ul></ul>
  60. 60. Tips For Importing Documents <ul><li>DXL Importer creates new documents by default </li></ul><ul><ul><li>use DocumentImportOption for update or replace </li></ul></ul><ul><ul><li>update/replace matches on unid attribute </li></ul></ul><ul><li>Richtext </li></ul><ul><ul><li>DXL has full support </li></ul></ul><ul><ul><li>learn by example </li></ul></ul><ul><ul><li>attachment/graphic data is in Base64 format, decoders readily available </li></ul></ul><ul><ul><li>use <attachmentref> path to import attachments directly from the filesystem </li></ul></ul><ul><ul><li>ConvertNotesBitmapsToGIF Exporter option </li></ul></ul><ul><li>Learn DTD/schema if producing DXL from scratch </li></ul>
  61. 61. Transforming DXL to Other XMLs <ul><li>Select some documents </li></ul><ul><li>Run 8. Export selected documents (PlayersDxl.xml) </li></ul><ul><li>Look at the results in a text editor </li></ul><ul><li>“ But I’d like to use all this data in a spreadsheet that supports XML” </li></ul>XSLT Processor XML format readable by Excel DXL containing multiple documents Custom written XSLT style sheet <ul><li>This is a great place to use XSLT – XML to XML transforms </li></ul><ul><li>But how do I know how to transform between the formats? </li></ul>
  62. 62. How To Transform DXL to Excel XML Format <ul><li>Learn Excel’s XML format the easy way </li></ul><ul><ul><li>create a minimal spreadsheet by hand </li></ul></ul><ul><ul><li>save it as an XML spreadsheet </li></ul></ul><ul><ul><li>peruse the resulting .xml file </li></ul></ul><ul><li>Map the DXL data to the Excel data </li></ul><ul><ul><li>see DXL data in PlayersDxl.xml </li></ul></ul><ul><ul><li>see simple Excel data in OnePlayerExcel.xml </li></ul></ul>
  63. 63. DXL to Excel XML Mapping Armed with this data, I created an XSLT style sheet to convert a set of DXL documents to an Excel XML spreadsheet. See PlayersDxlToExcel.xslt Copy boilerplate content (from OnePlayerExcel.xml) that precedes and follows the actual workbook data <Workbook> <database> For each <document>, generate a <Row> <Row> <document> For <item>s of interest, generate a <Cell> Generated any computed <Cell>s <Cell> <item> XSLT Style Sheet pseudo-code Excel XML DXL
  64. 64. Transforming DXL to Excel Demo <ul><li>Run 9. Export/Transform selected documents (PlayersExcel.xml) </li></ul><ul><li>Inputs are PlayersDxl.xml and PlayersDxlToExcel.xslt </li></ul><ul><li>Result is PlayersExcel.xml </li></ul><ul><ul><li>open this file in Excel </li></ul></ul>
  65. 65. Tips On Transforming Between XMLs <ul><li>Learn XSLT </li></ul><ul><li>Buy books to help you </li></ul><ul><li>Develop your XSLT style sheets in little baby steps </li></ul><ul><li>DOM or SAX can be used as well </li></ul><ul><li>Don’t implement your own XML parsing </li></ul>
  66. 66. Want More? <ul><li>Meet the Speakers – Europe 8 </li></ul><ul><li>Meet the Developers lab – Dolphin Asia 1 </li></ul><ul><li>BP305 : Combine XSL and DXL for Rich Web Apps, Wed. 1:30 – 2:30 </li></ul><ul><li>BP313 : Practical DXL for LotusScript, Wed. 4:15 – 5:15 </li></ul><ul><li>Lotus Developer Domain online forums http://www-10.lotus.com/ldd/nd6forum.nsf/ </li></ul><ul><li>This presentation available in one month at http://www-10.lotus.com/ldd/sandbox.nsf/ViewByConferencesNonJava </li></ul><ul><li>Email Dick Annicchiarico [email_address] </li></ul>Thank You For Attending! Please complete the evaluation form.

×