Lotus: XML and Domino

105
JMP102 Lotus: XML and Domino Gary Devendorf Domino Product Manager - Lotus Software

Transcript of Lotus: XML and Domino

Page 1: Lotus: XML and Domino

JMP102 Lotus: XML and DominoGary Devendorf Domino Product Manager - Lotus Software

Page 2: Lotus: XML and Domino

Agenda

XML review

New Release 6 Lotuscript XML classesDomino implementation of XML standards

Demos! Demos! Demos! of Lotus Domino 6 Lotuscript classespublish any XML in HTML and PDFintegrate any XML data into Domino

Page 3: Lotus: XML and Domino

You'll know what XML is and how it relates to DominoYou'll know enough to get started working with XML data using industry-standard tools

DOM parserSAX parserXSLT

You'll pick up enough jargon to impress your friends

Jumpstart Goals

Page 4: Lotus: XML and Domino

Having a standard way to express structured data simplifies...Exchanging and integrating data from many sourcesPublishing of data to HTML and other forms

your data

your data in xyz format

transform engine

your data as HTML

transform rules:yours -> xyz

transform rules:yours -> HTML

xyzprogram

browser

First: The Big Picture

Page 5: Lotus: XML and Domino

DefinitionsExamplesRelated specs

DTDs and SchemasNamespaces

Your XML vs. My XML

Introduction To The Family OfXML Technologies

Page 6: Lotus: XML and Domino

eXtensible Markup Language.

XML: What Is It?

Page 7: Lotus: XML and Domino

eXtensible Markup Language.A "meta language."

XML: What Is It?

Page 8: Lotus: XML and Domino

eXtensible Markup Language.A "meta language."

Syntax rules only, with no predefined tags.Basis for describing specific markup languages.

XML: What Is It?

Page 9: Lotus: XML and Domino

eXtensible Markup Language.A "meta language."

Syntax rules only, with no predefined tags.Basis for describing specific markup languages.

Just text: Easy to process, but inefficient storage format.

Example: <bookTitle>You And XML</bookTitle>.

XML: What Is It?

Page 10: Lotus: XML and Domino

eXtensible Markup Language.A "meta language."

Syntax rules only, with no predefined tags.Basis for describing specific markup languages.

Just text: Easy to process, but inefficient storage format.

Example: <bookTitle>You And XML</bookTitle>.For describing data, not presentation.

Used to exchange data between disparate systems.

XML: What Is It?

Page 11: Lotus: XML and Domino

http://www.w3.org/TR/REC-xml

Getting The Official Word About XML

Page 12: Lotus: XML and Domino

Like HTML: elements, attributes, and character contentBut ...

no predefined tagscase-sensitive tagsmust be well-formed

only one root element - the "document"beginning and ending tags must matchproper nesting of elementsquoted attributes

may be valid - but this is not requiredadheres to specified DTD, a.k.a. "schema" or "vocabulary"

XML: The Rules, The Jargon

Page 13: Lotus: XML and Domino

See next slide ...

An Example Of XML

Page 14: Lotus: XML and Domino

<?xml version='1.0' ?><purchase_order>

<shipto><firstname>Chris</firstname><lastname>Reckling</lastname><address>

<street>123 Lotus Street</street><city>Cambridge</city><state>MA</state><zip>12345</zip>

</address></shipto><order number="1">

<item sku="920197"><name>Lotus Domino</name><description>The best web application platform.</description><quantity>2</quantity><price>1295</price>

</item></order>

</purchase order>

element

declaration

attribute

text content

root element

Page 15: Lotus: XML and Domino

purchase_order

shipto order

firstname lastname

street city state

Chris Reckling

address

name description quantity

123 ... Cam... MA

num

attrib

element

text

2etc, etc...

item

XML As A Tree

Page 16: Lotus: XML and Domino

Technology PurposeXML Basic document structure & syntaxDTD Grammar files for XML docs. XML Schemas Replacement for DTDNamespaces Multiple vocabularies in same documentDOM Parser API to parse/manipulate XML as a treeSAX Parser API to parse/manipulate XML as eventsXSLT, XSL-FO Transform and Formattingetc., etc XPath, XLink, XPointer, ...

XML Family Of Standards

Page 17: Lotus: XML and Domino

<!ELEMENT purchase_order(shipto,order)>

