In XML mode, the bottom pane of the sidebar normally displays a tree representing the document you're editing. The tree is enabled by default. To disable it, add the following line to your preferences file:
XmlMode.enableTree = false
If the tree is enabled but no tree appears in the sidebar, the most likely reason is that j's XML parser was unable to parse the contents of the buffer. Parsing is done in a background thread, so it may take a little while for the tree to appear (or possibly a long while, if the document references a DTD on the Internet, for example).
Starting with version 0.19.0.2, j uses the XML parser provided as part of the Java 1.4 runtime library. (Earlier versions of j included a version of the Ælfred XML parser.)
If you would rather use a different XML parser, you need to do two things:
CLASSPATH
. If you
build j from source, you can use the configure script's
--with-extensions
option to do this:
./configure --with-extensions=/usr/share/java/xercesImpl.jarThe j shell script that is automatically generated and installed will then use the correct
CLASSPATH
.
org.xml.sax.driver = org.apache.xerces.parsers.SAXParser(The corresponding property in versions of j prior to 0.19.0.2 was "org.xml.sax.parser".)
When you have a tree in the sidebar, the selection in the tree will follow along as you navigate in the edit buffer, but the tree is not automatically expanded to show nested nodes. You can use xmlFindCurrentNode, mapped by default to Ctrl =, to force the tree to expand all the way down to the node corresponding to the location of the caret in the edit buffer.
Clicking on a node in the tree moves the caret to the corresponding location in the edit buffer.
The tree is refreshed automatically by the idle thread when you make changes to the buffer.
You can also use xmlParseBuffer, mapped by default to Ctrl P, to force the tree to be refreshed. The parser uses the image of the buffer in memory, rather than the file on disk, so there's no need to save any changes you've made to the buffer before refreshing the tree.
If xmlParseBuffer encounters an error, the tree is not updated.
Parser errors that occur when j is automatically refreshing the tree are not reported.
xmlParseBuffer invokes xmlFindCurrentNode automatically when it succeeds in updating the tree.
The following commands are also specifically relevant in XML mode: