How to build an XML development environment

xiaoxiao2021-03-06  49

The best way to learn XML is from simple development, bold practice, step by step. XML's wonderful place can only feel deeply in the development process, leaving the development is not good XML. Therefore, learning XML first should establish an XML development environment. I will introduce you how to build a Java-based XML development environment. Because I can't use Linux now, all examples are done on Windows. But all this

Software can be used on Linux and Windows, and the usage is also small. And in addition to Sun's JRE is Open Source

Software, anyone can take any use, or even re-release of commercial purposes. JRE can also be downloaded and used for free, just without source code. If you have these uses on Linux

Experience in software, I hope to contribute to everyone.

Building an XML development environment requires the following steps:

1. Install Java Runtime Environment

2. Install a Java compiler.

3. Install a JSP Container.

4. Install a Taglib that supports XSLT.

5. Install an XML Parser.

6. Install a support XSLT

Browser.

7. Install an editor of an XML file (optional).

step 1. Install Java Runtime Environment

It is recommended to use Sun's JRE 1.3, you can download from here:

Http://java.sun.com/j2se/1.3/jre/download-windows.html

Note: Not JDK 1.3, we need only JRE 1.3

After downloading JRE 1.3, run the installer, assume it installed under C: /JRE1.3. Then you need to set three environment variables.

Java_Home = C: /JRE1.3

Classpath = .; c: /jre1.3/lib/rt.jar

PATH =% path%; c: /jre1.3/bin

If you are Windows 95/98 / ME, place the settings of the environment variable in AutoExec.bat, then restart the machine, Windows NT / 2000 is set in "My Computer / Properties".

Step 2: Install a Java compiler.

It is recommended to use IBM JIKES, an efficient Open source Java compiler. JIKES homepage

Http://oss.software.ibm.com/developerWorks/opensource/jikes/

The latest version is 1.1.3, you can download from here:

http://oss.software.ibm.com/pub/jikes/jikes-1_13-mingw-win32.zip

After downloading, decompress it, get jikes.exe, put it in the directory in any Path environment variable, such as c: /jre1.3/bin

Edit a simple Hello World program to try:

// Hello.java

Public class hello {

Public static void main (String [] args) {

System.out.print ("Hello, World! / N");

}

}

Then compile

Jikes Hello.java

You can use Hello.class if you generate.

Step 3. Install a JSP Container.

It is recommended to use Jakarta Tomcat 3.2.1. Tomcat 3.2.1 can download from here:

http://jakarta.apache.org/builds/jakarta-

Tomcat / release / v3.2.1 / bin / you need to download Jakarta-

Tomcat-3.2.1.zip This file

If you are installed under Windows NT / 2000, there is JK_NT_SERVICE.ZIP under the Win32 / i386 directory.

After downloading, decompression, assume it placed in C: /

under Tomcat

Then you need to set an environment variable

Tomcat = C: /

Tomcat

In order to make Tomcat can use Jikes, you need to do a little Hack, the method is as follows:

will

Parser.jar, jaxp.jar under Tomcat, jaxp.jar, WebServer.jar joins the environment variable ClassPath to make it effective after entering the steps:

CD /

Tomcat / src / Org / Apache /

Tomcat / context

Edit file WebXmlReader.java, will

// Sw.addinitParam ("jspcompilerplugin", "org.apache.jasper.compiler.jikesjavacompiler");

Front of the comment removed

Then compile

Jikes WebXMLReader.java

Establish a temporary directory that uses the JAR tool (which can be obtained from JDK) WebServer.jar under the LIB directory of Tomcat.

MKDIR T

CD T

Jar XVF ../webserver.jar

ORG / APACHE /

WebXmlReader * .class under Tomcat / Context is replaced by the WebXmlReader * .class, which is built.

Then re-packaged:

JAR CF Webserver.jar.

Replace Tomcat's WebServer.jar with new webserver.jar

Edit the web.xml in Tomcat's confedment, will

jspcompilerplugin

org.apache.jasper.compiler.jikesjavacompiler

->

Outside the comment removed.

Edit in Tomcat's bin directory

Tomcat.bat, replace all Tools.jar to RT.jar

start up

Tomcat, run Startup.bat in the bin directory.

