Using the Generic EDI XML Request Generator


The GenXML-generic utility was created to allow offices to convert CSV (Comma Separated Value) files into properly formatted PCT-EDI XML queries. CSV files can be generated by a variety of means, including by hand. However, most offices will wish to use commercial products, such as Microsoft Excel.

This simple utility, written in Perl, converts CSV files into properly formatted PCT-EDI XML queries, suitable for uploading into the PCT-EDI system.

NOTE: THIS SCRIPT IS AN EXAMPLE!! It will work "as-is" but it is not up to standards in terms of error processing, completeness, etc. It is a template for offices to use in the development of their own applications.


This utility requires the Perl interpreter to be installed on your machine. Perl is a freely available, open source application that runs under most operating systems, including:

Acorn | AIX | Amiga | Apple | Atari | AtheOS | BeOS | BSD | BSD/OS | Coherent | Compaq | Concurrent | Cygwin | Darwin | DG/UX | Digital | Digital UNIX | DEC OSF/1 | DYNIX/ptx | Embedix | EMC | EPOC | FreeBSD | Fujitsu | GNU Darwin | Guardian | HP | HP-UX | IBM | IRIX | Japanese | JPerl | Linux | LynxOS | Mac OS | Mac OS X | Macintosh | MachTen | MinGW | Minix | MiNT | MorphOS | MPE/iX | MS-DOS | MVS | NetBSD | NetWare | NEWS-OS | NextStep | NonStop | NonStop-UX | Novell | ODT | Open UNIX | OpenBSD | OpenVMS | OS/2 | OS/390 | OS/400 | OSF/1 | OSR | Plan 9 | Pocket PC | PowerMAX | Psion | QNX | Reliant UNIX | RISCOS | SCO | Sequent | SGI | Sharp | Siemens | SINIX | Solaris | SONY | Sun | Stratus | Tandem Tru64 | Ultrix | UNIX | Unixware | U/WIN | VMS | VOS | Win32 | WinCE | Windows 3.1 | Windows 95/98/Me/NT/2000/XP | z/OS

You may get perl from CPAN.

Complete instructions, source code, and precompiled binaries are available from this site. Windows and Unix developers will also find several excellent integrated development environments for Perl.

Using GenXML

Create a CSV File

The utility requires a very simple CSV file, however, the format is mandatory. Follow these simple instructions to create a CSV file from an EXCEL spreadsheet.

  1. Create a blank Excel spreadsheet.
  2. Starting with the FIRST row of the FIRST column (e.g. upper leftmost cell in the spreadsheet), enter a properly formatted document number. A properly formatted number will look like this: CH03/00244. Note the use of the 2 digit date and the short document identifier. The application will convert the date to a full 4 digits, and pad the identifier with leading zeros.[Sample]
  3. Enter as many numbers as you wish in this first column.
  4. When you have entered all the numbers, save the file, but select CSV as the file type in the file save dialog drop-down list.
  5. When saving the file, in addition to specifying the CSV format, you must name the file according to this convention: OfficeID-ST3Code-OutputType.csv.
    • The OfficeID is any identifier you desire, as long as it does not contain the - or . characters.
    • The ST.3Code is your office ST.3 Country Code.
    • The OutputType is ftp for delivery into your PCT-EDI directory, or cd-dvd for the automatic creation of CD-DVD's with the data results.[Sample]

Creating the PCT-EDI XML Query

Execute this command:

./ -file=103-XX-ftp.csv -doctype=p-doc -doctype=et-iper >output.xml

The -file flag is used to specify the input file. The -doctype flag can appear one or more times to specify one or more doctypes. The list of doctypes are:

  • -doctype=all - request ALL document types
  • -doctype=p-doc - request priority document
  • -doctype=iper - request international preliminary examination report
  • -doctype=et-iper - request English Translation IPER
  • -doctype=pamphlet -request pamphlet
  • -doctype=declaration - request declaration
  • -doctype=iasf - request the IASF

The output XML will contain the command line you entered, should you need to duplicate the action later.[Sample Output XML]