3.1 Preparation

     

By design, XML processing tools are less forgiving about what they accept than the HTML browsers that you may be used to working with. Omitting a closing tag when creating an element in an HTML page, for example, may cause an undesirable result when the page is rendered, but the browser usually tries to recover gracefully and render something for you to see. In contrast, omitting an end tag when creating an element in a document that an XML parser will consume results in a fatal well-formedness error, and no such recovery is possible. In the context of AxKit (in which all XML processing happens on the server), this means that if you pass in a bad document, AxKit sends no content to the client. At best, you see an error message that indicates where things went wrong. To avoid frustration, take a little time to familiarize yourself with the XML processing tools available to you. At the very least, investigate how the XML parser you installed can be used from the command line to verify a document's well- formedness and validity. Being able to catch bad documents going in reduces the overall number of potentially user -visible errors. The ability to verify that your content and stylesheets are at least syntactically correct can make finding the cause of an error easier.

Even more than with a static HTML-based site, starting with a good directory structure is key to creating an easy-to-maintain XML-based site. The time and labor-saving benefits of having predictable paths for images, CSS stylesheets, etc. also apply to the files associated with XML processing. It's a good idea to get in the habit of creating a stylesheets (or similarly named) directory at the base of the host's DocumentRoot when you start a new project.

If you installed the AxKit demonstration site or included the sample axkit.conf in your main Apache configuration (covered in Section 2.4), you do not need to alter the web server's configuration at all. If not, follow the directions there, or add the following lines to the web server's httpd.conf, and stop and restart the server before proceeding:

 PerlModule AxKit AddHandler axkit .xml .xsp .dkb .rdf AxAddStyleMap text/xsl Apache::AxKit::Language::LibXSLT AxAddStyleMap application/x-xsp Apache::AxKit::Language::XSP AxAddStyleMap application/x-xpathscript Apache::AxKit::Language::XPathScript 

These directives load the AxKit core into Apache, set up the required Language transformation processors, and configure Apache to process all files that end in .xml , .xsp , .dkb , and .rdf with AxKit. With an appropriate directory structure and configuration in place, you can move on to creating the XML documents that you want to publish.



XML Publishing with AxKit
XML Publishing with Axkit
ISBN: 0596002165
EAN: 2147483647
Year: 2003
Pages: 109
Authors: Kip Hampton

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net