use

The browser makes tests, visit

http: // localhost: 8080

If the examples of JSP and Servlets can be compiled and running, Tomcat can be used.

Stop Tomcat with shutdown.bat

Under Windows NT / 2000, you can

Tomcat is installed as a service, the method is as follows:

Copy the wrapper.properties under Tomcat's Conf directory and edit. Two variables

Wrapper.

Tomcat_home

Wrapper.java_home

Set to Tomcat and JRE, replace all Tools.jar to RT.jar, respectively.

Then run

JK_NT_SERVICE -I Tomcat Wrapper.properties

Where Tomcat is the name of the service we installed. Enter the control panel to start the Tomcat Service. When the Tomcat Service is installed, set to manually, you can modify the property of Tomcat Service to make it automatically started.

Delete Tomcat Service:

JK_NT_SERVICE -R Tomcat

Step 4. Install a Taglib that supports XSLT.

Recommended XSL Taglib for XSLT in Jakarta Taglibs

Its page at http://jakarta.apache.org/taglibs/doc/xsl-doc/intro.html

Download Snapshot of XSL Taglib on this page. You can also download all Jakarta Taglibs, Jakarta Taglibs is wide, but here we have to use only in the XSL Taglib.

After downloading, decompress the XSL-Examples.War and XSL-Doc.war two files to Tomcat's WebApps directory, and then restart Tomcat. use

Browser access

Http:// localhost: 8080 / xsl-example /

Run the apply.jsp, if there is no error, showing a page with a lot of tables, XSL Taglib can use it.

XSL Taglib's document is also installed,

Http: // localhost: 8080 / xsl-doc /

You can start from this example and start writing your own XML handler step by step. For example, you can add a new Context to the Tomcat's server.xml.

DOCBASE = "path-to-your-work-Directory"

CrossContext = "false"

Debug = "0"

Reloadable = "True">

Where Path-to-Your-Work-Directory is your development directory. Copy the content of Tomcat's WebApps / XSL-EXAMPLES directory to your development directory, start writing your own XML handler with this program for reference.

About how to use JSP to develop XML to refer to Sun's WhitePaper, at: http://java.sun.com/products/jsp/pdf/jspxml.pdf

The basically that I tell you this method.

Step 5. Install an XML Parser.

After completing steps 3 and 4, you already have two available XML Parser, which is the Xun's JAXP and Xerces used by the Suncat itself used by XML.Apache.org used by XSL Taglib. JAXP includes two files Parser.jar and jaxp.jar, Xerces only one file Xerces.jar, these files can be found from Tomcat's directory.

It is recommended to use Xerecs XML Parser because it can already support XML Schema, and it is Open Source.

software. But this is entirely a personal preference, and Sun's XML Parser is also very good. Decide which XML Parser is used to add its file to the ClassPath. But don't use two XML Parser at the same time. You can use the Java program to use the JAVA program to process the XML file in your Java program after ClassPath.

Examples of applicable and usage about Jdom and SAX can be found: http: //developerlife.com

Step 6. Install a support XSLT

Browser.

This step is not necessary, because we can now use XSL Taglib to use XSL Taglib to use XSL Taglib to send the XML file to the HTML format, so actually you can use any you like.

Browser. But install a support XSLT

The browser can make our study. Although we need to do XSLT on the Server side, we will support XSLT

After the browser is popular, we can even save the XML and XSL files directly.

The browser will go. This will greatly reduce the burden on the Server side, because XSLT is not a relaxed job.

It is recommended to use Mozilla 0.8. Speaking here, you may ask again, why not use IE 4/5? IE 4/5 can I do XSLT? In addition to personal preferences, I can give three reasons for using Mozilla:

First, Mozilla supported XSLT version than IE 4/5, IE 4/5 supported XSLT is not a formal version, but a draft. That is: http://www.w3.org/tr/wd-xsl, and the XSLT supported by Mozilla is a formal version of XSLT. That is: http://www.w3.org/1999/xsl/transform.

Second Mozilla's XML applications include not only XSLT, but also RDF, XUL, SVG, Mathml, etc., so Mozilla is more than IE 4/5 from the intensity of XML.

The author of the third XML FAQ is advocated to Mozilla, and it is considered that Mozilla's support for XML is much better than IE 4/5.

