XML Table Import

java -jar jpilot-db.jar -i -t xml -x file -c file -o file 

Synopsis

The XML Importer reads in an XML file and depending upon the configuration settings contained within the config file, generates a Pilot-DB database PDB file from the XML data.

Command Line Arguments

option long option Purpose
-i --import "import" option
-t xml --type xml instructs the importer that you wish to import xml
-x path --input-file path the xml file to read
-c path --config-file path the configuration file
-o path --output-file path the output file (PDB)

Sample

java -jar jpilot-db.jar -i -t xml -x my.xml -c my.ifo -o my.pdb

GUI Version

Configuration File Format

directive purpose
database title the title of the database to generate
repeatingelement xml_element_name the XML element that repeats within the xml file that is the base path for your record data.
path column_name xml_path this designates that the column_name for a record will contain the value at the xml_path starting with the repeating_element as the relative document root.

sample configuration file


database OW People

# the name of the element that is the "record"
repeatingelement person

# root relative element names
path name /name
path client /client
path email /email
path home /phones/home
path office /phones/office
path cell /phones/cell

# this gets the address entities type attribute
path street /address/street
path city /address/city
path st /address/state

path spouse /family/spouse
path children /family/child


 

sample xml file


<ow>
    <person>
    <name>Trever Shick</name>
    <client>Widget Corporation</client>
    <title></title>
    <phones>
        <office>303 555-0812</office>
        <fax></fax>
        <home>303 555-0881</home>
        <cell></cell>
    </phones>
    <email>tshick@objectwave.com</email>
    <address>
        <street>555 W. Douglas Drive</street>
        <city>Denver</city>
        <state>CO</state>
        <zip>80221</zip>
    </address>
    <family>
        <spouse>Hijee</spouse>
    </family>
    </person>
</ow>

*NOTE - in this xml file, the <person> element repeats, hence the configuration file specifies "person" as the repeating element. Then, starting with person as a virtual root, the configuration file specifies the paths such as "/name" to get the element value contained within the <name></name> tags.