General question regarding Java & XML on domino

Hi

I’m having some difficulty understanding just how you are supposed to get a working instance of a DOM and SAX parser or a XSL processer using classes shipped with domino (not using Xerces or Xalan).

Using the JAXP abstraction this usually isn’t a issue, but the JAXP API doesn’t seem to be a part of domino. So just how are you supposed to get hold of a DOM or SAX parser and just where is the documentation for XML4J and LotusXSL? Where are the examples?

By chance I came across how to get a XSL processor:

XSLProcessor processor = new XSLProcessor(new XML4JLiaison4dom());

I also found a way to create a DOM Document:

org.w3c.dom.Document doc = (org.w3c.dom.Document) Class.forName(“com.ibm.xml.DocumentImpl”).newInstance();

But where is the documentation? Are they not supported? Not too impressed so far.

Subject: General question regarding Java & XML on domino…

Maybe this document from Designer Help answers some of your questions. Alternatively, try searching Designer help for “Java and xml”.

Lotus Domino Designer includes the XML4J parser and LotusXSL processor in the product so you can parse and transform XML data without a separate download. You can access XML representations of objects, parse and transform the XML data, and generate XML representations of a document through the following properties and methods in the Java backend classes:

Class

Properties

Methods

Document

none

generateXML

EmbeddedObject

InputSource,InputStream, and Reader

parseXML and transformXML

Item

InputSource,InputStream, and Reader

parseXML and transformXML

MIMEEntity

InputSource,InputStream, and Reader

parseXML and transformXML

RichTextItem

InputSource,InputStream, and Reader

parseXML and transformXML

In addition, the XSLTResultTarget class is a wrapper class in the com.lotus.xsl package that contains the result of a transformation made using the LotusXSL processor. An instance of this class serves as a container for the XSLT Result tree.

For standalone applications, you should include the NCSO.jar or Notes.jar file in the classpath for the lotus.domino classes. You should also include the XML4j.jar file in your classpath to use the XML parser, and the LotusXSL.jar file to use the XSL processor.

Note You must include the XML4j.jar file in your classpath even if you only need to use the transformXML methods.

For applets that run in a browser, you should include the XML4j.jar and/or XML4j.cab file with the applet itself, to use the XML parser. To use the LotusXSL processor, you should include the XML4j.jar and/or XML4j.cab file as well as the LotusXSL.jar and/or LotusXSL.cab file with the applet.

For further details on the XML4j parser and LotusXSL processor, visit the AlphaWorks Web site at www.alphaworks.ibm.com.

Subject: RE: General question regarding Java & XML on domino…

But what about normal xml parsing without regard the domino object model? I might want to be able to parse xml without using domino objects. Or what if you want to create a DOM Document from scratch?

Subject: General question regarding Java & XML on domino…

I can only make a suggestion that worked for me when I migrated agents from R5 to ND6.5. I simply opened up the agents and added/attached the xml-apis.jar and other needed to jars to the agents and then used various combinations of:import org.w3c.dom.Node;

import org.w3c.dom.NodeList;

import lotus.domino.*;

import org.xml.sax.SAXException;

import org.xml.sax.XMLReader;

import org.xml.sax.InputSource;

import org.xml.sax.Attributes;

import javax.xml.parsers.SAXParser;

import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.SAXParseException;

import org.xml.sax.SAXException;

import javax.xml.parsers.ParserConfigurationException;

depending on what I needed to do. Worked fine.

Subject: RE: General question regarding Java & XML on domino…

Let me amend my post by saying that I *thought it worked fine. The xml4j.jar that ships with notes/domino 6.5.x is always picked up regardless of JavaUserClasses or attachment to an agent from what I can tell. So, if your code is compatible with Lotus’ version of XML4J then you are probably OK.