XML Convert 2.2

Frequently Asked Questions

This page provides answers to frequently asked questions about XML Convert and the XFlat language. The questions are as follows:

On which platforms does XML Convert run?

XML Convert should run on any platform for which a Java Virtual Machine (version 1.1.7 or higher) is available. For example, XML Convert runs on Windows 95/98/Me/NT/2000/XP, Solaris, HP-UX, AIX, Linux, etc.

What is the size of the largest file that XML Convert can handle?

XML Convert can handle very large files. The size limit is determined by the amount of available space on your hard drive(s) rather than by the amount of RAM. XML Convert does not read the entire input file into memory. Nor does it build the entire output file in memory.

Is there a GUI application for creating and editing XFlat schemas?

XML Convert does not yet include a GUI application for creating and editing XFlat schemas. You can use an XML editor and the XFlat DTD to create and edit XFlat schemas. The XFlat Language page includes a list of XML editors.

What's the difference between the SequenceDef element and the ChoiceDef element?

A SequenceDef element is used to model a sequence of one or more objects in a flat file (or an XFlat instance), and a ChoiceDef element is used to model a choice of one object from a set of objects in a flat file (or an XFlat instance). An object is a record, a sequence of objects or a choice among objects. The XFlat Language page contains more information about the SequenceDef element and the ChoiceDef element.

Why do I get a 'java.lang.NoClassDefFoundError' error when I try to run XML Convert?

This error message indicates that your CLASSPATH environment variable doesn't contain the path name of the xflat.jar file. Please see Step 3 of the installation instructions for information about updating the CLASSPATH environment variable.

Can XML Convert transform EDI data (e.g., X12 or EDIFACT data) into XML?

Currently, XML Convert provides very limited support of EDI data. XML Convert does not support the following features of the EDI standards:

XML Convert can handle the following features of the EDI standards; however, support of these features requires complex XFlat schemas.

In summary, depending on your requirements, you may be able to write an XFlat schema that can be used to transform your EDI data into XML. On the other hand, you may find that it's difficult or impossible to write an XFlat schema that can be used to transform your EDI data into XML.

Is the XFlat language a standard?

No, the XFlat language is not a standard.

Can XML Convert handle binary data?

XML Convert provides limited support of binary data. XML Convert supports flat files that contain character data, including data that contains control characters and other non-printable characters. However, XML Convert cannot handle binary (i.e., non-character) data files, such as JPEG images, executables, etc.

Please see the Handling Special Characters section in the XFlat Language page for information about how to handle control characters and other non-printable characters. Also, please see the Optional Control-Z Character at the End of File section of the Examples page for an XFlat schema for a flat file that may contain an optional control-Z character at the end of the file.

The last record in my flat file may or may not be terminated with a linefeed. How do I deal with this?

Please see the Last Record May or May Not Be Terminated With a Record Separator section of the Examples page for an XFlat schema that deals with this requirement.

I want to map a flat file field to an attribute of the document element in the XML output. Can I do that?

In most cases, you can't map a flat file field to an attribute of the document element in the XML output. When you map a flat file field to an XML attribute of an element, the element must map to the record to which the field belongs. If the flat file contains more than one record, then the element containing the attribute must be a descendant of the document element. If the flat file contains only one record and the record maps to the document element of the XML output, then you can map a field in the record to an attribute in the document element.

Please see the description of the MapToXml attribute for more details about XML Convert's ability to map a flat file field to an XML attribute.

Can XML Convert handle an element such as "<book isbn='3-92784-403-2'>XML for Poets</book>"?

No, XML Convert cannot handle an XML element that contains both attributes and text content. XML Convert cannot create such an element when converting a flat file into XML, and it cannot deal with such an element when converting an XML document into a flat file.

Note that XML Convert can handle the following element:

<book isbn="3-92784-403-2">
    <title>XML for Poets</title>
</book>

A simple XSLT stylesheet can transform this element into the following:

<book isbn='3-92784-403-2'>XML for Poets</book>

Please see the description of the MapToXml attribute for more details about XML Convert's ability to map a flat file field to an XML attribute.

How can I change the order of the elements in the XML output file?

The order of the XML elements in the XML output file will be the same as the order of the corresponding data objects in the flat file.

You can use an XSLT stylesheet to change the order of the elements in the XML document that is created by XML Convert.

