source: tags/0.12.0/j/doc/xmlmode.html

Last change on this file was 2435, checked in by piso, 21 years ago

Minor cleanup.

File size: 3.7 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2
3<html>
4
5<head>
6<title>J User's Guide - XML Mode</title>
7<LINK REL="stylesheet" HREF="j.css" TYPE="text/css">
8</head>
9
10<body>
11
12<a href="contents.html">Top</a>
13
14<hr>
15
16<h1>XML Mode</h1>
17
18<hr>
19
20<p>
21In XML mode, the bottom pane of the sidebar normally displays a tree
22representing the document you're editing. The tree is enabled by default. To
23disable it, add the following line to your
24<a href="preferences.html">preferences</a> file:
25<pre>
26    XmlMode.enableTree = false
27</pre>
28<p>
29If the tree is enabled but no tree appears in the sidebar, the most likely
30reason is that j's XML parser was unable to parse the contents of the buffer.
31Parsing is done in a background thread, so it may take a little while for the
32tree to appear (or possibly a long while, if the document references a DTD on
33the Internet, for example).
34<p>
35Starting with version 0.19.0.2, j uses the XML parser provided as part of the
36Java 1.4 runtime library. (Earlier versions of j included a version of the
37&AElig;lfred XML parser.)
38<p>
39If you would rather use a different XML parser, you need to do two things:
40<ul>
41<li>
42Add the relevant jar file(s) to j's runtime <code>CLASSPATH</code>. If you
43build j from source, you can use the configure script's
44<code>--with-extensions</code> option to do this:
45<pre>
46        ./configure --with-extensions=/usr/share/java/xercesImpl.jar
47</pre>
48The j shell script that is automatically generated and installed will then use
49the correct <code>CLASSPATH</code>.
50<br><br>
51</li>
52<li>
53Add a line to your <a href="preferences.html">preferences</a> file to specify
54the <a href="preferences.html#org.xml.sax.driver">org.xml.sax.driver</a>
55property, which tells j the fully qualified class name of the parser to use.
56For example:
57<pre>
58        org.xml.sax.driver = org.apache.xerces.parsers.SAXParser
59</pre>
60(The corresponding property in versions of j prior to 0.19.0.2 was
61"org.xml.sax.parser".)
62</li>
63</ul>
64<p>
65When you have a tree in the sidebar, the selection in the tree will follow
66along as you navigate in the edit buffer, but the tree is not automatically
67expanded to show nested nodes. You can use
68<a href="commands.html#xmlFindCurrentNode">xmlFindCurrentNode</a>, mapped by
69default to Ctrl =, to force the tree to expand all the way down to the node
70corresponding to the location of the caret in the edit buffer.
71<p>
72Clicking on a node in the tree moves the caret to the corresponding
73location in the edit buffer.
74<p>
75The tree is refreshed automatically by the idle thread when you make changes to
76the buffer.
77<p>
78You can also use <a href="commands.html#xmlParseBuffer">xmlParseBuffer</a>,
79mapped by default to Ctrl P, to force the tree to be refreshed. The parser uses
80the image of the buffer in memory, rather than the file on disk, so there's no
81need to save any changes you've made to the buffer before refreshing the tree.
82<p>
83If <a href="commands.html#xmlParseBuffer">xmlParseBuffer</a> encounters an
84error, the tree is not updated.
85<p>
86Parser errors that occur when j is automatically refreshing the tree are not reported.
87<p>
88<a href="commands.html#xmlParseBuffer">xmlParseBuffer</a> invokes
89<a href="commands.html#xmlFindCurrentNode">xmlFindCurrentNode</a> automatically
90when it succeeds in updating the tree.
91<p>
92The following commands are also specifically relevant in XML mode:
93<ul>
94<li><a href="commands.html#xmlElectricEquals">xmlElectricEquals</a></li>
95<li><a href="commands.html#xmlFindMatch">xmlFindMatch</a></li>
96<li><a href="commands.html#xmlInsertEmptyElementTag">xmlInsertEmptyElementTag</a></li>
97<li><a href="commands.html#xmlInsertTag">xmlInsertTag</a></li>
98<li><a href="commands.html#xmlValidateBuffer">xmlValidateBuffer</a></li>
99</ul>
100</body>
101</html>
Note: See TracBrowser for help on using the repository browser.