<!ELEMENT shipto (firstname,lastname,address)><!ELEMENT firstname (#PCDATA)><!ELEMENT lastname (#PCDATA)><!ELEMENT address (street,city,state,zipcode)>

<!ELEMENT order (item+)><!ATTLIST order number CDATA>etc., etc...

Used to describe an XML vocabularyExample:

Document Type Definition (DTD)

Page 18: Lotus: XML and Domino

Describes a particular markup-language vocabularye.g., HTML, MathML

Optional

Can be used to validate XML

Dated technologyto be replaced by XML Schemas.

Document Type Definition (DTD)

Page 19: Lotus: XML and Domino

http://www.w3.org/TR/xmlschema-0, and others

Getting The Official Word AboutXML Schema

Page 20: Lotus: XML and Domino

<?xml version="1.0"?><schema> <element name="purchase_order">

<type> <element name="shipto"> <type> <element name="firstname" type="string"/> <element name="lastname" type="string" minOccurs='1' maxOccurs='*'/> </type> </element> <element name="price" type="fn:currency"/> <element name="order" type="string"> <attribute name="number" type="string" default="1234"/> </element> </type> </element></schema>

XML Schemas Will Replace DTDs

Page 21: Lotus: XML and Domino

New way to represent XML vocabulariesIt is XMLIncludes data typesInheritanceNamespace awareCo-authored by Lotus

XML Schemas

Page 22: Lotus: XML and Domino

Where do DTDs come from?you and your partnerssoftware companies (e.g., Lotus or IBM)

tpaML, ebXML, DXLindustry groups

oasis.org, rosetta.net, ...Problem: How to exchange data with so many standards?

XSLT (more on that later).

Your XML Versus My XML

Page 23: Lotus: XML and Domino

Technology PurposeXML Basic document structure & syntaxDTD Grammar files for XML docs. XML Schemas Replacement for DTDNamespaces Multiple vocabularies in same documentDOM Parser API to parse/manipulate XML as a treeSAX Parser API to parse/manipulate XML as eventsXSLT, XSL-FO Transform and Formattingetc., etc XPath, XLink, XPointer, ...

XML Family Of Standards

Page 24: Lotus: XML and Domino

http://www.w3.org/TR/REC-xml-names

Namespaces Solve Problem OfAmbiguous Element Names

Page 25: Lotus: XML and Domino

<?xml version="1.0"?><po:purchase_order xmlns:po='http://ecom.com/po.xsd'> <po:ship_to> <po:name>John Smith</po:name> <po:address>1 Main St., NYC, NY</po:address> </po:ship_to> <po:items>

<loc:book xmlns:loc="http://loc.gov/book.xsd"> <loc:name>J.K. Rowling</loc:name> <loc:isbn>0439064864</loc:isbn> </loc:book>

</po:items></po:purchase_order>

po: loc:

Combining Vocabularies UsingXML Namespaces

Page 26: Lotus: XML and Domino

ElementsAttributesWell-formedValidVocabulary

DTDRoot elementXML SchemasNamespaces

Jargon Watch

Page 27: Lotus: XML and Domino

eXtensible Markup LanguageA meta-languageDescribes data, not presentationUsed for exchanging data between disparate systemsCross platformJust text

Summary: XML Intro

Page 28: Lotus: XML and Domino

( You should never have to parse XML yourself )

XSLTXML output3)

your XSLstylesheet

SAX parserXML output2) your SAXevent handlers

The Most Common Ways ToParse XML

DOM parserXML output1) your tree -processing code

Page 29: Lotus: XML and Domino

Technology PurposeXML Basic document structure & syntaxDTD Grammar files for XML docs. XML Schemas Replacement for DTDNamespaces Multiple vocabularies in same documentDOM Parser API to parse/manipulate XML as a treeSAX Parser API to parse/manipulate XML as eventsXSLT, XSL-FO Transform and Formattingetc., etc XPath, XLink, XPointer, ...

XML Family Of Standards

Page 30: Lotus: XML and Domino

An in-memory tree representation of XML datareflects XML's nested (hierarchical) arrangement

A tree of DOM nodes

rooted by one and only one document root node.

Created by a DOM parser

<shipTo>,<order>, etc

Document root

<PO>

DOM = Document Object Model

Page 31: Lotus: XML and Domino

IBMXML4J (Java) is in Domino 5.03

(a.k.a. Apache Xerces)Release 6 Lotuscript/Java backend classes

OthersMSXML with IE 5XP from James ClarkOracleSun.

Where To Get A DOM Parser

Page 32: Lotus: XML and Domino

Everything in a DOM document is a type of Node:

AttributeCDATA SectionCommentDocumentDocument FragmentDocument TypeElement

EntityEntity ReferenceNotationProcessing InstructionTextUnknown

