welcome hpws docs hp-ux webservers home contact hp support
hp logo - invent  hp-ux web server suite

Admin Guide for HP-UX XML Web Server Tools A.2.02

TABLE OF CONTENTS

Overview Requirements - Installation Xerces-J: XML Parser - Configuration Xalan-J: XSL Stylesheet Processor - Configuration Cocoon: XML Web-based Publishing - Configuration - Troubleshooting - Tuning FOP: XSL Formatting Object Processor - Configuration Batik: Toolkit for SVG - Configuration Known Bugs Legal Notices

OVERVIEW

HP-UX XML Web Server Tools is a collection of Java-based XML tools used for XML parsing, stylesheet and XSL processing, web-publishing and image translating from open source projects. The following versions are available in this release. Xerces-J 2.8.0 Xalan-J 2.5.1 Cocoon 2.0.4 FOP 0.20.5 Batik 1.5 Each component installs in its separate directory under /opt/hpws/xmltools/.

REQUIREMENTS

The minimum Java requirement for Xerces, Xalan, FOP and Cocoon is the JRE (Java Runtime Environment) 1.2.x or higher. However, Java 1.3 JRE is required for Batik and recommended for the other components. The latest versions of Java 1.2 and higher can be downloaded from http://www.hp.com/go/java. For HP-UX 11i on Itanium processor systems, only Java 1.3 or later is available.

Installation

Information on installing all products of HP-UX Web Server Suite can be found in Getting Started The user configurable files of HP-UX XML Web Server Tools will be saved as per the standard HP-UX newconfig methodology. More information can be found in the newconfig section of Getting Started.

XERCES-J: XML PARSER

Xerces (named after the Xerces Blue butterfly) provides world-class XML parsing and generation. Fully validating parsers are available for both Java and C++, implementing the W3C XML and DOM (Level 1 and 2) standards, as well as the de facto SAX (version 2) standard. The parsers are highly modular and configurable. Initial support for XML Schema (draft W3C standard) is also provided. The new Apache Xerces is a high performing and fully compliant XML parser. It is the reference implementation of Xerces Native Interface (XNI), a complete framework for building parser components and configurations that is extremely modular and easy to program. Xerces also includes a partial implementation of some portions of the Document Object Model Level 3 (Core, Load & Save, and Abstract Schemas working drafts). For more information on Xerces, see http://xml.apache.org/xerces2-j/index.html

Configuration

- Using Xerces-J : The only step to configure to start using Xerces is to include Xerces in your CLASSPATH: $ export CLASSPATH=/opt/hpws/xmltools/xerces-j/xercesImpl.jar:${CLASSPATH} - Using Xerces-J with Cocoon : A version of Xerces is built-in to the cocoon.war file. To use the specific version of Xerces within the cocoon implementation, refer to the Cocoon Configuration details.

XALAN-J: XSL STYLESHEET PROCESSOR

Xalan (named after a rare musical instrument) is an XSLT stylesheet processor for transforming XML documents into HTML, text, or other XML document types. It implements the W3C Recommendations for XSL Transformations (XSLT) and the XML Path Language (XPath). Xalan uses the Bean Scripting Framework (BSF) to implement Java and script extensions, features EXSLT extensions, nodeset extension, multiple document output extensions and SQL extension. Xalan can be used from the command line, in an applet or a servlet, or as a module in other program. For more information on Xalan, see http://xml.apache.org/xalan-j/index.html

Configuration

