Importing XML

JPilot-DB is able to import XML documents and convert them into JPilot-DB databases. Below is the XML import dialog. Explanations of each of these pieces can be found to the right of the image.

database info

this area is where you select the title for your database to be imported. If you wish to overwrite an existing database, then check "select existing" and choose the database from the drop down box.

xml specifics

repeating element

the repeating element text fields allows you to specify the outermost xml element that "contains" your record. see below for determining your repeating element.

field mappings

the field mappings section allow you to specify the name of a database field to create as well as the XML element name from which data will be imported. examples of this are shown below.

configuration file

if you've already imported this xml file before, then you may already have a mapping file, if so, you can use the load configuration button to open and load that preexisting configuration file. if you think you'll be importing this xml again, you may wish to save the configuration to a file by pressing the save configuration button. By the way, this configuration file is the same configuration file that can be used with the XML import command line utility.

determining your repeating element

<?xml version="1.0"?>
  <addressbook>
    <person>
      <name>Trever Shick</name>
      <bloodtype>a</bloodtype>
      <address>
        <city>Tulsa</city>
        <state>OK</state>
      </address>
    </person>
    <person>
      <name>Jimmy Crackcorn</name>
      <bloodtype>dont care</bloodtype>
      <address>
        <city>Anywhere</city>
        <state>IL</state>
      </address>
    </person>
  </addressbook>
In this example, i have exported my address book from "some" program. The repeating element is the element that "starts" your record as a whole. What does this mean? Essentially is means the start of the logical record. In the example above, my logical record is a person. For every record I have, the outlying element name is 'person', so this is my repeating element because it is repeated for every record.

field name/path mappings

using the example above,let's list some fieldname/path mappings. A "field" is simply the name of a JPIlot-DB field. A "path mapping" is basically a path expression that is root relative to the repeating element. WHAT? OK, if we use "person" as our repeating element, then we can reference "state" by a path mapping of /address/state. A quick list is below of some samples.
fieldnamepath mapping
a city/address/city
name/name
state/address/state
I don't think that the import utility is limited to a depth of "2" on the path mappings, but I have not tested past 2.