Walking The Tree

Page 33: Lotus: XML and Domino

Specific node types are subclasses of NotesDOMNodeThe DOM tree is rooted by a NotesDOMDocumentNode

DocumentElement property holds the tree's root elementCreate... methods are used to create new tree nodes

Navigation properties common to all NotesDOMNodesChildNodes FirstChild LastChild

Lotuscript Examples -Navigating A DOM Tree

NextSiblingNextSiblingPreviousSiblingPreviousSiblingParentNodeParentNode

Page 34: Lotus: XML and Domino

NodeType property

IF node.NodeType = ELEMENT_NODE THENIF node.NodeType = ELEMENT_NODE THENIF node.NodeType = ELEMENT_NODE THENIF node.NodeType = ELEMENT_NODE THEN ...

NodeName property

IF node.NodeName = "database" THEN ...IF node.NodeName = "database" THEN ...IF node.NodeName = "database" THEN ...IF node.NodeName = "database" THEN ...

NodeValue property

DIM text As StringDIM text As StringDIM text As StringDIM text As Stringtext = textnode.NodeValuetext = textnode.NodeValuetext = textnode.NodeValuetext = textnode.NodeValue

Node Inspection

Page 35: Lotus: XML and Domino

Attributes are not children of their elements!Get a NamedNodeMap of attributes:

DIM attrs As NotesNamedNodeMapDIM attrs As NotesNamedNodeMapDIM attrs As NotesNamedNodeMapDIM attrs As NotesNamedNodeMapDIM attr As NotesDOMAttributeNodeDIM attr As NotesDOMAttributeNodeDIM attr As NotesDOMAttributeNodeDIM attr As NotesDOMAttributeNode

attrs = dbElt.Attributesattrs = dbElt.Attributesattrs = dbElt.Attributesattrs = dbElt.AttributesFOR i = 1 to attrs.NumberOfEntriesFOR i = 1 to attrs.NumberOfEntriesFOR i = 1 to attrs.NumberOfEntriesFOR i = 1 to attrs.NumberOfEntries

Attr attr = attrs.GetItem(i);Attr attr = attrs.GetItem(i);Attr attr = attrs.GetItem(i);Attr attr = attrs.GetItem(i);' attr name is attr.NodeName' attr name is attr.NodeName' attr name is attr.NodeName' attr name is attr.NodeName' attr value is attr.NodeValue' attr value is attr.NodeValue' attr value is attr.NodeValue' attr value is attr.NodeValue

NEXT iNEXT iNEXT iNEXT i

Attributes Are Different

Page 36: Lotus: XML and Domino

You can change the tree.Simple changes. node.NodeValue = "New Value"node.NodeValue = "New Value"node.NodeValue = "New Value"node.NodeValue = "New Value"

Structural changes.

node.AppendChild (child)node.AppendChild (child)node.AppendChild (child)node.AppendChild (child)node.RemoveChild (child)node.RemoveChild (child)node.RemoveChild (child)node.RemoveChild (child)node.ReplaceChild (oldchild, newchild)node.ReplaceChild (oldchild, newchild)node.ReplaceChild (oldchild, newchild)node.ReplaceChild (oldchild, newchild)

Modifying a DOM Tree

Page 37: Lotus: XML and Domino

Technology PurposeXML Basic document structure & syntaxDTD Grammar files for XML docs. XML Schemas Replacement for DTDNamespaces Multiple vocabularies in same documentDOM Parser API to parse/manipulate XML as a treeSAX Parser API to parse/manipulate XML as eventsXSLT, XSL-FO Transform and Formattingetc., etc XPath, XLink, XPointer, ...

XML Family Of Standards

Page 38: Lotus: XML and Domino

Lets you process your XML as a series of events:StartDocument eventStartElement eventEndElement eventCharacters eventIgnoreableWhitespace eventProcessingInstruction eventSAXWarning, SAXError, and SAXFatalError events.EndDocument event

Can be more efficient than using a DOM parser

SAX Parser - Simple API For XML

Page 39: Lotus: XML and Domino

ElementsAttributesWell-formedValidVocabularyDTDRoot elementXML SchemasNamespacesDOM parserDOM nodesSAX parserSAX events

Jargon Watch

Page 40: Lotus: XML and Domino

Technology PurposeXML Basic document structure & syntaxDTD Grammar files for XML docs. XML Schemas Replacement for DTDNamespaces Multiple vocabularies in same documentDOM Parser API to parse/manipulate XML as a treeSAX Parser API to parse/manipulate XML as eventsXSLT, XSL-FO Transform and Formattingetc., etc XPath, XLink, XPointer, ...

