PBS2XML

A tool that can convert legacy files to human-readable XML might come in handy
Download

PBS2XML Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Freeware
  • Publisher Name:
  • Henrik Thomsen
  • Publisher web site:
  • http://www.codeproject.com/Members/Henrik-Thomsen
  • Operating Systems:
  • Windows All
  • File Size:
  • 33 KB

PBS2XML Tags


PBS2XML Description

Legacy file formats, such as UN-EDIFACT with a record per line and fixed-length fields, still exist and are widely used for B2B transactions.The PBS2XML application was developed to be a tool that can convert legacy files to human-readable XML might come in handy.Legacy file formats, such as UN-EDIFACT with a record per line and fixed-length fields, still exist and are widely used for B2B transactions. A tool that can convert legacy files to human-readable XML might come in handy. The tool I present here converts files similar to, but not identical to UN-EDIFACT. The file format in question is used by PBS - Payment Business Services (PBS) in Denmark. The tool might not be terribly relevant outside Denmark, but it does show how to deal with validating, searching and converting > 100 megabyte legacy files to XML in a fairly general manner.Usage:pbs2Xml.exe –s InfoService.xml –i Leverance.xml –o Leverance.xml –f "John Schmidt"The –s command line argument is the specification file which must follow the schema in PbsSpecification.xsd. The –i argument is the input file in legacy format. The –o argument is the output file in XML format. This is optional; leave it out when all you want is to validate the legacy file. The –f argument is a search filter. This is optional. It can be handy when dealing with very large files. If you are looking for information regarding a specific SSN, use this option to convert only records containing that SSN. Using the CodeI needed a tool to validate files used for business transactions in banking, pension and life insurance and convert them to XML. I also needed a general approach because the business rules for validating data were unclear. Basically I wanted a general parser that could read a legacy file with a record per line, fixed-length fields and a hierarchical record structure like the one in UN-EDIFACT documents. The parser must not know the specifics of the records, fields and validation rules. The specifics must be provided in a specification file so that changing parsing details does not require code changes, but merely changes to an XML file containing the parsing rules. pbs2xml is just a parser, and a parser of a specific B2B legacy file format, which is only used in Denmark. This sounds like application-specific code, not suited for CodeProject! Well, maybe not. It does however demonstrate an interesting technique: pulling out all of the business rules for parsing and validating a specific file format from the code and into an XML specification file. The specification file must follow some ground rules that are common for all B2B files used by Payment Business Services (PBS); these rules are represented by the schema in PbsSpecification.xsd. The overall format is similar to UN-EDIFACT: one record per line with fixed-length fields and a hierarchy of record types.


PBS2XML Related Software