The invention relates generally to flat file formats. More particularly, the invention relates to systems and methods for defining conversion rules used by components that perform conversion from flat file format to XML and back.
Flat file formats are used widely in Enterprise Application Integration (EAI) and Business to Business (B2B) solutions. The formats describe the layout of the meaningful information within the data stream in such a way so that the parsing of that stream and extraction of the information can be automated. An example of a flat file format is a Comma Separated Values (CSV) format, where units of data are delimited between each other by using a comma character. Another example is a positional format where the units of data occupy certain positions relative to each other within the data stream.
A common task that is performed very often is conversion of the documents from various flat file formats into an XML representation and vice versa. Though the flat file to XML conversion components in known EAI products (e.g., Microsoft BizTalk Server 2000/2002/2004, BEA WebLogic Integration) provide rich support for parsing/serializing very complex flat file data structures, they lack the easy to use and intuitive user interface for defining the conversion rules. This results in low developer productivity when working with flat file formats as the developer spends most of her time learning about parsing rules, trying to develop the parsing schema and then debugging it. It would be desirable, therefore, if systems and methods were available to simplify the process of defining the conversion rules used by components that perform conversion from flat file format to XML and back.
The invention provides systems and methods for iterative definition of the flat file structure from a document instance. The invention simplifies the process of defining the conversion rules for the flat file formats. These rules are used by components that perform conversion from flat file format to XML and back. The invention allows definition of those rules by working with the flat file document instance and iteratively creating an XML schema from that instance.
A format definition method according to the invention simplifies a very common task that developers need to perform in EAI and B2B solutions. There are plenty of applications in EAI and B2B spaces that still have not adopted and have no plans to adopt XML formats for data interchange. In order to utilize the XML technologies while working with data from those applications, developers may need to be able to translate the data from custom flat file formats to XML format.
The invention enables users to define an XML schema for parsing flat files by using familiar user interface constructs that are already utilized in other known products, such as Microsoft Excel Text data import wizard and Microsoft SQL DTS data import wizard, for example. The invention allows developers to interactively create a parsing schema quickly and with minimal knowledge necessary. It also reduces the parsing schema debugging time considerably as it eliminates most of the user errors by guiding the developer through the schema creation process.
Example Computing Environment
Although not required, the invention can be implemented via an application programming interface (API), for use by a developer or tester, and/or included within the network browsing software which will be described in the general context of computer-executable instructions, such as program modules, being executed by one or more computers (e.g., client workstations, servers, or other devices). Generally, program modules include routines, programs, objects, components, data structures and the like that perform particular tasks or implement particular abstract data types. Typically, the functionality of the program modules may be combined or distributed as desired in various embodiments. Moreover, those skilled in the art will appreciate that the invention may be practiced with other computer system configurations. Other well known computing systems, environments, and/or configurations that may be suitable for use with the invention include, but are not limited to, personal computers (PCs), automated teller machines, server computers, hand-held or laptop devices, multi-processor systems, microprocessor-based systems, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and the like. An embodiment of the invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network or other data transmission medium. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
With reference to
Computer 110 typically includes a variety of computer readable media. Computer readable media can be any available media that can be accessed by computer 10 and includes both volatile and nonvolatile, removable and non-removable media. By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), Electrically-Erasable Programmable Read-Only Memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CDROM), digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by computer 110. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media. Combinations of any of the above should also be included within the scope of computer readable media.
The system memory 130 includes computer storage media in the form of volatile and/or nonvolatile memory such as ROM 131 and RAM 132. A basic input/output system 133 (BIOS), containing the basic routines that help to transfer information between elements within computer 110, such as during start-up, is typically stored in ROM 131. RAM 132 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by processing unit 120. By way of example, and not limitation,
The computer 110 may also include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only,
The drives and their associated computer storage media discussed above and illustrated in
A monitor 191 or other type of display device is also connected to the system bus 121 via an interface, such as a video interface 190. In addition to monitor 191, computers may also include other peripheral output devices such as speakers 197 and printer 196, which may be connected through an output peripheral interface 195.
The computer 110 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 180. The remote computer 180 may be a personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 110, although only a memory storage device 181 has been illustrated in
When used in a LAN networking environment, the computer 110 is connected to the LAN 171 through a network interface or adapter 170. When used in a WAN networking environment, the computer 110 typically includes a modem 172 or other means for establishing communications over the WAN 173, such as the Internet. The modem 172, which may be internal or external, may be connected to the system bus 121 via the user input interface 160, or other appropriate mechanism. In a networked environment, program modules depicted relative to the computer 110, or portions thereof, may be stored in the remote memory storage device. By way of example, and not limitation,
One of ordinary skill in the art can appreciate that a computer 110 or other client devices can be deployed as part of a computer network. In this regard, the present invention pertains to any computer system having any number of memory or storage units, and any number of applications and processes occurring across any number of storage units or volumes. An embodiment of the present invention may apply to an environment with server computers and client computers deployed in a network environment, having remote or local storage. The present invention may also apply to a standalone computing device, having programming language functionality, interpretation and execution capabilities.
Iterative Definition of Flat File Data Structure by Using Document Instance
A typical flat file 200 may include any number of data fields. The example flat file 200 depicted in
To enable processing of flat files having such a format, a developer may wish to define a flat file schema. An example of a flat file schema definition may be an XML schema definition (“XSD”), with additional flat file annotations.
The invention provides an iterative definition process that may include interactive creation of a flat file schema with flat-file-specific annotations from the flat file document. Such a process may be implemented by using a “wizard”-like tool or a dialog control. The tool may provide a user interface for each step of the iterative schema definition process.
At step 304, the user may select all or part of the data in the document instance to be used to define the record.
At step 306, the user may specify the structure of the selected part of the document, that is, how the record data is formatted.
As described above in connection with
At step 308, the user may specify parsing rules for processing the selected data.
At step 310, the tool parses the selected data in accordance with the specified parsing rules. For example, the tool may separate the record Root into three child records, one for each line.
At step 312, the user may verify that the data has been parsed as expected (e.g., in accordance with the parsing rules).
At step 314, the types of schema elements corresponding to each child element may be specified.
A data type corresponding to each child element may also be specified. Example data types include any XSD types, such as string, integer, unsigned integer, datetime, etc. As shown, the element Root-Child1 may be specified as having a date type of “string.”
After the user verifies that the data has been parsed as expected and verifies the types of schema elements corresponding to each child element, the user may cause the tool to create the schema elements in the schema by clicking the “Next” button. At step 316, the tool may create the schema elements.
At step 318, the user may select the next schema element to be defined on the next iteration.
Steps 304-316 may then be repeated for the next selected element, e.g., Root-Child2. The data fields in Root_Child2 may be defined by relative position. As shown, each data field may have a constant field length and the fields may be immediately adjacent to one another (i.e., with no characters between the end of one field and the start of the next field). Alternatively, adjacent fields may be separated from one another by a known, fixed number of characters. For the record Root-Child2, the user may specify, at step 306, that the record is being defined “By relative positions” and clicking on the “Next” button (see
When the user is satisfied that all the elements have been properly delineated, the user may then click the “Next” button to cause the tool to parse the selected data, at step 310, in accordance with the specified parsing rules. For example, the tool may separate the record Root_Child3 into one or more child elements, (e.g., one each for country, name, street address, city, state, and ZIP code).
As shown throughout
Note that, where data fields are separated by delimiter symbols, the data fields may have variable length. The data fields in the third line of Root, for example, have variable lengths and are separated by delimiter symbol “|”. A delimiter symbol associated with a field may be placed before or after the associated field. There may or may not be delimiter symbols at the beginning and/or end of a line. A delimiter symbol may include one or more characters. Different delimiter symbols may be used in the same file.
If the next selected element is a child of an element that was selected during a previous iteration, then the corresponding part of the data may be selected automatically at step 304. Thus, as the user goes through successive iterations, the tool can self-discover selections of the data that correspond to the selected schema element.
As described above, the invention provides a method and tool for generating metadata describing the format of a flat file based on an instance of the flat file. Such a method enables a user to get from an instance of a flat file to the metadata (e.g., XSD).
Thus, according to the invention, an XML schema, for example, may be generated from a flat file instance. The generated schema can be compiled and used in flat file pipeline components. The tool provides a visual, open flat file instance, such that the user need not manually enter the flat file instance. The user of the tool may be developer whose system consumes flat files, where the developer wants to know the structure of the flat file (by looking at the metadata, for example). Accordingly, a developer may be enabled to normalize data that can be massaged and put out in an alternative format.