XML Family of Standards

Page 41: Lotus: XML and Domino

What is XSL and why does it exist?Details on writing an XSLTSimple transform exampleUsing XSL-FO to publish XML data

Introduction To XSL

Page 42: Lotus: XML and Domino

Different companies will standardize on different XML vocabularies (DTDs).How can we automate XML conversion?XSLT provides the answers.

get from one XML vocabulary to anotherstylesheets can transform from XML to HTML

Problem: Exchanging XML

Page 43: Lotus: XML and Domino

<PO><customer><name>Chris Reckling</name></customer></PO>

<purchase_order><shipto><firstname>Chris</firstname><lastname>Reckling</lastname></shipto></purchase_order>

Company A Company B

Example - Simple Translation Of Vocabularies

Page 44: Lotus: XML and Domino

... although input/output does not have to be XMLFor example ...

Input can be an XML "fragment"Output can be HTML

Source XML

Result XML

XSL File

XSLT Engine

Typical XSL "Transform" Processing

Page 45: Lotus: XML and Domino

http://www.w3.org/TR/xslt11

Getting The Official Word About XSLT

Page 46: Lotus: XML and Domino

A programming language to transform XML documentsdeclarative (rules based)uses the XPath querying syntax

assumes data can be structured as a treerecursive

XSLT = eXtensible Stylesheet Language:

Transformations

Page 47: Lotus: XML and Domino

Start with some XML

<?xml version='1.0'?><purchase> <name>Chris</name> <product>Domino</product></purchase>

Simple Transform

Page 48: Lotus: XML and Domino

Add XSLT

<xsl:template match="purchase"><message>Hello there, <xsl:value-of select="name" /><br/>Congrats on your purchase of <xsl:value-of select="product"/></message></xsl:template>

Simple Transform

Page 49: Lotus: XML and Domino

Do the transform

<?xml version='1.0'?><purchase> <name>Chris</name> <product>Domino</product></purchase>

<xsl:template match="purchase"><message>Hello there, <xsl:value-of select="name" /><br/>Congrats on your purchase of <xsl:value-of select="product"/></message></xsl:template>

<message>Hello there, Chris<br/>Congrats on your purchase ofDomino<message>

Simple Transform

Page 50: Lotus: XML and Domino

<?xml version='1.0'?><purchase> <name>Chris</name> <product>Domino</product></purchase>

<xsl:template match="purchase"><message>Hello there, <xsl:value-of select="name" /><br/>Congrats on your purchase of <xsl:value-of select="product"/></message></xsl:template>

Output

XSLT In Slow Motion

Page 51: Lotus: XML and Domino

<?xml version='1.0'?><purchase> <name>Chris</name> <product>Domino</product></purchase>

<xsl:template match="purchase"><message>Hello there, <xsl:value-of select="name" /><br/>Congrats on your purchase of <xsl:value-of select="product"/></message></xsl:template>

Output

XSLT In Slow Motion

Page 52: Lotus: XML and Domino

<message>

<?xml version='1.0'?><purchase> <name>Chris</name> <product>Domino</product></purchase>

<xsl:template match="purchase"><message>Hello there, <xsl:value-of select="name" /><br/>Congrats on your purchase of <xsl:value-of select="product"/></message></xsl:template>

Output

XSLT In Slow Motion

Page 53: Lotus: XML and Domino

<message>Hello there,

<?xml version='1.0'?><purchase> <name>Chris</name> <product>Domino</product></purchase>

<xsl:template match="purchase"><message>Hello there, <xsl:value-of select="name" /><br/>Congrats on your purchase of <xsl:value-of select="product"/></message></xsl:template>

Output

XSLT In Slow Motion

Page 54: Lotus: XML and Domino

<message>Hello there, Chris

<?xml version='1.0'?><purchase> <name>Chris</name> <product>Domino</product></purchase>

<xsl:template match="purchase"><message>Hello there, <xsl:value-of select="name" /><br/>Congrats on your purchase of <xsl:value-of select="product"/></message></xsl:template>

Output

XSLT In Slow Motion

Page 55: Lotus: XML and Domino

<message>Hello there, Chris<br/>

<?xml version='1.0'?><purchase> <name>Chris</name> <product>Domino</product></purchase>

<xsl:template match="purchase"><message>Hello there, <xsl:value-of select="name" /><br/>Congrats on your purchase of <xsl:value-of select="product"/></message></xsl:template>

Output

XSLT In Slow Motion

Page 56: Lotus: XML and Domino

