XML FOR DOMINO


Using XML with LotusScript
The following LotusScript classes process XML:
The following "helper" classes are useful in processing XML:
Use pipelining to move data from one processor to another.

Note The COM interface:

NotesXMLProcessor base class

The NotesXMLProcessor class is a base class for the LotusScript classes that process XML. You do not use the class directly but its properties and methods are available to the other XML classes.

The NotesXMLProcessor properties are:


The NotesXMLProcessor methods are:
Where multiple XML processes use only the base properties and methods, you can simplify your program by using one subroutine. For example, you might code one subroutine that initiates processing then examines the log. Each time you call the subroutine, you specify as a parameter the pertinent XML object.

Pipelining

Pipelining allows you to combine operations so that the output of one XML process becomes the input to another XML process. For example, you may want to export Domino data as DXL, convert the DXL to a well known XML vocabulary, then apply a standard application that converts the XML to HTML. Each process feeds into the next. Rather than storing intermediate results, pipelining can be employed.

The XML processors require identification of the input and output prior to processing. You identify input and output when you create the XML object or later with SetInput and SetOutput. You initiate processing with Process.

To pipeline, specify input or output as an XML processor. For example, if you want exported DXL to feed into DOM processing, specify the output of the NotesDXLExporter object to be the NotesDOMParser object, or the input of the NotesDOMParser object to be the NotesDXLExporter object. Identify input and output for all objects in a pipeline before initiating processing. Initiating processing for the first processor in a pipeline initiates processing for all the processors.

A simple way to set up a pipeline is to identify only the input for all processors in the pipeline except the last. For the last processor, identify the input and the output.

The following table specifies allowable input and output for the XML processors.

ProcessorPossible input objectsPossible output objects
NotesDXLExporter NotesDatabase

NotesDocument

NotesDocumentCollection

NotesNoteCollection

NotesStream

NotesRichTextItem

NotesDXLImporter

NotesDOMParser

NotesSAXParser

NotesXSLTransformer

NotesDXLImporter String

NotesStream

NotesRichTextItem

NotesDXLExporter

NotesDOMParser

NotesSAXParser

NotesXSLTransformer

NotesDatabase
NotesDOMParser

NotesSAXParser

NotesXSLTransformer

String

NotesStream

NotesRichTextItem

NotesDXLExporter

NotesDOMParser

NotesSAXParser

NotesXSLTransformer

NotesStream

NotesRichTextItem

NotesDXLImporter

NotesDOMParser

NotesSAXParser

NotesXSLTransformer


Export and import DXL

The NotesDXLExporter class converts Domino data to DXL. Use the CreateDXLExporter method in NotesSession to create a NotesDXLExporter object. Input to an export process can be a NotesDatabase, NotesDocument, NotesDocumentCollection, or NotesNoteCollection object. Output can be a NotesStream or NotesRichTextItem object, or any of the other XML processors.

To initiate an export, use Process or Export (no pipelining).

The NotesDXLExporter class has the following properties:

PropertyData typeDescription
ConvertNotesBitmapsToGIFBoolean(Read-write) True to convert Domino bit maps to GIF format.
DoctypeSYSTEM String(Read-write) The value of SYSTEM in the !DOCTYPE statement.
ForceNoteFormat Boolean(Read-write) False to export formatted DXL.
OutputDOCTYPEBoolean(Read-write) False to suppress the !DOCTYPE statement.
SchemaLocationString(Read-write) The URI of the schema for the DXL being exported.
ValidationStyleInteger(Read-write) The method for validating the DXL being exported.
The NotesDXLImporter class converts DXL to Domino data. Use the CreateDXLImporter method in NotesSession to create a NotesDXLImporter object. Input to an import process can be a string, a NotesStream or NotesRichTextItem object, or any of the other XML processors. Output is a NotesDatabase object.

The import process constructs a list of note IDs for the newly imported notes. You can access these note IDs using the GetFirstNoteId and GetNextNoteId methods.

To initiate an import, use Process or Import (no pipelining).

The NotesDXLImporter class has the following properties:

PropertyData typeDescription
ACLImportOptionInteger(Read-write) Indicates the handling of incoming ACL entries.
CreateFTIndex Boolean(Read-write) Indicates whether the target database is full-text indexed.
DesignImportOptionInteger(Read-write) Indicates the handling of incoming design elements.
DocumentImportOptionInteger(Read-write) Indicates the handling of incoming documents.
ImportedNoteCount property Long(Read-only) The number of notes imported.
InputValidationOption Integer(Read-write) Indicates whether a DTD specified in the XML declaration statement should be used to validate the input XML.
ReplaceDbPropertiesBoolean(Read-write) True replaces the database properties from the DXL.
ReplicaRequiredForReplaceOrUpdateBoolean(Read-write) True requires that the replica ID of the DXL and the target database match.
UnknownTokenLogOptionInteger(Read-write) Indicates error logging options.

Transform DXL data through XSLT

To transform DXL data through XSLT:


The NotesXSLTransformer class has the following properties:
PropertyData typeDescription
InputValidationOptionInteger(Read-write) Indicates that if a DTD is specified in the XML declaration statement, it should be used to validate the input XML.

Parse XML data into a DOM tree structure

To parse XML into a standard DOM tree structure of NotesDOMNode objects:


The NotesDOMParser class has the following event:
EventDescription
PostDOMParse Called by the Process or Parse method to enable the use of the DOM parser in a pipeline of XML processors.
The NotesDOMParser class has the following properties:
PropertyData typeDescription
AddXMLDeclNode Boolean(Read-write) Indicates that attributes from the XML declaration line -- version, encoding, and standalone attributes -- should be included in the resulting DOM tree in a NotesDOMXMLDeclNode object.
Document NotesDOMDocumentNode(Read-only) The root document of the DOM tree.
DoNamespaces Boolean(Read-write) Indicates that namespaces should be validated.
ExpandEntityReferences Boolean(Read-write) Indicates that every reference within a text value to an entity should be replaced by the entity's corresponding text value.
InputValidationOptionInteger(Read-write) Indicates that if a DTD is specified in the XML declaration statement, it should be used to validate the input XML.
Access the DOM tree data using these methods of the specific NotesDOMNode classes.
Parse XML data as a series of events

To parse XML using a SAX parser:


The NotesSAXParser class has the following events:
EventDescription
SAX CharactersSignals the occurrence of text in the input XML.
SAX EndDocumentSignals the end of the input XML.
SAX EndElementSignals the end of the specified element in the input XML.
SAX ErrorSignals that an error occurred when processing the input XML.
SAX FatalErrorSignals that a fatal error occurred when processing the input XML.
SAX IgnorableWhiteSpaceSignals ignorable white space found in the input XML.
NotationDecl Signals a notation declaration found in the input XML.
SAX ProcessingInstructionSignals a processing instruction found in the input XML.
SAX ResolveEntitySignals an entity found in the input XML.
SAX StartDocumentSignals the beginning of the input XML.
SAX StartElementSignals the start of a special element in the input XML.
UnparsedEntityDecl Signals an unparsed external entity declaration found in the input XML.
SAX WarningSignals that a warning occurred when processing the input XML.
The NotesSAXParser class has the following property:
PropertyData typeDescription
Input Validation OptionInteger(Read-write) Indicates that, if a DTD is specified in the XML declaration statement, it should be used to validate the input XML.