To get the values, once you have the DOM working, you'll need to use Witango's
<@elementattributes> (returns an array of attribute and its value) and <@elementvalue> to return the actual values for attributes and elements, respectively.


On Mar 27, 2005, at 5:50 AM, Jonah Simpson wrote:

Hey Mark,

See inline below...


On Sat, 26 Mar 2005 22:30:57 -0800, Mark Weiss <[EMAIL PROTECTED]> wrote:
I have Witango 5.5 running on Panther Server 10.3.8. We are looking at an
accounting package that will export and read in orders and customer
information that is in an XML format. I have a copy of their order format,
with the xml tages around that data.


Here is an example of the first few lines of their exported file.

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE av_import SYSTEM "av_import_dtd.xml">
<av_import version="1.0" data-source="DSC">
    <client id="15" client-name="Pedels Galore">
        <field name="client name">Pedels Galore</field>
        <field name="first name"></field>
        <field name="address1">7899 West Main Street</field>
        <field name="address2">P.O. Box 1232</field>
        <field name="address3"></field>
        <field name="city">Los Angeles</field>
        <field name="state">CA</field>
        <field name="zip">91207</field>
        <field name="country">USA</field>

Etc....

Is there an easy way to export data using Witango in this format? I mean I
can put all the information in variables and embed the variable between the
tags and export that. Is it that simple?

Yes. Just make sure that when you're creating the file for export that you use the proper kind of encoding so that you get the actual characters and not their html counterparts. I believe encoding="none" is what you're looking for but I can't remember off the top of my head.

Then going the other way...
In reading in the data that the accounting system exports, is there some
kind of library or something that runs on OSX that makes is easy to parse
this stuff out of the Accounting package file Through Tango into our DB? I
guess I am just a rookie when it comes to parsing logic. How do you isolate
the data between the field tags? I just have to believe someone smarter than
me has the logic figured out.

Check out DOM. WiTango has a DOM parser built in so you should be able to read your file into a variable, and throw the variable contents into the <@DOM> tag. Parsing XML in teh format you have is very simple. With DOM, you can think of the XML as a giant tree. There's levels and there's neighbours. Every opening xml tag creates a new level in the tree.

So if you have:
<xml>
<cars>
<ford>sucks</ford>
<honda>rules</honda>
</cars>
</xml>
and you want to find out how the document describes Ford, you would go:
root.child(0).child(0).value (not exact syntax) to find out that Ford sucks.
To find out about Honda, you would go:
root.child(0).child(1).value and find out Honda rules.


Anyway, there's a ton of documentation out there about DOM and the
WiTango documentation for its tags is pretty self explanatory, so you
shouldn't have any problems. If you do however, let us know and one of
the XML gurus will sort you out! ; >

Cheers,
Jonah Simpson

Thanks for any input or articles to read.

Thanks

Mark Weiss

______________________________________________________________________ __
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf


_______________________________________________________________________ _
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf



________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to