<message>Hello there, Chris<br/>Congrats on your purchase of

<?xml version='1.0'?><purchase> <name>Chris</name> <product>Domino</product></purchase>

<xsl:template match="purchase"><message>Hello there, <xsl:value-of select="name" /><br/>Congrats on your purchase of <xsl:value-of select="product"/></message></xsl:template>

Output

XSLT In Slow Motion

Page 57: Lotus: XML and Domino

<message>Hello there, Chris<br/>Congrats on your purchase ofDomino

<?xml version='1.0'?><purchase> <name>Chris</name> <product>Domino</product></purchase>

<xsl:template match="purchase"><message>Hello there, <xsl:value-of select="name" /><br/>Congrats on your purchase of <xsl:value-of select="product"/></message></xsl:template>

Output

XSLT In Slow Motion

Page 58: Lotus: XML and Domino

<message>Hello there, Chris<br/>Congrats on your purchase ofDomino<message>

<?xml version='1.0'?><purchase> <name>Chris</name> <product>Domino</product></purchase>

<xsl:template match="purchase"><message>Hello there, <xsl:value-of select="name" /><br/>Congrats on your purchase of <xsl:value-of select="product"/></message></xsl:template>

Output

XSLT In Slow Motion

Page 59: Lotus: XML and Domino

<message>Hello there, Chris<br/>Congrats on your purchase ofDomino<message>

<?xml version='1.0'?><purchase> <name>Chris</name> <product>Domino</product></purchase>

<xsl:template match="purchase"><message>Hello there, <xsl:value-of select="name" /><br/>Congrats on your purchase of <xsl:value-of select="product"/></message></xsl:template>

Output

XSLT In Slow Motion

Page 60: Lotus: XML and Domino

Again, again!

Page 61: Lotus: XML and Domino

<xsl:template match="purchase"><message>

<xsl:apply-templates/></message>

</xsl:template>

matchpattern

} result treetemplate

Templates And Pattern-matching

Page 62: Lotus: XML and Domino

<PO><customer><name>Chris Reckling</name></customer></PO>

<purchase_order><shipto><firstname>Chris</firstname><lastname>Reckling</lastname></shipto></purchase_order>

Company A Company B

Example - Simple Translation Of Vocabularies

Page 63: Lotus: XML and Domino

Start with XML declaration and XSL namespace.make sure you have the correct namespace URI!

<?xml version="1.0" ?><xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

Putting Together a Stylesheet

Page 64: Lotus: XML and Domino

Create a root template

<?xml version="1.0" ?><xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'><xsl:template match="/">

</xsl:template>

Putting Together a Stylesheet

Page 65: Lotus: XML and Domino

Add content for the beginning of the document<xsl:apply-templates/> statement iterates through all children

<?xml version="1.0" ?><xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'><xsl:template match="/"><PO><xsl:apply-templates/></PO></xsl:template>

Putting Together a Stylesheet

Page 66: Lotus: XML and Domino

Create templates for children as needed

<?xml version="1.0" ?><xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'><xsl:template match="/"><PO><xsl:apply-templates/></PO></xsl:template> <xsl:template match="shipto"> <name> <xsl:value-of select="firstname" /> <xsl:value-of select="lastname" /> </name></xsl:template>

Putting Together a Stylesheet

Page 67: Lotus: XML and Domino

Language for addressing parts of an XML doc represented as tree of DOM nodesSeparate specification: designed to be used by XSLT, XPointer, simple queriesCompact, non-XML syntax, can be used in URI's and XML attributesHas a natural subset that can be used for pattern matching (e.g., in XSLT)

XPath -How You Specify The XML You Want

Page 68: Lotus: XML and Domino

purchase_order

shipto order

firstname lastname

street city state

Chris Reckling

address

name description quantity

123 ... Cam... MA

num

attrib

element

text

2etc, etc...

item

Rememberthis?

Page 69: Lotus: XML and Domino

/purchase_order/order selects the <order> elements that are children of <purchase_order>s at top level //purchase_order/order - same except <purchase_order> can occur at any level of the hierarchychild::order selects all <order> elements that arechildren of the context nodechild::* selects all element children of the context node./order[position()=1] selects the first <order> child ofthe context node

XPath Examples

Page 70: Lotus: XML and Domino

Use the <xsl:value-of /> statement.copies the value of any text nodes into the result,plus any descendantsoptional pattern matching arg to refine selection

<xsl:copy /> copies the entire current node and children into the result, as is

How to Get the Values of a Node

Page 71: Lotus: XML and Domino

