com.ddtek.xmlconverter
Class ConverterFactory

java.lang.Object
  extended bycom.ddtek.xmlconverter.ConverterFactory

public class ConverterFactory
extends Object

A factory class which is used to create new Converter and ConverterResolver objects. Converter objects are used to convert files to and from XML.

The ConverterFactory class allows the user to specify configuration parameters with getConfiguration() and create instances of Converter, and ConverterResolver.

An application program which will use DataDirect toXML and fromXML converters must first create an instance of ConverterFactory. The application may then specify configuration parameters using getConfiguration() Finally, the application can create xml converter objects with the methods newConvertToXML and newConvertFromXML

An application which uses the "converter:" protocol in a Uri in the document() function of an xslt or xquery, will need to use the ConverterResolver class which is an implementation of URIResolver. The application can get an instance of ConverterResolver using the newResolver() method.


Constructor Summary
ConverterFactory()
          Creates a new ConverterFactory.
 
Method Summary
 Configuration getConfiguration()
          Get a reference to the Configuration object in this ConverterFactory.
 ConvertFromXML newConvertFromXML(String conversion)
          Create a new ConvertFromXML which can convert XML data to a non-XML format.
 ConvertToXML newConvertToXML(Source conversion)
          Create a new ConvertToXML which can perform Custom XML Conversions.
 ConvertToXML newConvertToXML(String conversion)
          Create a new ConvertToXML which can convert non-XML data to XML.
 ConverterResolver newResolver()
          Create a new instance of ConverterResolver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConverterFactory

public ConverterFactory()
Creates a new ConverterFactory.

Method Detail

getConfiguration

public Configuration getConfiguration()
Get a reference to the Configuration object in this ConverterFactory. The application may modify the properties of the returned Configuration object. Those changes will apply to any Converter or ConverterResolver objects subsequently created from this ConverterFactory.

Returns:
The Configuration object.

newResolver

public ConverterResolver newResolver()
Create a new instance of ConverterResolver.

Returns:
The new ConverterResolver.

newConvertToXML

public ConvertToXML newConvertToXML(String conversion)
                             throws ConverterException
Create a new ConvertToXML which can convert non-XML data to XML.

Parameters:
conversion - Specifies the type of conversion to be performed. The conversion is specified as a converter Uri such as:
  • converter:CSV:sep=,:first=yes
  • converter:EDI:newline=crlf:val=yes:decode=yes:field=yes:len=no:seg=yes:tbl=yes:typ=yes:opt=no
  • converter:file:///c:/mypath/one.conv
Note: the "converter:" prefix is optional.
Returns:
The ConvertToXML object.
Throws:
ConverterException

newConvertToXML

public ConvertToXML newConvertToXML(Source conversion)
                             throws ConverterException
Create a new ConvertToXML which can perform Custom XML Conversions. If the user has built a Custom XML Conversion using Stylus Studio, then this method may be used to create a Converter object to run the custom XML conversion.
The Custom XML Conversion Definition is normally stored in a file whose name ends with ".conv". The Source parameter may be any Source for the .conv file. This method will read the source data into memory and use it to create a new ConvertToXML object.

Parameters:
conversion - The source of the Custom XML Conversion definition.
Returns:
The ConvertToXML object.
Throws:
ConverterException

newConvertFromXML

public ConvertFromXML newConvertFromXML(String conversion)
                                 throws ConverterException
Create a new ConvertFromXML which can convert XML data to a non-XML format.

Parameters:
conversion - Specifies the type of conversion to be performed. The conversion is specified as a converter Uri such as:
  • converter:CSV:sep=,:first=yes
  • converter:EDI:newline=crlf:val=yes:decode=yes:field=yes:len=no:seg=yes:tbl=yes:typ=yes:opt=no
Note: the "converter:" prefix is optional.
Returns:
The ConvertToXML object.
Throws:
ConverterException