Skip to main content  
        iSeries home   |   Easy400  
 More commands ...

Public Source XML Parser
More commands ...

Before trying to parse a XML stream file you should take a close look at it.
As an example, take a look at stream file /ez4parse/examples/boooks.xml:

<?xml version="1.0"?>
   <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title>
      <description>An in-depth look at creating applications 
      with XML.</description>
   <book id="bk102">
      <author>Ralls, Kim</author>
      <title>Midnight Rain</title>
      <description>A former architect battles corporate zombies, 
      an evil sorceress, and her own childhood to become queen 
      of the world.</description>
Figure 1 - Sample XML stream file

The first thought is that, if you were to use command EZ4XLPARSE/XMLPARSER to parse this script to a database file, you would need a database file record format with the following field names:

Figure 2 - XML original field names

The second thought is that you would need to re-write the XML script for cutting down to 10 characters field names exceeding that length (in our example, field names PUBLISH-DATE and DESCRIPTION).

You would feel rather disappointed, because you hate to waste your time in such clerical works and you do not want to build such a future to yourself.

This is why we have built for you some more commands.

1-Command RNMXMLFLDS (Rename XML fields)

This command
  • Retrieves the field names used in a XML script
  • Suggests you new field names with a maximum length of 10 characters
  • Lets you assign different field names, if you wish
  • and ... creates a new XML stream file with the new field names.
In this way you could now use command XMLPARSE without any problem, providing that you have a database file - to receive the XML data - with the same field names.
For details about command RNMXMLFLDS, see this page.

2-Command CRTTODBF (Create the TO database file)

Don't you already have a database file containing all the required field names?
Cheer up! CRTTODBF will build it for you.
This command:
  • Scans the "renamed fields" XML script generated from command RNMXMLFLDS (or the original XML script, if it has no field name problems)
  • prompts you a list of the XML field names
  • assists you in assigning field properties, like data type, length and decimal positions
  • and ... creates the database file with the name, the record format name and the library name you desire.
Now you are all set for using command XMLPARSE.
Read more about command CRTTODBF at this page.

3-Command SUPERPARSE (Super-Parse XML scripts)

After going several times through the cycle RNMXMLFLDS-CRTTODBF-XMLPARSE you will start wondering about the opportunity of a single command that would let you easily walk through these commands.

We didn't wait for you to ask it. It's name is SUPERPARSE and is documented at this page.

Have fun with EZ4PARSE !!!