- Using Xalan-J from commandline : At the very minimum, ensure that xalan.jar, xml-apis.jar & xercesImpl.jar are on the system classpath. To run sample applications, include xalansamples.jar and xalanservlet.jar. To run extensions, include bsf.jar. All JAR files are distributed in the /opt/hpws/xmltools/xalan-j/bin directory. You can now using the following command to do transformations : $ export XML_TOOLS=/opt/hpws/xmltools $ export CLASSPATH=$XML_TOOLS/xerces-j/xercesImpl.jar:${CLASSPATH} $ export CLASSPATH=$XML_TOOLS/xalan-j/bin/xalan.jar:${CLASSPATH} $ export CLASSPATH=$XML_TOOLS/xalan-j/bin/xml-apis.jar:${CLASSPATH} $ export CLASSPATH=$XML_TOOLS/xalan-j/bin/xalansamples.jar:${CLASSPATH} $ java org.apache.xalan.xslt.Process -IN foo.xml -XSL foo.xsl -OUT foo.out where foo.xml is the Input XML file foo.xsl is the Stylesheet definition file foo.out is the output file that is generated - Using Xalan-J with Cocoon : A version of Xalan is built-in to the cocoon.war file. To use the specific version of Xalan within the cocoon implementation, refer to the Cocoon Configuration details.

COCOON: XML WEB-BASED PUBLISHING

Cocoon is a powerful framework for XML web publishing that brings a whole new world of abstraction and ease to consolidated web site creation and management based on the XML paradigm and related technologies. Cocoon allows you to define XML documents and transformations to be applied on it, to eventually generate a presentation format of your choice (HTML, PDF, SVG, ...). It also gives you the possibility to apply logic to your XML files, so that the XML pipeline can be dynamic. Cocoon's core difference between other dynamic content-generation tools is its use of XML throughout the content-generation process. Each request sent to the Cocoon framework is processed using the same three steps: 1. Generate XML content (either statically or dynamically) 2. Optionally transform it 3. Format it for output Along with this simple, easy-to-understand architecture comes great power and flexibility for developers. Although Cocoon is most often used for generating Web pages, it's by no means limited to that. It can generate any type of output you desire for any type of client device you like: HTML, XML, text, WML for WAP-enabled devices such as mobile phones, SVG images, Postscript, Adobe PDF, etc. And, of course, you can "roll your own" add-ons for Cocoon to generate any type of custom output format you need. Another major plus of Cocoon's XML-orientation is that it provides an excellent separation of content and presentation The Content is kept as presentation - free XML data for as long as possible during processing, and then formatted into the appropriate output format just before being returned to the user. Cocoon interacts with most data sources, including filesystems, RDBMS, LDAP, native XML databases, and network-based data sources. It adapts content delivery to the capabilities of different devices like HTML, WML, PDF, SVG, RTF, and others. Cocoon can be used as a Servlet as well as through a powerful, commandline interface. The deliberate design of its abstract environment gives you the freedom to extend its functionality to meet your special needs in a highly modular fashion. For more information on Cocoon, see http://xml.apache.org/cocoon/index.html

Configuration

Cocoon's centralized configuration system and sophisticated caching help you to create, deploy, and maintain rock-solid XML server applications. The main configuration files, assuming Cocoon deployment as a servlet in a servlet container include : sitemap.xmap: The document describes the Cocoon sitemap concept in full details, why it's there, what it does, how it works and how you can use it. DEFAULT LOCATION : $TOMCAT_HOME/webapps/cocoon cocoon.xconf: The configuration file having logicsheet registrations. It specifies the location of sitemap.xmap and other parameters. DEFAULT LOCATION : $TOMCAT_HOME/webapps/cocoon/WEB-INF logkit.xconf: The configuration file for logkit management. DEFAULT LOCATION : $TOMCAT_HOME/webapps/cocoon/WEB-INF web.xml: The servlet deployment descriptor. It specifies the location of cocoon.xconf, log file location and other parameters. DEFAULT LOCATION : $TOMCAT_HOME/webapps/cocoon/WEB-INF Cocoon can also be run on any servlet engine that supports Servlet version 2.2 or later. They include WebLogic, Resin, Microsoft IIS (using ServletExec) and many others. Using Cocoon with Tomcat: 1. Copy the cocoon.war file to $TOMCAT_HOME/webapps directory. 2. Start the servlet engine. 3. Type-in the URL http://localhost:8081/cocoon in your browser. You should see the Cocoon welcome message.

