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:
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 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.
Processor
|
Possible input objects
|
Possible output objects
|
String |
||
String |
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:
Property |
Data type |
Description |
Boolean |
(Read-write) True to convert Domino bit maps to GIF format. |
|
String |
(Read-write) The value of SYSTEM in the !DOCTYPE statement. |
|
Boolean |
(Read-write) False to export formatted DXL. |
|
Boolean |
(Read-write) False to suppress the !DOCTYPE statement. |
|
String |
(Read-write) The URI of the schema for the DXL being exported. |
|
Integer |
(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:
Property |
Data type |
Description |
Integer |
(Read-write) Indicates the handling of incoming ACL entries. |
|
Boolean |
(Read-write) Indicates whether the target database is full-text indexed. |
|
Integer |
(Read-write) Indicates the handling of incoming design elements. |
|
Integer |
(Read-write) Indicates the handling of incoming documents. |
|
Long |
(Read-only) The number of notes imported. |
|
Integer |
(Read-write) Indicates whether a DTD specified in the XML declaration statement should be used to validate the input XML. |
|
Boolean |
(Read-write) True replaces the database properties from the DXL. |
|
Boolean |
(Read-write) True requires that the replica ID of the DXL and the target database match. |
|
Integer |
(Read-write) Indicates error logging options. |
To transform DXL data through XSLT:
The NotesXSLTransformer class has the following properties:
Property |
Data type |
Description |
Integer |
(Read-write) Indicates that if a DTD is specified in the XML declaration statement, it should be used to validate the input XML. |
To parse XML into a standard DOM tree structure of NotesDOMNode objects:
The NotesDOMParser class has the following event:
Event |
Description |
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:
Property |
Data type |
Description |
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. |
|
(Read-only) The root document of the DOM tree. |
||
Boolean |
(Read-write) Indicates that namespaces should be validated. |
|
Boolean |
(Read-write) Indicates that every reference within a text value to an entity should be replaced by the entity's corresponding text value. |
|
Integer |
(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.
To parse XML using a SAX parser:
The NotesSAXParser class has the following events:
Event |
Description |
Signals the occurrence of text in the input XML. |
|
Signals the end of the input XML. |
|
Signals the end of the specified element in the input XML. |
|
Signals that an error occurred when processing the input XML. |
|
Signals that a fatal error occurred when processing the input XML. |
|
Signals ignorable white space found in the input XML. |
|
Signals a notation declaration found in the input XML. |
|
Signals a processing instruction found in the input XML. |
|
Signals an entity found in the input XML. |
|
Signals the beginning of the input XML. |
|
Signals the start of a special element in the input XML. |
|
Signals an unparsed external entity declaration found in the input XML. |
|
Signals that a warning occurred when processing the input XML. |
The NotesSAXParser class has the following property:
Property |
Data type |
Description |
Integer |
(Read-write) Indicates that, if a DTD is specified in the XML declaration statement, it should be used to validate the input XML. |