Grove OLE Automation Interface

Starting with version 0.8, Jade includes an OLE Automation interface for groves.

To use this, the DLLs spnnnu.dll, grove.dll, spgrove.dll, groveoa.dll must be installed in the Windows system directory or in your PATH. The IDL file for the interface is included just for documentation. If you have Visual Basic I suggest using the Object Browser instead.

The groveoa dll must be registered. One way to do this is to run regsvr32 groveoa.dll. regsvr32 comes with Visual C++ and many other Microsoft tools. It may be in your \msdev\bin directory or in your Windows system directory. It's also part of Microsoft's free Java SDK. Alternatively in Visual Basic just add a reference to the DLL (using the Browse button).

This interface supports the following modules from the SGML property set:

The names of properties and classes are based on the application name specified in the property set, with the initial letter of each word capitalized, and spaces removed. Class names are suffixed with Node. So, for example, the class whose application name is sgml document is represented by an SgmlDocumentNode object.

Objects implementing classes in the SGML property set all derive from a Node object. There is also a NodeList object that represents node lists, and a NamedNodeList object that represents named node lists: these are both collections and can be accessed using the Visual Basic for each syntax. Property values are represented in the obvious way. Character valued properties are represented as longs.

Each individual character can be accessed as a separate node. This is obviously not very efficient, and the interface provides a way to avoid having to do this. Instead of using the Children property use the ChunkChildren property, and instead of using the Char property on data char nodes use the CharChunk property. The CharChunk property returns a string with the value of the Char property followed by the value of the Char property for following DataChar nodes (as many as is convenient for the implementation); ChunkChildren coordinates with CharChunk by omitting the DataChar nodes whose characters are in the CharChunk property of a preceding DataChar nodes.

The position in storage (eg in a file) of any node is available using the StoragePos property.

This interface has no UI. It does not automatically display messages from the parser. Instead the parser messages are exposed as nodes in the grove. The grove root has a Messages property which is a node list of Message nodes.

To create a grove use the GroveBuilder class. The parse method takes system identifier and returns the root of the grove.

The interface is designed to be useable in a GUI environment as well as from the command line. It therefore does not use environment variables like the programs that come with SP. The grove builder properties whose names start with Default are stored in the Windows registry.

As an example of how to use this with Visual Basic (including VBA), I've written a trivial validator.

To use this with Perl you need the current version of Perl for Win32 (at least Build 306). The foreach stuff in this Build has a bug; I've created a source patch. As an example of how to use this in perl, I've written a trivial normalizer.

James Clark