ElementsAttributesWell-formedValidVocabularyDTDRoot elementXML SchemasNamespacesDOM parserDOM nodesSAX parserSAX events

XSLTTransformationsTemplatesXPath

Jargon Watch

Page 72: Lotus: XML and Domino

Useful XSL Tips ...

Page 73: Lotus: XML and Domino

Enclose in square brackets [ ]

Examples:shipto [lastname='Smith']

shipto elements with lastname element = "Smith"po/orders [quantity>3]/viewentries/viewentry [@category='true']//item [@name='subject']

Refining Your Selections Using Filters

Page 74: Lotus: XML and Domino

Use the <xsl:sort> elementExample:

<xsl:for-each select='//dxl:form'> <xsl:sort select='@name'/> <BR/><B><xsl:value-of select='@name'/></B>: <xsl:value-of select='count(dxl:body//dxl:field)'/> fields</xsl:for-each>

Sorting

Page 75: Lotus: XML and Domino

Use <xsl:element> to create an element structureUse <xsl:attribute> to create an attributeExample:

<xsl:element name="img"> <xsl:attribute name="src"> <xsl:value-of select="entrydata[@columnnumber='5']/text"/> </xsl:attribute> <xsl:attribute name="width">24</xsl:attribute> <xsl:attribute name="height">32</xsl:attribute></xsl:element>

Creating New Elements

Page 76: Lotus: XML and Domino

Use curly braces { } to evaluate a statementFor attributes values onlyExample:

make the item name attribute the element name

<xsl:template match="item"> <xsl:element name='{@name}'> <xsl:value-of select='.'/> </xsl:element></xsl:template>

<title>XML And You</title>

Input XML

<item name="title">XML And You</item>

Template Result

Evaluate

Page 77: Lotus: XML and Domino

eXtensible Markup Language.A "meta language."

Defines rules for using markup-language syntax to define any type of structured data.Just text - easy to prepare, parse, and process.

... but not necessarily the most efficient storage format.

Example: <bookTitle>You And XML</bookTitle>.Describes data, not presentation.Used to exchange structured data between disparate systems.

XML: What Is It?

Page 78: Lotus: XML and Domino

<?xml version="1.0" encoding="UTF-8"?><booklist> <book> <booktitle>The art of Shakespeare's Sonnets</booktitle> <bookauthor>Helen Vendler</bookauthor> <bookprice>17.05</bookprice> <booklistprice>18.95</booklistprice> <bookcategory>Literary criticism</bookcategory> </book> <book> <booktitle>The Creators</booktitle> <bookauthor>Daniel Boorstin</bookauthor> <bookprice>27.00</bookprice> <booklistprice>30.00</booklistprice> <bookcategory>History</bookcategory> </book>

* * *

</booklist>

XML Sample

Page 79: Lotus: XML and Domino

XML.apache.org

XSLTXML output3)

your XSLstylesheet

SAX parserXML output2) your SAXevent handlers

Use Industry-standard ToolsTo Parse XML

DOM parserXML output1) your tree -processing code

Page 80: Lotus: XML and Domino

= available now in current Rnext build= primary class of a set of related classes

Primary XML Classes In Domino 6

LotusScript Java

NotesXSLTransformer XSLTransformer

NotesDOMParser * DOMParser *

NotesSAXParser * SAXParser *

NotesDXLExporter DXLExporter

NotesDXLImporter DXLImporter

NotesStream NotesStream

NotesNoteCollection NoteCollection

StandardXML ToolClasses

DXLClasses

"Helper"Classes

Page 81: Lotus: XML and Domino

NotesDOMParserParse XML into an in-memory DOM tree.Best tool when XML contains a lot of interrelated data.

Domino 6's Standard XML DOM Parsers

DOM parserXML outputyour tree -

processing code

Page 82: Lotus: XML and Domino

NotesSAXParserEfficiently process XML as a stream of events.Best tool for analyzing/filtering for specific XML info.

Domino 6's Standard XML SAX Parsers

SAX parserXML outputyour SAXevent handlers

Page 83: Lotus: XML and Domino

NotesXSLTransformerExtract XML content and/or merge it with other text.Best tool for generating reports, producing HTML containing XML info, and translating XML vocabularies.

Domino 6's Standard XSLT Transformer

XSLTXML output

your XSLstylesheet

Page 84: Lotus: XML and Domino

Domino 6 /XML Utility Classes

NotesDXLExporterconverts NSF databases elements to XML

NotesDXLImporterconverts XML to NSF database elements

Page 85: Lotus: XML and Domino