Troubleshooting

- Cocoon produces execution log entries for debugging/auditing. The amount of data to be logged can be controlled by log-level parameter in web.xml file. The default is DEBUG (maximum data). By default, the log file is: $TOMCAT_HOME/webapps/cocoon/WEB-INF/logs/cocoon.log. - Cocoon keeps the generated .java files in a directory tree starting at (by default): $TOMCAT_HOME/webapps/work/localhost_8080%2Fcocoon/org/apache/cocoon/www - Files created by LogTransformer are kept (by default) in $TOMCAT_HOME directory.

Tuning

http://xml.apache.org/cocoon/performancetips.html

FOP: XSL FORMATTING OBJECT PROCESSOR

FOP is a print formatter driven by XSL formatting objects. It is a Java 1.2 application that reads a formatting object tree and then turns it into a PDF document. The formatting object tree, can be in the form of an XML document (output by an XSLT engine like Xalan) or can be passed in memory as a DOM Document or (in the case of Xalan) SAX events. The output formats currently supported are PDF, PCL, PS, SVG, XML (area tree representation), Print, AWT, MIF and TXT with PDF as the primary output target. The advantage of XSL is the ability to take an XML document and to format the information into a page layout. The XML document can be generated in any way, the most common would be to use XSLT. FOP takes the XML and formats the data into pages. The pages are then rendered to the requested output. For more information, see http://xml.apache.org/fop/index.html

Configuration

FOP (Formatting Objects Processor) is the world's first print formatter driven by XSL formatting objects and the world's first output independent formatter. To use FOP, ensure that fop.jar, xalan.jar, xml-apis.jar, batik.jar and xercesImpl.jar are in your system classpath. The fop.sh script included as a part of the distribution sets up this environment for FOP. The usage information for FOP can be obtained by typing the following at the command prompt : $ /opt/hpws/xmltools/fop/fop.sh --usage

BATIK: TOOLKIT FOR SVG

Batik is a Java-based toolkit for applications or applets that want to use images in the Scalable Vector Graphics (SVG) format for purposes such as parsing, viewing, generation or manipulation on either the client side or the server side. Batik can manipulate SVG documents anywhere Java is available. It uses various Batik modules to generate, manipulate, transcode and search SVG images. Another possibility is to use Batik's modules to convert SVG to various formats, such as raster images (JPEG,PNG or Tiff). Batik comes with the following applications to help developers get familiar and be quickly able to use the various modules: 1. SVG browser (in the org.apache.batik.apps.svgbrowser package) 2. SVG rasterizer (in the org.apache.batik.apps.rasterizer package) 3. Font converter (in the org.apache.batik.apps.ttf2svg package) 4. SVG pretty printer (in the org.apache.batik.apps.svgpp package). For more information on Batik, see http://xml.apache.org/batik/index.html

Configuration

To use the various applications shipped with Batik, setup the system classpath to include the batik.jar file. $ export CLASSPATH=/opt/hpws/xmltools/batik/batik.jar:${CLASSPATH} Squggle SVG Browser : $ java -jar batik-squiggle.jar -font-size 10 SVG Rasterizer : $ java -jar batik-rasterizer.jar /path/to/svg/file SVG Font Converter : $ java -jar batik-ttf2svg.jar <ttf-path> [-l ] \ [-h <range-end>] [-ascii] [-id ] [-o ] [-testcard] SVG Pretty-printer : $ java -jar batik-svgpp.jar /path/to/svg/file

KNOWN BUGS

- some examples in cocoon may fail with the error "Connection refused" ------------------------------------------------------------------- This may be because the cocoon example has hard-coded the Tomcat port-number to port 8080. The HP-UX Tomcat-based Servlet Engine is enabled on port 8081 by default. SOLUTION : 1. Change the port number in the example -OR- 2. Change the port number in the Tomcat configuration, restart Tomcat and then try accessing the example. ***************************************************************************