Best way to import XML Files

George Simon george at worldest.com
Fri Jun 18 09:50:42 PDT 2004


This is basically the same way I did it.
I just finished writing the code and it seems to work just fine.
I discovered that filePro will let you use graphic characters as field and
record delimiters, so I used chr("249") which is a period in the middle of
the line ( · ) as both my field and record delimiters.
Since this character is never found, filePro imports the entire file into a
dummy in one step.  No need to replace the >.
I then parse the dummy looking for the tags I need.  I do not delete the
data in front of the tag (nice idea) but instead use pointers to the start
of the opening tag, the end of the opening tag and the start of the closing
tag.  I then use a simple formula to read the data between the end of the
opening tag and the start of the closing tag.  It works great and one you
figure the math for the pointers (which doesn't take long) the rest is a
snap.

Thanks.


George Simon (IT Department)
American River Logistics, LTD
614 Progress St.
Elizabeth, NJ  07205
Phone:(908)354-7746      Fax:(908)354-7491
mailto:george at worldest.com
http://www.americanriverintl.com/



-----Original Message-----
From: filepro-list-bounces at lists.celestial.com
[mailto:filepro-list-bounces at lists.celestial.com]On Behalf Of Howie
Sent: Friday, June 18, 2004 9:51 AM
To: George Simon; Filepro 2 List
Subject: Re: Best way to import XML Files

----- Original Message -----
From: "George Simon" <flowersoft at compuserve.com>
To: "Filepro 2 List" <filepro-list at nospam.celestial.com>
Sent: Monday, June 14, 2004 11:26 PM
Subject: Best way to import XML Files


I have to import and process several XML files at a time.
What I'm planning to do now, since I don't know the name of the files, is:
copy *.xml big.xml
and parse the big.xlm file.
Since there are no single-character field and record delimiters, what is the
best way to import this big.xml file?
----------------------------------------------------------------

I use the ">" character as both the record and field delimiters to the
import command.

Then I do:    wk = wk & inp(1) { ">"

Which restores the delimiter.

The code then loops back to the import until the entire file has been read
in.

When I get to end of file the variable wk has the complete file (with the
">" all restored), which I then parse using the INSTR instruction to find
the tags I need.

As each tag is found I shorten the data in wk by eliminating everything in
front of the tag I was looking for.

I hope that this helps, it works fine for my application.

Howie



_______________________________________________
Filepro-list mailing list
Filepro-list at lists.celestial.com
http://mailman.celestial.com/mailman/listinfo/filepro-list



More information about the Filepro-list mailing list