Input can be one of several LotusScript objects

Use a NotesNoteCollection object for efficiencyExport just the content of interest to you

acls, actions, agents, databasescripts, documents, forms, etc.

Exporting DXL Using Rnext'sNotesDXLExporter LotusScript Class

NotesDatabaseNotesDocument

NotesDocumentCollectionNotesNoteCollection

DXLExporter

text editorDOM parserSAX parserXSL tranformeretc.

DXL

Page 86: Lotus: XML and Domino

<?xml version='1.0' encoding='utf-8'?><database version='1.0' path='blank.nsf' title='XML test' categories='Discussion' fromtemplate='StdR50Disc'><databaseinfo dbid='852568B2005A9EA2' replicaid='852568B2005A9EA2' odsversion='41' diskspace='1198080' percentused='89.6367521367522' numberofdocuments='2'><datamodified><datetime dst='true'>20010510T144517,03-04</datetime></datamodified><designmodified><datetime dst='true'>20010510T144516,95-04</datetime></designmodified></databaseinfo><acl maxinternetaccess='editor'><aclentry name='-Default-' default='true' level='author' createdocs='true' deletedocs='true' createpersonalagents='false' createpersonalviews='true' createlsjavaagents='false' writepublicdocs='false'/><aclentry name='CN=George Langlais/O=Iris' type='person' level='manager' deletedocs='true'/><aclentry name='OtherDomainServers' type='servergroup' level='noaccess' readpublicdocs='false' writepublicdocs='false'/><aclentry name='Anonymous' level='noaccess' readpublicdocs='false' writepublicdocs='false'/><aclentry name='LocalDomainServers' type='servergroup' level='manager' deletedocs='true'/><logentry>03/30/2000 11:29:49 AM George Langlais/Iris updated George Langlais/Iris</logentry><logentry>03/30/2000 11:29:49 AM George Langlais/Iris added George Langlais/Iris</logentry><logentry>03/30/2000 11:29:49 AM George Langlais/Iris added Anonymous</logentry><logentry>03/30/2000 11:29:49 AM George Langlais/Iris updated -Default-</logentry><logentry>03/30/2000 11:29:49 AM George Langlais/Iris added LocalDomainServers</logentry><logentry>03/30/2000 11:29:49 AM George Langlais/Iris added OtherDomainServers</logentry></acl><launchsettings><noteslaunch whenopened='openframeset' frameset='MasterDiscFrameset'/></launchsettings><note default='true' class='icon'><noteinfo noteid='11a' unid='85255A0A0010AC8E85254BD4001E8D43' sequence='157'><created><datetime>19800105T003342,43-05</datetime></created><modified><datetime dst='true'>20001026T123631,81-04</datetime></modified><revised><datetime dst='true'>20001026T123631,80-04</datetime></revised><lastaccessed>

* * *

DXL Sample

Page 87: Lotus: XML and Domino

DXL = Domino data expressed in XMLProcess DXL as you would any XML

Use a text editorUse standard XML tools (DOM, SAX, XSLT, XSL-FO)Use your own programs

DXL exporter and importer are available nowIn Release 6 via Lotuscript backend classesIn R5 via the XML Toolkit 1.0 (C++ and Java)

DXL (Domino XML Language)Makes It Easy To Work With Domino Data

Page 88: Lotus: XML and Domino

Import options pertain to types of notesdocuments, design elements...

DXL NotesDatabase

Import option properties:ACLImportOptionDesignImportOptionDocumentImportOption

Note

Notes/Domino 6's NotesDXLImporter LotusScript Class

DXLImporter

Page 89: Lotus: XML and Domino

Target must be an open NotesDatabase objectNote-oriented import options control how specific types of notes are input

DXLIMPORTOPTION_CREATEAlways create new notes from notes found in input DXL

DXLIMPORTOPTION_IGNOREIgnore specified type of note when found in input DXL

DXLIMPORTOPTION_REPLACEReplace matching notes with notes found in input DXL

DXLIMPORTOPTION_UPDATEUpdate matching notes with newer fields found in input DXL

Notes/Domino 6's NotesDXLImporter LotusScript Class

Page 90: Lotus: XML and Domino

Helper Classes

NotesNoteCollectionNotesStream

Page 91: Lotus: XML and Domino

Export just the data or design elements you needAny and/or all of the following

acl framesets views replicationformulas

actions helpabout misccodeelements scriptlibraries

agents helpindex miscformatelements subforms

databasescript helpnotes miscindexelements sharedfields

documents icon navigators stylesheetresources

