The DocumentExplorer add-in displays the document hierarchy in the form of a tree as well as provides a graphical interface for Document Object Model operations. As a result, the DocumentExplorer allows you to view and edit techexplorer documents right in your web browser!
In this section, we start by explaining how to use the DocumentExplorer. Indeed, the DocumentExplorer proves to be a valuable "debugging" tool when implementing add-ins and Java applets that make use of the Document Object Model API. For the remainder of this section we describe the implementation details of the DocumentExplorer with an eye towards developing DOM add-ins.
Like all techexplorer add-ins, the add-in dll must reside in the reside in the techexplorer\Bin subdirectory of the web browser Plugins folder. The Professional Edition installation automatically installs all of the "default" add-ins in the appropriate location.
The \evalLink
control sequence allows you to embed a
link to the DocumentExplorer add-in. To use the DocumentExplorer add-in include the following
in any techexplorer document:
\evalLink{IBM techexplorer Document Explorer Add-In}{application/x-document-explorer-string}
{}{Press here for a DocumentExplorer test}
Check out an example. In the example, to activate the DocumentExplorer click on Press here for a DocumentExplorer test. When started, the Document Explorer will display a tree view of the document.
You can click on the "+" or "-" icons (on the MAC, click on the triangular arrows) to expand or collapse the tree as you explore the document structure.
The DocumentExplorer provides context menu access to many of the operations defined by the Document Object Model API. Simply right click on a node and select an operation from the menu.
Menu Item | Description |
Highlight | Highlight the text representation of the node in the document. If the node has no text representation, nothing is highlighted |
Attributes | Dynamically display the available attribute/value pairs for a node |
Operations | Document Object Model Node operations. |
Operations/Insert Before | Insert a "created or recycled" node before the current node |
Operations/Replace Child | Replace the current node with a "created or recycled" node |
Operations/Remove Child | Remove the current node |
Operations/Append Child | Append a "created or recycled" node as a child of the current node |
Operations/Clone Child | Clone the current node and add to the "recycled node" list |
Document | techexplorer extensions to the DOM Document interface |
Document/Recompose | Flow and display the document |
Document/Recompose to Node | Flow and display the current node |
Document/Scroll to Node | Scroll to the current Node |
Document/Invalidate | Display the document (without composing) |
Document/Get LaTeX | Retrieve the LaTeX/TeX representation of a Node |
Document/Get MathML | Retrieve the MathML representation of a Node |
Document/Get XML | Retrieve the XML representation of a Node |
Cut | Remove the current node and place it in the "copy buffer" |
Copy | Clone the current node and place it in the "copy buffer" |
Paste | Insert the contents of the "copy buffer" after the current node |
About | Not implemented |
A "Node Panel" appears when using Document Object Model Node methods.
The Node Panel allows you to select what types of nodes to create. In the case of
Text
nodes, you must also provide a value. The "Recycled Nodes" area allows you
to select from cloned or removed nodes.
The techexplorer add-in SDK contains the C/C++ source and
makefiles for all of supplied add-ins. In the case of the DocumentExplorer
add-in, the source code resides in the AddInSDK\DocumentExplorer\Win32
subdirectory. For default installations of techexplorer,
the full path of the Document Explorer SDK is
C:\Program Files\IBM\techexplorer Hypermedia Browser\AddInSDK\DocumentExplorer\Win32
On the Mac the folder names are AddInSDK:DocumentExplorer:Mac
and
Macintosh HD:IBM techexplorer:AddInSDK:DocumentExplorer:Mac
respectively.
The DocumentExplorer was implemented using the Microsoft Visual C++ 6.0 compiler. To
build the add-in you can either load the TADocumentExplorer.dsw
project into Visual C++ 6.0 or use the TADocumentExplorer.mak
file as follows:
nmake -f TADocumentExplorer.mak
Once the build is complete, be sure to move the TADocumentExplorer.dll
to
the Addin subdirectory of your techexplorer folder.
On the Mac the distributed project files are XML text files. After the build, move the shared library to the Addin subdirectory of your techexplorer folder.
The DocumentExplorer project uses the add-in SDK "interface" (TaApi.h
,
TaApi.cpp
) as well as the Document Object Model implementation and interface
code:
Document Object Model | |
Implementation | Interface |
TEAttribute.cpp, TEAttribute.h | DOMAttribute.h |
TECDATASection.cpp, TECDATASection.h | DOMCDATASection.h |
TECharacterData.cpp, TECharacterData.h | DOMCharacterData.h |
TEComment.cpp, TEComment.h | DOMComment.h |
TEDocument.cpp, TEDocument.h | DOMDocument.h |
TEDocumentFragment.cpp, TEDocumentFragment.h | DOMDocumentFragment.h |
TEDocumentType.cpp, TEDocumentType.h | DOMDocumentType.h |
TEDOM.h | |
TEDOMFactory.cpp, TEDOMFactory.h | |
TEDOMImplementation.cpp, TEDOMImplementation.h | DOMImplementation.h |
TEElement.cpp, TEElement.h | DOMElement.h |
TEEntity.cpp, TEEntity.h | DOMEntity.h |
TEEntityReference.cpp, TEEntityReference.h | DOMEntityReference.h |
TENamedNodeMap.cpp, TENamedNodeMap.h | DOMNamedNodeMap.h |
TENode.cpp, TENode.h | DOMNode.h |
TENodeList.cpp, TENodeList.h | DOMNodeList.h |
TENotation.cpp, TENotation.h | DOMNotation.h |
TEProcessingInstruction.cpp, TEProcessingInstruction.h | DOMProcessingInstruction.h |
TEText.cpp, TEText.h | DOMText.h |
DOMException.cpp, DOMException.h |
The TADocumentExplorer
class (TADocumentExplorer.h
, TADocumentExplorer.cpp
)
is the core of the DocumentExplorer application. TADocumentExplorer
provides implementations
of the seven techexplorer
add-in API methods and is responsible for starting the main dialog when the AddInEvaluate
function is invoked.
Once started, the DocumentExplorerDialog
class uses the DOMFactory
to obtain
an instance of the TEDocument
class. The TEDocument
instance is used
to populates the document tree and serves as the entry point for accessing the objects in the
techexplorer document. The DocumentExplorerDialog
instance handles all
of the context menu operations and uses the NodePanel
class to handle the
Document Object Model operations.