OK, say so much, now go to the topic, how to make Mozilla 0.8 support XSLT?

First, download mozilla 0.8: http://www.mozilla.org/releases/

The latest version is version 0.8.1, but this version has been installed after the module that supports XSLT, it is not possible to run, so it is currently only available but a relatively slow version 0.8.

If you don't want other functions such as SVG / Mathml, the most convenient method is to install it well.

After installation, start Mozilla, visit this page: http://www.mozilla.org/projects/xslt/

There is an install button in the page, click this button to install the Transformiix module that implements the XSLT function.

Restart Mozilla, access the page mentioned above. Click on the link above Simple Example. If the result you see is the same as the result of clicking the Look Like link, then your mozilla has been able to support XSLT.

About how to configure mozilla 0.8 Support Java Plug-in please refer to I send another post in XML version: Based on Mozilla's XML client solution, there is not much to say.

Step 7. Install an editor of an XML file.

This step is not necessary. Have you heard that someone now uses VI to do HTML pages? I have seen such a person, that is, teacher. In the teacher's personal home page, there is a look: Just Vim it! In fact, you can use any of your favorite editors to edit the XML file, but in order to facilitate friends who are used to using the WySIWYG editor, I still recommend a few comparisons Good XML editor: 1. XML SPY: A fully functional XML editor, a trial version can be downloaded.

http://www.xmlspy.com/

2. Editml Pro: Another full-functional XML editor.

http://www.editml.com

3. PSGML for Emacs: Emacs, I don't have to say anything?

Http://www.lysator.liu.se/projects/about_psgml.html

Here is just to add some other knowledge to this knowledge, and we can build a more powerful development environment.

Step 8. Install a better JSP Framework

It is recommended to use Struts. Struts is a subpredal of the Jakarta project, with a purpose to develop a JSP Framework based on MVC design mode. During the framework of Struts, development can effectively separate the representation layers and realization layers of the web application, and improve the reusability of the code. The development of MVC design patterns is the so-called MODEL 2 development model. The project is currently close, the latest version is 1.0-beta-1.

About what is the MVC design pattern to refer to the "design model" of the Machinery Industry Press. With regard to Struts, you can refer to the "Struts User Guide" I translated, in the articles in the articles: http://www.linuxforum.net/doc/strutsuserGuide.html

Download Jakarta Struts from here:

http://jakarta.apache.org/builds/jakarta-struts/release/v1.0-b1/

You need to download this file for jakarta-struts-1.0-b1.zip.

Decompress it, then copy the struts-example.war, Struts-Documentation.war to Tomcat's WebApps directory, and then restart Tomcat. use

Browser access

Http: // localhost: 8080 / struts-example /

Run the MailReader program in the page, if you can register correctly, you can use it.

Struts's document is also installed,

Http: // localhost: 8080 / struts-documentation /

For how to use Struts in your own development directory, please refer to the documentation belt with Struts. There are some discussion on Struts, and the search function of the forum can be found.

Step 9. Establish a connection with Apache

This is already the old growth, I introduce the easiest way, use the MOD_JK to establish a connection with Apache.

Suppose you have installed apache, download mod_jk from here:

http://jakarta.apache.org/builds/jakarta-

Tomcat / Release / V3.2.1 / bin / Win32 / I386 /

You need to download MOD_JK.ZIP file.

Unpack it, get a mod_jk.dll, copy it to the modules directory in the Apache installation directory.

Modify Apache's configuration file httpd.conf, add the following two lines: include C: /

Tomcat / conf / mod_jk.conf-auto

Jkmount /*.do ajp12

"C: /

Tomcat "is the installation directory of Tomcat.

Add Index.jsp to DirectoryIndex, namely:

DirectoryIndex index.html index.jsp

If you have a comment before ServerName, open the comment before ServerName, set it to localhost, ie:

ServerName Localhost

Restart Apache, access this page:

http: // localhost / example /

If you can list the JSP and Servlet directories, Tomcat and Apache are built.

OK, say so much, but it is not yet organized. Now in order to finish, we can start doing XML development. :-)

转载请注明原文地址:https://www.9cbs.com/read-82986.html

New Post(0)