folders imageresources outlines

forms javaresources pages

Notes/Domino 6's NotesNoteCollection Class

Page 92: Lotus: XML and Domino

Based on notes/elements categories in a database (cont.)

AgentsOutlinesDatabaseScriptScriptLibrariesMiscCodeElements

Forms ImageResourcesSubforms StylesheetResourcesActions JavaResourcesFramesets MiscFormatElementsPages

ViewsFoldersNavigatorsMiscIndexElements

IconSharedFieldsHelpAboutHelpNotesHelpIndex

FormatElements

IndexElements

CodeElements

Documents

AdminNotes

DesignElements

Notes

ACLReplicationFormulas

Note Collection "SelectAll ..." Methods

Page 93: Lotus: XML and Domino

Based on notes/elements categories in a database

For example, SelectAllIndexElements(True) selects views, folders, navigators, and MiscIndexElements

Good

Thing

Note Collection "SelectAll..." Methods

Page 94: Lotus: XML and Domino

NotesStream Class

Lets you treat files and data as streams of binary or character data.

Dim stream As NotesStreamSet stream = session.CreateStreamstream.Open("C:\MyXMLFiles")MyString = stream.ReadText()

* * *

stream.Position = 0Call stream.WriteText(doc.GetItemValue("Body")(0))

Page 95: Lotus: XML and Domino

How to use pipeliningCreate XML processing objects in pipeline orderOmit output objects when creating each XML processor

Specifying the input object of the next stage will create the pipeCall the Process method of the first processor in the pipe

Pipeline the XML Processing Classes

Page 96: Lotus: XML and Domino

How to use pipelining (cont.)

Set exporter = session.CreateDXLExporter(inputDoc)

Set saxparser = session.CreateSAXParser(exporter)exporter.Process

The XML "pipe" feature makes it unnecessary to specify

the sax parser as the output object here

Specifying the exporter as the input to the SAX parser makes the SAX parser the output of

the exporter.This initiates both the export as well as the sax-parsing operations

Pipeline the XML Processing Classes (cont.)

Page 97: Lotus: XML and Domino

LotusScript Java

NotesXSLTransformer XSLTransformer

NotesDOMParser * DOMParser *

NotesSAXParser * SAXParser *

NotesDXLExporter DXLExporter

NotesDXLImporter DXLImporter

NotesStream NotesStream

NotesNoteCollection NoteCollection

StandardXML ToolClasses

DXLClasses

"Helper"Classes

= available now in current Rnext build

= primary class of a set of related classes

Primary XML Classes In Rnext

Page 98: Lotus: XML and Domino

All demos are based on the books.xml filePublish XML to HTML and to PDF format ...

Any XMLDXL

Import any XML into a Domino databaseExport and convert Domino data to a non-DXL XML vocabulary

Will DemonstrateIn Today's Presentation

Page 99: Lotus: XML and Domino

Will Demo In Today's Presentation

XSLTransformer

DXLImporter

DXL

XSLTransformer

DXLExporter

DXL

XSLTransformer

XSLTransformer

FO to PDFcomposer

books.html

books.pdf

books.nsf

books.xml1

2

3

4, 5, 6

FO

Page 100: Lotus: XML and Domino

Demo Time

Page 101: Lotus: XML and Domino

Typically A 2-Step Process To Publish XML Content Using XSL-FO

Step 1 - Use XSLT to extract content from XML and merge it with formatting ("fo:") elementsStep 2 - Use an XSL-FO composer to render the FO document into a particular format

XSLTransformer

FO to PDFcomposer books.pdfbooks.xml

FO

books.xsl

1 2

Page 102: Lotus: XML and Domino

After Processing With A Composer

Page 103: Lotus: XML and Domino

Information About XSL-FO

The official specificationhttp://www.w3.org/TR/2001/REC-xsl-20011015

Numerous tutorials on the webComposers available for downloading today

alphaworks.ibm.comwww.apache.orgwww.antennahouse.comwww.renderx.com

Page 104: Lotus: XML and Domino

Domino is a great XML application servercross platformdata Storedistributed environmentprocess any XML

Industry Standard XML Toolswww.Apache.orgNotesXSLTransformer, NotesDOMParser, NotesSAXParser

Conclusions

Page 105: Lotus: XML and Domino

JMP102 Lotus: XML and Domino

Other sources of informationXML.apache.orgwww.notes.netwww.groupcomputing.com/garyspagewww.lotus.comDomino Designer 6 help

Questions and Answers

Please --Don't forget to pass in your

evaluations.-- Thanks

Questions