Where can I learn more about XSLT?

Extensible Stylesheet Language Transformations (XSLT) is a language for transforming XML documents into other XML documents. XSLT can also transform XML documents into HTML and text. XSLT is a W3C standard.

The following is a list of free XSLT processors:

For more information about XSLT, please see XSLT.com.

How do I transform three flat files into one XML document?

From the command line, XML Convert cannot transform multiple flat files into a single XML document. However, you could concatenate the three flat files into a single flat file before invoking XML Convert; you would also need to create an XFlat schema that models the concatenated flat file.

Alternatively, you could write a simple Java application that invokes XML Convert via the com.unidex.xflat.XmlConvert class to convert the multiple flat files into a single XML document. The Java program would use a java.io.SequenceInputStream to read the multiple flat files in sequence (as if they were a single InputStream). You would layer a java.io.InputStreamReader on top of the java.io.SequenceInputStream. You would then pass the InputStreamReader to the XmlConvert.flatToXml() method. The InputStreamReader would automatically read file #1, and then file #2, etc. You would not need to concatenate the flat files into one big flat file.

The convert_file.java file in the xmlconvert\samples folder is a simple Java application that invokes XML Convert via the com.unidex.xflat.XmlConvert class.

How do I transform three XML documents into one flat file?

XML Convert cannot transform three XML documents into a single flat file.

It is possible to create a fourth XML document that includes the three XML source files. For example, the following XML document includes (i.e., reads in) the contents of three XML documents (i.e., file1.xml, file2.xml and file3.xml):

 <?xml version='1.0'?>
 <!DOCTYPE all_files [
     <!ENTITY file1 SYSTEM "file1.xml">
     <!ENTITY file2 SYSTEM "file2.xml">
     <!ENTITY file3 SYSTEM "file3.xml">
 ]>
 <all_files>
  &file1;
  &file2;
  &file3;
 </all_files>
However, if file1.xml, file2.xml or file3.xml contains an XML declaration (i.e., <?xml version="1.0"?>), then this technique will not work.

Alternatively, XSLT can be used to concatenate the three XML source files into a single XML file. The following XSLT stylesheet will concatenate the source XML document (i.e., file1.xml), file2.xml and file3.xml files into a single XML output file:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:template match="/">
      <all_files>
          <xsl:copy-of select="." />
          <xsl:copy-of select="document( 'file2.xml' )" />
          <xsl:copy-of select="document( 'file3.xml' )" />
      </all_files>
  </xsl:template>
</xsl:stylesheet>

Please note that XSLT processors read the XML source document(s) into memory. If the three XML source documents are too large, then the XSLT processor may run out of memory and/or run slowly.

Can XML Convert handle packed decimal data?

XML Convert cannot convert a packed decimal field into a normal numeric string.

Can XML Convert insert a decimal point into a number that has an implied decimal point?

No. You could use a simple XSLT stylesheet to perform this conversion.

Can XML Convert add a fixed-value attribute to the XML output?

If you want to add an attribute to the XML output, such that the attribute value is fixed and does not appear within the flat file, then you can add a DTD to the XML output, such that the DTD defines the fixed-value attribute. Please see the XFlat Schema Uses the XFlat DTD Attribute section of the Examples page for an example of how to do this.

Can I invoke XML Convert from my Java application?

Yes. Please see the Invoking XML Convert page for more information.

Is XML Convert thread-safe?

Multi-threaded applications can invoke XML Convert via its Java API under certain conditions, which are described in detail in the javadoc for the XML Convert API.

How much does XML Convert cost?

Please refer to the Unidex web site for pricing information.

Is there a maintenance fee?

Currently, there is no maintenance fee. Please refer to the Unidex web site for more information.

What kind of support does Unidex provide?

The Support page provides information about support for XML Convert.

How do I purchase XML Convert?

You may purchase XML Convert via phone, fax, or a secure on-line order form. Please refer to the Unidex web site for more information.

What are the differences between the evaluation version and the licensed version of XML Convert?

The evaluation version of XML Convert is functionally equivalent to the licensed version of XML Convert, with the exception that the evaluation version stops working on the expiration date.

Can I resell XML Convert as a component of my software product?

Unidex has partners that resell XML Convert as a component of the partners' software products. If you are interested in such a partnership, then please contact Unidex at sales@unidex.com.