com.ddtek.xmlconverter
Class ConverterFactory

java.lang.Object
  extended by com.ddtek.xmlconverter.ConverterFactory

public class ConverterFactory
extends Object

A factory class which is used to create new Converter, ConverterResolver and SchemaGenerator 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:" scheme 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.

A SchemaGenerator object can generate XML Schema files which describe the xml files used and created by Converter objects.


Constructor Summary
ConverterFactory()
          Creates a new ConverterFactory.
 
Method Summary
 Configuration getConfiguration()
          Get a reference to the Configuration object in this ConverterFactory.
static EDIDialect[] getDialects()
          Get a list of EDI dialects supported by this version of DataDirect XML Converters.
 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.
 SampleGenerator newSampleGenerator(String conversion)
          Create a new SampleGenerator which can produce a sample XML EDI file for a specific XML Converter.
 SchemaGenerator newSchemaGenerator(Source conversion)
          Create a new SchemaGenerator which can produce an XML schema file for a specific Custom XML Conversion.
 SchemaGenerator newSchemaGenerator(String conversion)
          Create a new SchemaGenerator which can produce an XML schema file for a specific XML Converter.
 XHTMLGenerator newXHTMLGenerator(String conversion)
          Create a new XHTMLGenerator which can produce a [X]HTML documentation for a specific XML Converter.
 
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

newSchemaGenerator

public SchemaGenerator newSchemaGenerator(String conversion)
                                   throws ConverterException
Create a new SchemaGenerator which can produce an XML schema file for a specific XML Converter.

Parameters:
conversion - Specifies the type of XML Converter. The conversion is specified as a converter Uri such as:
  • converter:CSV:first=yes
  • converter:EDI:dialect=EDIFACT:message=INVOIC:version=D06B
Note: the "converter:" prefix is optional. Note: the parameters supplied in the converter Uri are generally different than the parameters used with newConvertToXML and newConvertFromXML. The parameters control details of the schema generation process rather than the details of the ToXML or FromXML process.
Returns:
The SchemaGenerator object.
Throws:
ConverterException

newSchemaGenerator

public SchemaGenerator newSchemaGenerator(Source conversion)
                                   throws ConverterException
Create a new SchemaGenerator which can produce an XML schema file for a specific Custom XML Conversion. If the user has built a Custom XML Conversion using Stylus Studio, then this method may be used to create a SchemaGenerator object for that 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 SchemaGenerator object.

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

newXHTMLGenerator

public XHTMLGenerator newXHTMLGenerator(String conversion)
                                 throws ConverterException
Create a new XHTMLGenerator which can produce a [X]HTML documentation for a specific XML Converter.

Parameters:
conversion - Specifies the type of XML Converter. The conversion is specified as a converter Uri such as:
  • converter:EDI:dialect=EDIFACT:message=INVOIC:version=D06B
Note: the "converter:" prefix is optional. Note: the parameters supplied in the converter Uri are generally different than the parameters used with newConvertToXML and newConvertFromXML. The parameters control details of the X[HTML] generation process rather than the details of the ToXML or FromXML process.
Returns:
The XHTMLGenerator object.
Throws:
ConverterException

newSampleGenerator

public SampleGenerator newSampleGenerator(String conversion)
                                   throws ConverterException
Create a new SampleGenerator which can produce a sample XML EDI file for a specific XML Converter.

Parameters:
conversion - Specifies the type of XML Converter. The conversion is specified as a converter Uri such as:
  • converter:EDI:dialect=EDIFACT:message=INVOIC:version=D06B
Note: the "converter:" prefix is optional. Note: the parameters supplied in the converter Uri are generally different than the parameters used with newConvertToXML and newConvertFromXML. The parameters control details of the sample XML EDI generation process rather than the details of the ToXML or FromXML process.
Returns:
The SampleGenerator object.
Throws:
ConverterException

getDialects

public static EDIDialect[] getDialects()
Get a list of EDI dialects supported by this version of DataDirect XML Converters.

Returns:
An array of EDIDialect objects representing the supported dialects.