benpoole.com

“It is a very sad thing that nowadays there is so little useless information.”

Single category view parsing with Java

Written by Chris Molloy on 17 Nov 2002
Categories / keywords: Java, Domino, views
(click on a term to search for related articles at this site)

Add a comment...



Background

I wanted a way for a Java Applet to gather data from a single-category Domino view. I first wanted to get a list of available categories in the view and then I wanted to get a list of data from the view entries within a selected category.

The most promising post in the Sandbox (linked here) seemed to provide exactly what I was after. By using IBM's powerful XML4J (XML Parser for Java) parser toolkit to process a ?ReadViewEntries-type Domino URL I could get a viable data source. However, a major drawback for me was the fact that the xml4j.jar file alone is over 700Kb in size.

The article got me thinking, however. The XML data returned by a ?ReadViewEntries call is pretty simple in its structure, after all. So I had a bash at writing my own set of classes to parse the XML data returned by a this Domino URL. The resulting .jar file is just under 5Kb in size and works like a dream.

In The Zip

The .zip file attached contains: the 4 classes ('NotesView*.java') that gets the Domino view data as per both my original requirements; the 'javadoc' output for the 4 classes (access via 'index.html'); and an application that demonstrates it all working ('NVTest.java').

Extract the lot to somewhere where you can compile the .java files; edit 'NVTest.java' and plug in some real values for the first three variables defined therein ('baseURL', 'maxCategories' and 'categoryKey'); compile all the .java files; and run the 'NVTest' application.

Looking at what 'NVTest.java' does should give you a good idea as to how to use the 'NotesView*' classes (they are pretty basic, after all).

Caveats


Further reading:


Attachment(s): NotesViewJava.zip (22 KB)

   » Single category view parsing with Java (Chris Molloy 17 Nov 2002)

Add a comment...