old-www/LDP/LG/issue48/lane.html

395 lines
30 KiB
HTML

<!--startcut ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<title>Linux, Java and XML LG #48</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->
<!-- *** BEGIN navbar *** -->
<A HREF="index.html"><IMG ALT="[ Table of Contents ]"
SRC="../gx/indexnew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom ></A>
<A HREF="../index.html"><IMG ALT="[ Front Page ]"
SRC="../gx/homenew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="fisher.html"><IMG ALT="[ Prev ]" SRC="../gx/back2.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom></A>
<A HREF="../faq/index.html"><IMG ALT="[ Linux Gazette FAQ ]"
SRC="./../gx/dennis/faq.gif"WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="pollman.html"><IMG ALT="[ Next ]" SRC="../gx/fwd.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom ></A>
<!-- *** END navbar *** -->
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Linux, Java and XML</font></H1>
<H4>By <a href="mailto:eoinlane@esatclear.ie">Eoin Lane</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<p align="justify"><b>Abstract:</b><i>This article is a basic introduction to the new web markup
language XML and the transformation language XSL. Here I show
how the Apache web server can be configured using the servlet engine
JServ, to do client side XML/XSL transformation using Apache's Cocoon servlet.</i></p><p align="justify">Future updates for this article will be located at <A HREF="http://www.inconn.ie/article/cocoon.htm.">http://www.inconn.ie/article/cocoon.htm</A> <BR>(The domain name is currently non-functional but is expected soon.)</p><h2 align="left">Introduction</h2><p align="justify"><i>The eXtensible Markup Language</i> (XML) is a powerful new web markup language (ISO approval in February 1999). It is a powerful way of separating web content and
style. A lot has been written about XML, but to be used effectively in web design the technologies behind it must be understood. To this end I have added my own two pence worth to the already
vast amount of literature out there on the subject. This article is not
a place to learn XML, nor is it a place where the capabilities of XML are
explored to their fullest, but is is a place where the technologies behind XML can be
put in practice immediately.</p><p align="justify">Before I go any further, I should recommend the two sites where
definitive information on XML can be obtained. The first is the <i>World
Wide Web Consortium (W3C) site </i><A HREF="http://www.w3.org/">http://www.w3.org/</A>. The W3C are responsible for the XML specification. The second site is the
XML <i>frequency asked
questions</i> site (<A HREF="http://www.ucc.ie/xml/">http://www.ucc.ie/xml/</A>)
which will answer any other questions. I also recommend the XML
pages hosted by IBM,
<A HREF="http://www.ibm.com/xml/">http://www.ibm.com/xml/</A>,
where you will find a wide range of excellent tutorials and articles on XML.</p><p align="justify">The original web language, SGML (around since 1986) is the mother of all mark-up
languages. SGML can be used to document any
conceivable system; from complex aeronautical design to ancient Chinese
dialects. However, it
suffers from being over complex and unwieldy for routine web
applications. HTML is basically a very cut down version
of SGML, originally designed with the scientific publishing community
in mind. It is a
simple mark-up language (it has been said "anyone with a pulse
can learn it") and with the explosion of the web it is clear that the people with pulses have spoken. Since its foundation the web has
grown in complexity and it has long outgrown its lowly beginning in the
scientific community.</p><p align="justify">Today web pages need to be dynamic, interactive,
back-ended with databases, secure and eye catching to compete in an ever
more crowded cyberspace. Enter XML, a new mark-up language to deal
with the complexities of modern web design. XML is only 20 percent as
complex as SGML and can handle 80 percent of SGML situations (believe me
when you are talking about coding ancient Chinese dialects, 80 percent
is plenty). In the following section I will will briefly compare two markup examples, one in HTML and the second is XML, demonstrating the benefits of an XML approach. In the final section I will show you
how to set up an Apache web server to serve an XML document so
that you may begin immediately to start using XML in your web design.</p><h2 align="left">HTML</h2><p align="justify"> The following example is a very simple HTML document that everyone will be familiar with:
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#3333FF">&lt;html></font>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#3366FF">&lt;head></font>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#3333FF">&lt;title></font><font color="#33CC00">This
is my article</font><font color="#3333FF">&lt;/title></font>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#3333FF">&lt;/head></font>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#3333FF">&lt;body></font>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#3333FF">&lt;h1
align="center"></font><font color="#33CC00">This is my article</font><font color="#3333FF">&lt;/h1></font>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#3333FF">&lt;h3
align="center"></font><font color="#33CC00">by</font> <font color="#3333FF">&lt;a
href="mailto</font>:<font color="#33CC00">eoinlane@esatclear.ie</font><font color="#3333FF">"></font><font color="#33CC00">EoinLane</font><font color="#3333FF">&lt;/a>&lt;/h3></font>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#3333FF">&lt;/body></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/html></font>
<br>&nbsp;
Two important points can be made about this document.
<ul><li> The content and style are tied together in the document.</li><li> It would be very difficulty for a search program to search
this document and extract the mail address of Eoin lane.</li></ul>
XML addresses these two issues.
</p><h2 align="left">XML</h2><p align="justify">The XML equivalent is as follows:
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#3333FF">&lt;?xml
version="1.0"?></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;page></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;title></font><font color="#33CC00">This is my article</font><font color="#3333FF">&lt;/title></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;author></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;name></font><font color="#33CC00">Eoin Lane</font><font color="#3333FF">&lt;/name></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;mail></font><font color="#33CC00">eoinlane@esatclear.ie</font><font color="#3333FF">&lt;/mail></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/author></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
...</font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/page></font>
</p><p align="justify">The first thing to note is that this document, along with all
other valid XML
documents, is <i>well formed</i>. To be a <i>well formed</i>
document every tag must have an open and close brace. A program
searching for the mail address then has only to locate the text in between
the opening and closing tags of <i>mail</i>.
</p><p align="justify">The second and crucial point is that this XML document contains just data. There is nothing in this document
that dictates how to display the author's name or his mail address. In practice it is easier to
think about web design in terms of data and presentation separately. In
the design of medium to large web sites, where all the pages have the
same look and only the data is changing form page to page, this is
clearly a better solution. Also it allows a division of labour where, style and content can be
handled by two different departments, working independently. It also allows the possibility of having one set of data with a number of ways of presenting
it.</p><p align="justify">
An XML document can be presented using two different methods. One is using a Cascading Style Sheet (CSS) (see <A HREF="http://www.w3.org/style/css/">http://www.w3.org/style/css/</A>) to markup up the text in
HTML. The second is using a transformation language called XSL, which
converts the XML document into HTML, XML, pdf, ps, or
Latex. As to which one to use, the W3C (the people responsible for these specification) has this to say:<p align="center"><b>Use CSS when
you can, use XSL when you must.</b></p> They go on to say:
<p align="justify"><i>The reason is that CSS is much easier to use, easier to
learn, thus easier to maintain and cheaper. There are WYSIWYG editors
for CSS and in general there are more tools for CSS than for XSL. But
CSS's simplicity means it has its limitations. Some things you cannot
do with CSS, or with CSS alone. Then you need XSL, or at least the
transformation part of XSL.</i></p><p align="justify"><i>So what are the things you cannot do with
CSS? In general everything that needs transformations. For example, if
you have a list and want it displayed in lexicographical order, or if
words have to be replaced by other words, or if empty elements have to
be replaced by text. CSS can do some text generation, but only for generating small things, such as numbers of section headers.</i></p></p><h2 align="left">XSL</h2><p align="justify"> XSL <A HREF="http://www.w3.org/style/xsl/">(eXtensible Stylesheet
Language)</A> is
the language used to transform and display XML documents. It is not yet finished so
beware! It is a complex document formating
language that is itself an XML document. It can be further subdivided
in two parts: transformation (XSLT) and formatting objects (sometimes
referred to as FO, XSL:FO or simply XSL). For the sake of simplicity I
will only deal with XSLT here.</p><h3 align="left">XSL Transformations (XSLT)</h3><p align="justify">As of the 16th of November 1999 the World Wide Web Consortium
has announced the publication of XSLT as a W3C Recommendation. This
basically means that XSLT is stable and will not change in the
future. The above XML document can be transformed into a HTML document and
subsequently displayed on any browser using the following XSLT file.
<p><font color="#3333FF">&lt;?xml version="1.0"?></font>
<br><font color="#3333FF">&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"></font><font color="#3333FF"></font>
<p><font color="#3333FF">&nbsp; &lt;xsl:template match="page"></font>
<br><font color="#3333FF">&nbsp;&nbsp; &lt;html></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp; &lt;head></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp; &lt;title></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsl:value-of
select="title"/></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp; &lt;/title></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp; &lt;/head></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp; &lt;body bgcolor="#ffffff"></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsl:apply-templates/></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp; &lt;/body></font>
<br><font color="#3333FF">&nbsp;&nbsp; &lt;/html></font>
<br><font color="#3333FF">&nbsp; &lt;/xsl:template></font><font color="#3333FF"></font>
<p><font color="#3333FF">&nbsp; &lt;xsl:template match="title"></font>
<br><font color="#3333FF">&nbsp;&nbsp; &lt;h1 align="center"></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp; &lt;xsl:apply-templates/></font>
<br><font color="#3333FF">&nbsp;&nbsp; &lt;/h1></font>
<br><font color="#3333FF">&nbsp; &lt;/xsl:template></font><font color="#3333FF"></font>
<p><font color="#3333FF">&nbsp; &lt;xsl:template match="author"></font>
<br><font color="#3333FF">&nbsp;&nbsp; &lt;h3 align="center"></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp; by &lt;xsl:apply-templates/></font>
<br><font color="#3333FF">&nbsp;&nbsp; &lt;/h3></font>
<br><font color="#3333FF">&nbsp; &lt;/xsl:template></font><font color="#3333FF"></font>
<p><font color="#3333FF">&nbsp; &lt;xsl:template match="mail"></font>
<br><font color="#3333FF">&nbsp;&nbsp; &lt;h2 align="left"></font>
<br><font color="#3333FF">&nbsp;&nbsp;&nbsp; &lt;xsl:apply-templates/></font>
<br><font color="#3333FF">&nbsp;&nbsp; &lt;/h2></font>
<br><font color="#3333FF">&nbsp; &lt;/xsl:template></font><font color="#3333FF"></font>
<p><font color="#3333FF">&lt;/xsl:stylesheet></font><font color="#3333FF"></font>
</p><p align="justify">To learn more about XSLT, I recommend the XSLINFO site
(<A HREF="http://www.xslinfo.com/">http://www.xslinfo.com/</A>
as a good starting point. Also I found the <A HREF="http://metalab.unc.edu/xml/books/bible/updates/14.html">revised Chapter 14 from the
XML
Bible</A>
to be very good. This revision is based on the specifications that
eventually became the recommendation.</p><p align="justify">With the arrival of the next generation of browsers,
<i>i.e.</i> Netscape 5 (currently under construction <A HREF="http://www.mozilla.org">http://www.mozilla.org/</A>)
this transformation with be done client side. When an XML
file is requested the
corresponding XSL file will be sent along with it, and the transformation will be done by
the browser. Currently there are a lot of browsers only capable of
displaying HTML, and until then the transformation must be done server
side. This can be accomplished by using Java
servlets (Java server side programs).</p><p align="justify">The Cocoon servlet is such a
servlet, written by some very clever people at Apache (<A HREF="http://www.apache.org/">http://www.apache.org/</A>). It basically takes
an XML document and transforms it using a XSL document. An example of
such a transformation would be to convert the XML document into HTML
so that the browser can display it. So if your web
server is configured to run servlets, and you include the cocoon
servlet, then you can start designing your web pages using XML. The rest of this article will show exactly how to do this.</p><h2 align="left">How do I do it?</h2><p align="justify">I have tested the following instructions on a fresh installation of Red Hat 6.0, so I know it works.</p><h3 align="left">Apache Web Server</h3><p align="justify">First set up the Apache web server. On Red Hat this comes
pre installed but I want you to blow it away using: <font color="red" face="serif" size="3"><p>rpm
-e --nodeps apache</p></font> and do not worry about the error
messages. Next get a hold of the most recent Apache (<A HREF="http://www.apache.org/">http://www.apache.org/</A>) (currently verison 1.3.9) and copy it somewhere handy. I put mine in
<font color="black" face="serif" size="4">/usr/local/src</font>. Tar and unzip the file using:
<font color="red" face="serif" size="3"><p>tar zxvf apache_1.3.9.tar.gz</p></font> This will
expand the installation into the directory
<font color="black" face="serif" size="4">/usr/local/src/apache_1.3.9</font>. Change into this directory
and configure, build and install the application using the
following:<font color="red" face="serif" size="3"><p>./configure --prefix=/usr/local/apache
--mandir=/usr/local/man --enable-shared=max</p></font><font color="red" face="serif" size="3"><p>make</p></font><font color="red" face="serif" size="3"><p>make install</p></font>
This will install apache into the directory
<font color="black" face="serif" size="4">/usr/local/apache</font> and the important file to note here is
<font color="black" face="serif" size="4">http.conf</font> which can be found in the directory
<font color="black" face="serif" size="4">/usr/local/apache/conf</font>. This file contains most of the
important information necessary to run apache correctly. It contains
information on: where to serve the web documentsfrom, virtual web
servers and folder aliases. We will be returning to this file shortly so become familiar with it's general
layout. At this stage I had to reboot Linux and then start Apache using the following
instruction <font color="red" face="serif" size="3"><p>/usr/local/apache/bin/apachectl start</p></font>
To test it, point your web browser to <A HREF="http://localhost/">http://localhost/</A> and
you're in business, hopefully!
For good web design and planning I would refer you to an article that
I found invaluable in setting up my own web site: <A HREF="http://www.linuxgazette.com/issue43/gibbs/Web_Design.html">Better Web Site
Design under
Linux</A></p><h3 align="left">Java and JSDK</h3><p align="justify">As of October, IBM have released the Java Development Kit 1.1.8 for
Linux. It claims to be faster than the corresponding Blackdown's
(<A HREF="http://www.blackdown.org/">http://www.blackdown.org/</A>)
and Sun's
JDKs. Download IBM JDK (see
<A HREF="http://www.ibm.com/java/">http://www.ibm.com/java/</A>).
Again tar and unzip this into the
<font color="black" face="serif" size="4">/usr/local/src/jdk118</font> directory. Next, download the
<A HREF="http://java.sun.com/products/servlet/">JavaSoft's JSDK2.0</A>, the solaris version (not JSDK2.1 or any other flavours you might be
tempted to get) and tar and unzip it - again I put it in
<font color="black" face="serif" size="4">/usr/local/src/JSDK2.0</font>. Add the following or equivalent
to <font color="black" face="serif" size="4">/etc/profile</font> to make them available to your system.
<p><font color="blue" face="serif" size="3"><i>JAVA_HOME="/usr/local/src/jdk118"<br></i></font><font color="blue" face="serif" size="3"><i>JSDK_HOME="/usr/local/src/JSDK2.0"<br></i></font><font color="blue" face="serif" size="3"><i>CLASSPATH="$JAVA_HOME/lib/classes.zip:$JSDK_HOME/lib/jsdk.jar"<br></i></font><font color="blue" face="serif" size="3"><i>PATH="$JAVA_HOME/bin:$JSDK_HOME/bin:$PATH"<br></i></font><font color="blue" face="serif" size="3"><i>export PATH CLASSPATH JAVA_HOME JSDK_HOME<br></i></font></p>
To test them
run: <font color="red" face="serif" size="3"><p>java -version</p></font> at the command prompt, and you should get back the
following message <p align="left"><font color="brown" face="serif" size="3"><i>java version "1.1.8"<br></i></font></p> and to test the servlet development kit run:
<font color="red" face="serif" size="3"><p>servletrunner</p></font> and if all goes well you
should get back the following: <p align="left"><font color="brown" face="serif" size="3"><i>servletrunner starting with settings:<br></i></font><font color="brown" face="serif" size="3"><i>port = 8080<br></i></font><font color="brown" face="serif" size="3"><i>backlog = 50<br></i></font><font color="brown" face="serif" size="3"><i>max handlers = 100<br></i></font><font color="brown" face="serif" size="3"><i>timeout = 5000<br></i></font><font color="brown" face="serif" size="3"><i>servlet dir = ./examples<br></i></font><font color="brown" face="serif" size="3"><i>document dir = ./examples<br></i></font><font color="brown" face="serif" size="3"><i>servlet propfile = ./examples/servlet.properties<br></i></font></p>
We are now ready to install Apache's servlet engine, ApacheJServ.</p><h3 align="left">ApacheJServ</h3><p align="justify">Again, download the latest ApacheJServ (version 1.0 at this time,
although version 1.1 is in it's final beta stage) from Apache's Java Site
(<A HREF="http://java.apache.org/">http://java.apache.org/</A>)
and expand it into <font color="black" face="serif" size="4">/usr/local/src/ApacheJServ-1.0/</font>. Configure, make and
install it using the following instructions: <font color="red" face="serif" size="3"><p>./configure
--with-apache-install=/usr/local/apache --with-jsdk=/usr/local/src/JSDK2.0</p></font><font color="red" face="serif" size="3"><p>make</p></font><font color="red" face="serif" size="3"><p>make install</p></font>
When this has successfully completed add the following line to the end
of the <font color="black" face="serif" size="4">http.conf</font> file that I refereed to earlier during the Apache web
server installation: <p><font color="blue" face="serif" size="3"><i>Include /usr/local/src/ApacheJServ-1.0/example/jserv.conf<br></i></font></p>and restart the web server using:
<font color="red" face="serif" size="3"><p>/usr/local/apache/bin/apachectl restart</p></font> Now
comes the moment of truth, point your web browser to
<A HREF="http://localhost/example/Hello">http://localhost/example/Hello</A>
and if you get back the following two lines:<p align="left"><font color="brown" face="serif" size="3"><i>Example Apache JServ Servlet<br></i></font><font color="brown" face="serif" size="3"><i>Congratulations, Apache JServ is working!<br></i></font></p>
then you are almost home.</p><h3 align="left">Cocoon</h3><p align="justify">Finally, download the latest version of Cocoon (version 1.5 at this time) from Apache's Java Site
(<A HREF="http://java.apache.org/">http://java.apache.org/</A>).
Cocoon is distributed as a Java jar file and can be extracted using the command
<i>jar</i>. First, create the directory
<font color="black" face="serif" size="4">/usr/local/src/cocoon</font> and then expand the cocoon jar file
into it:
<font color="red" face="serif" size="3"><p>mkdir /usr/local/src/cocoon</p></font><font color="red" face="serif" size="3"><p>jar -xvf Cocoon_1.5.jar</p></font>
Now comes the tricky part of
configuring the JServ engine to recognise a file with a
<font color="black" face="serif" size="4">.xml</font> extension and to use the cocoon servlet process and
serve them.
</p><p align="justify">Locate the file <font color="black" face="serif" size="4">jserv.properties</font> which you will find in the
directory <font color="black" face="serif" size="4">/usr/local/src/ApacheJServ-1.0/example/</font> and at
the end of the section that begins:<p><font color="blue" face="serif" size="3"><i># CLASSPATH environment
value passed to the JVM<br></i></font></p> add the following:<p><font color="blue" face="serif" size="3"><i>wrapper.classpath=/usr/local/src/cocoon/bin/xxx.jar<br></i></font></p>
In the case of Cocoon 1.5 this means adding the following three lines:<p><font color="blue" face="serif" size="3"><i>wrapper.classpath=/usr/local/src/cocoon/bin/fop.0110.jar<br></i></font><font color="blue" face="serif" size="3"><i>wrapper.classpath=/usr/local/src/cocoon/bin/openxml.106-fix.jar<br></i></font><font color="blue" face="serif" size="3"><i>wrapper.classpath=/usr/local/src/cocoon/bin/xslp.19991017-fix.jar<br></i></font></p>
Although these files will change with different versions. The next file to locate is the <font color="black" face="serif" size="4">example.properties</font> file,
again found in the <font color="black" face="serif" size="4">/usr/local/src/ApacheJServ-1.0/example/</font>
directory and add the following line:
<p><font color="blue" face="serif" size="3"><i>repositories=/usr/local/src/cocoon/bin/Cocoon.jar<br></i></font></p>
In my <font color="black" face="serif" size="4">example.properties</font> file it meant changing the line:
<p><font color="blue" face="serif" size="3"><i>repositories=/usr/local/src/ApacheJServ-1.0/example<br></i></font></p>
to the following:
<p><font color="blue" face="serif" size="3"><i>repositories=/usr/local/src/ApacheJServ-1.0/example,/usr/local/src/cocoon/bin/Cocoon.jar<br></i></font></p>
Also add the following line to the end of the
<font color="black" face="serif" size="4">example.properties</font> file:
<p><font color="blue" face="serif" size="3"><i>servlet.org.apache.cocoon.Cocoon.initArgs=properties=/usr/local/src/cocoon/bin/cocoon.properties<br></i></font></p></p><p align="justify">The JServ engine is now properly configured and all that is left
for us to do it to tell Apache to direct any call to an XML file (or
any other file you want Cocoon to process) to the Cocoon servlet. For
this we need the JServ configuration file,
<font color="black" face="serif" size="4">jserv.conf</font> mentioned earlier (again in the same directory). Include the following line: <p><font color="blue" face="serif" size="3"><i>ApJServAction .xml
/example/org.apache.cocoon.Cocoon<br></i></font></p></p><p align="justify">In order to
access the cocoon documentation and examples add the following lines to
the <i>alias</i> section of
your <font color="black" face="serif" size="4">http.conf</font> file:
<p><font color="#3333FF"><font size=+0>Alias /xml/ "/usr/local/src/cocoon/"</font></font><font color="#3333FF"><font size=+0></font></font>
<p><font color="#3333FF"><font size=+0>&lt;Directory "/usr/local/src/cocoon/"></font></font>
<br><font color="#3333FF"><font size=+0>&nbsp;&nbsp;&nbsp; Options Indexes
MultiViews</font></font>
<br><font color="#3333FF"><font size=+0>&nbsp;&nbsp;&nbsp; AllowOverride
None</font></font>
<br><font color="#3333FF"><font size=+0>&nbsp;&nbsp;&nbsp; Order allow,deny</font></font>
<br><font color="#3333FF"><font size=+0>&nbsp;&nbsp;&nbsp; Allow from all</font></font>
<br><font color="#3333FF"><font size=+0>&lt;/Directory></font></font><font color="#3333FF"><font size=+0></font></font>
<p><font color="#3333FF"><font size=+0>Alias /xml/ example/"/usr/local/src/cocoon/example/"</font></font><font color="#3333FF"><font size=+0></font></font>
<p><font color="#3333FF"><font size=+0>&lt;Directory "/usr/local/src/cocoon/example/"></font></font>
<br><font color="#3333FF"><font size=+0>&nbsp;&nbsp;&nbsp; Options Indexes
MultiViews</font></font>
<br><font color="#3333FF"><font size=+0>&nbsp;&nbsp;&nbsp; AllowOverride
None</font></font>
<br><font color="#3333FF"><font size=+0>&nbsp;&nbsp;&nbsp; Order allow,deny</font></font>
<br><font color="#3333FF"><font size=+0>&nbsp;&nbsp;&nbsp; Allow from all</font></font>
<br><font color="#3333FF"><font size=+0>&lt;/Directory></font></font><font face="serif"><font color="#3333FF"><font size=+0></font></font></font>
<p align="justify">
Restart the web browser for this to take effect:
<font color="red" face="serif" size="3"><p>/usr/local/apache/bin/apachectl restart</p></font>
Now point your browser to <A HREF="http://localhost/xml/">http://localhost/xml/</A>
to browse the documentation and
<A HREF="http://localhost/xml/example/">http://localhost/xml/example/</A>
to try out the examples. If Cocoon complains about a exceeding a memory limit then open the file <font color="black" face="serif" size="4">cocoon.properties</font> found in the <font color="black" face="serif" size="4">/usr/local/src/cocoon/</font> directory. Find the line <p><font color="blue" face="serif" size="3"><i>store.memory = 150000<br></i></font></p>and change it to something lower like 15000. To try out the PDF examples, which I think
are very cool, you have to have Acrobat Reader installed as a
netscape plug-in, but it is worth the extra effort to get this
working.
</p><h2 align="left">Cocoon 2</h2><p align="justify">The Cocoon 1.x series has basically been a work in progress.
What started out as a simple servlet for static XSL transformation has grown into
something much more. With this ongoing development, design
considerations taken at the beginning of the project are now hampering future
developments as the scale and the scope of the project becomes
apparent. To add to this, XSL is also a work in progress,
although the current version of XSLT has become a W3C Recommendation (as of November, 16 1999).
</p><p align="justify">Cocoon 2 intends to address these issues and provide us with a
servlet for XML transformations that is scalable to handle large quantities
of web traffic. Web design of medium to large sites in the
future will be based entirely around XML, as its benefit become apparent, and the Cocoon 2 servlet will hopefully provide us with a way to use it effectively.</p><h2 align="left">Conclusions</h2><p align="justify"><p align="justify">Even as I have
been writing this article, Apache have opened a new site dedicated exclusively to
XML
(see <A HREF="http://xml.apache.org/">http://xml.apache.org/</A>).
The cocoon project has obviously grown beyond all expectations, and with
the coming of Cocoon 2 will be a commercially viable servlet to
enable design of web sites in XML to become a reality. The people at
Apache deserve a lot of credit for this so write to them and thank them,
join the mailing list and generally lend your support. After
all this is open source code and this is what Linux is all about. </p></body></html>
<!-- This page was served in 5463 milliseconds by Cocoon 1.5 -->
<DL>
<DT> <A HREF="misc/lane/lane.xml">lane.xml</A>
<DD> An XML version of this article.
<DT> <A HREF="misc/lane/lane.xsl">lane.xsl</A>
<DD> Its XSL style sheet.
<DT> <A HREF="misc/lane/lane.xml.txt">lane.xml.txt</A>
<DD> A text version of the XML source.
<DT> <A HREF="misc/lane/lane.xsl.txt">lane.xsl.txt</A>
<DD> A text version of the XSL source.
</UL>
<!-- *** BEGIN copyright *** -->
<P> <hr> <P>
<H5 ALIGN=center>
Copyright &copy; 1999, Eoin Lane<BR>
Published in Issue 48 of <i>Linux Gazette</i>, December 1999</H5>
<!-- *** END copyright *** -->
<!--startcut ==========================================================-->
<P> <HR> <P>
<!-- *** BEGIN navbar *** -->
<A HREF="index.html"><IMG ALT="[ Table of Contents ]"
SRC="../gx/indexnew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom ></A>
<A HREF="../index.html"><IMG ALT="[ Front Page ]"
SRC="../gx/homenew.gif" WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="fisher.html"><IMG ALT="[ Prev ]" SRC="../gx/back2.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom></A>
<A HREF="../faq/index.html"><IMG ALT="[ Linux Gazette FAQ ]"
SRC="./../gx/dennis/faq.gif"WIDTH=163 HEIGHT=60 ALIGN=bottom></A>
<A HREF="pollman.html"><IMG ALT="[ Next ]" SRC="../gx/fwd.gif" WIDTH=41 HEIGHT=60 ALIGN=bottom ></A>
<!-- *** END navbar *** -->
</BODY></HTML>
<!--endcut ============================================================-->