com.unidex.xflat
Class XtFlatFileBuilder

java.lang.Object
  |
  +--org.xml.sax.HandlerBase
        |
        +--com.unidex.xflat.XtFlatFileBuilder
All Implemented Interfaces:
org.xml.sax.DocumentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, com.jclark.xsl.sax.OutputDocumentHandler

public class XtFlatFileBuilder
extends org.xml.sax.HandlerBase
implements com.jclark.xsl.sax.OutputDocumentHandler

The XtFlatFileBuilder class is an XT output method that converts a result tree into a flat file, the layout of which is specified in an XFlat schema. The class also verifies that the result tree conforms with the XFlat schema.

XT is James Clark's XSLT processor, which is available at http://www.jclark.com/xml/xt.html.

The XtFlatFileBuilder class is an implementation of the com.jclark.xsl.sax.OutputDocumentHandler interface.

For more information about using the XtFlatFileBuilder class as an XT output method, please refer to the Invoking XML Convert as an XT Output Method section.

See Also:
Destination, OutputDocumentHandler, IOException, AttributeList, DocumentHandler, HandlerBase, SAXException

Constructor Summary
XtFlatFileBuilder()
          Creates an instance of the XtFlatFileBuilder class.
 
Method Summary
 org.xml.sax.DocumentHandler init(com.jclark.xsl.sax.Destination destination, org.xml.sax.AttributeList attribute_list)
          XT will automatically invoke the init() method when the com.unidex.xflat.XtFlatFileBuilder class is specified as the output method of the XSLT stylesheet.
 
Methods inherited from class org.xml.sax.HandlerBase
characters, endDocument, endElement, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, startDocument, startElement, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.DocumentHandler
characters, endDocument, endElement, ignorableWhitespace, processingInstruction, setDocumentLocator, startDocument, startElement
 

Constructor Detail

XtFlatFileBuilder

public XtFlatFileBuilder()
Creates an instance of the XtFlatFileBuilder class.

When the com.unidex.xflat.XtFlatFileBuilder class is specified as the output method in the XSLT stylesheet, XT will create an instance of the com.unidex.xflat.XtFlatFileBuilder class.

Method Detail

init

public org.xml.sax.DocumentHandler init(com.jclark.xsl.sax.Destination destination,
                                        org.xml.sax.AttributeList attribute_list)
                                 throws org.xml.sax.SAXException,
                                        java.io.IOException
XT will automatically invoke the init() method when the com.unidex.xflat.XtFlatFileBuilder class is specified as the output method of the XSLT stylesheet. The init() method returns an instance of the com.unidex.xflat.SaxFlatFileBuilder class, which implements the org.xml.sax.DocumentHandler interface.

The com.unidex.xflat.SaxFlatFileBuilder object converts a stream of SAX 1.0 document events into flat file data that conforms with an XFlat schema. The flat file data is written to the destination that is specified by the com.jclark.xsl.sax.Destination parameter of the init() method. The name of the XFlat schema file is specified as the value of the xflat:SchemaFile attribute, which must be in the attribute list that is the second parameter of the XtFlatFileBuilder.init() method. (In other words, the XSLT stylesheet must specify the name of the XFlat schema file via the xflat:SchemaFile attribute of the XSLT output instruction.)

If the specified XFlat schema is not a well-formed XML document or if it does not conform to the XFlat language, then the init() method will throw an org.xml.sax.SAXException, whose message will contain a detailed description of the syntax error, including the following information about the location of the error:

The line number of the first line in the schema is one. The column number of the first character in a line is one.

Specified by:
init in interface com.jclark.xsl.sax.OutputDocumentHandler
Parameters:
destination - The com.jclark.xsl.sax.Destination object that specifies where the flat file data will be written.
attribute_list - The org.xml.sax.AttributeList object that contains the attributes of the XSLT output element in the XSLT stylesheet. One of the attributes in the list must be the xflat:SchemaFile attribute, which specifies the name of the XFlat schema file.
Returns:
An instance of the com.unidex.xflat.SaxFlatFileBuilder class, which implements the org.xml.sax.DocumentHandler interface.
Throws:
org.xml.sax.SAXException - if the SchemaFile attribute is not found in the XSLT output element, or if the XFlat schema file is a directory or is not readable, or if the XFlat schema is not well-formed, or if the XFlat schema does not conform to the XFlat language.
java.io.IOException - if any other IO error occurs while reading the XFlat schema.
See Also:
Destination, SaxFlatFileBuilder, IOException, AttributeList, DocumentHandler, SAXException


Table of Contents

Copyright © 1999 - 2002 Unidex, Inc.
All rights reserved.

Unidex Home Page