Oleg,

Thanks for the encouragement. Here is my first working solution:

NB. ---------------------------------------------------------
NB. fragment of gpx file
testgpx=: 0 : 0
<gpx>
<wpt lat="42.13350000" lon="-88.97320000">
<time>2009-08-24T01:03:09Z</time>
<name>99BYTH</name>
<desc>120 farm</desc>
<link href="http://geodashing.gpsgames.org/cgi-bin/dp.pl?dp=GD99-BYTH";>
<text>GD99-BYTH</text>
<type>text/html</type>
</link>
<sym>Geocache</sym>
<type>Geocache|Virtual Cache</type>
<extensions>
<label xmlns="http://www.topografix.com/GPX/gpx_overlay/0/3";>
<label_text>99BYTH</label_text>
<text xmlns="http://www.topografix.com/GPX/gpx_style/0/2";>
<font>
<family generic="sans-serif">
<face>Arial</face>
</family>
</font>
</text>
</label>
</extensions>
</wpt>
<wpt lat="45.84690000" lon="-88.47240000">
<time>2009-08-24T01:03:09Z</time>
<name>99BYYL</name>
<desc>280 woods</desc>
<link href="http://geodashing.gpsgames.org/cgi-bin/dp.pl?dp=GD99-BYYL";>
<text>GD99-BYYL</text>
<type>text/html</type>
</link>
<sym>Geocache</sym>
<type>Geocache|Virtual Cache</type>
<extensions>
<label xmlns="http://www.topografix.com/GPX/gpx_overlay/0/3";>
<label_text>99BYYL</label_text>
<text xmlns="http://www.topografix.com/GPX/gpx_style/0/2";>
<font>
<family generic="sans-serif">
<face>Arial</face>
</family>
</font>
</text>
</label>
</extensions>
</wpt>
</gpx>
)
NB. ---------------------------------------------------------

require 'xml/sax/x2j'

x2jclass 'px2jgpxway'

'Items' x2jDefn
  /              :=  table                      : table=:
,:'latitude';'longitude';'name';'description'
  wpt            :=  table=: table,lat;lon;t;d  : 'lat lon'=: atr each;:'lat
lon'
  wpt/name       :=  t=: y
  wpt/desc       :=  d=: y
)

cocurrent 'base'


smoutput z=: process_px2jgpxway_ testgpx

------------T------------T------T-----------┐
│latitude   │longitude   │name  │description│
+-----------+------------+------+-----------+
│42.13350000│-88.97320000│99BYTH│120 farm   │
+-----------+------------+------+-----------+
│45.84690000│-88.47240000│99BYYL│280 woods  │
L-----------+------------+------+------------

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Oleg Kobchenko
Sent: Saturday, September 05, 2009 04:59
To: Programming forum
Subject: Re: [Jprogramming] x2j (XML to J) - innovative declarative way to
parse XML

This is very similar to 

http://www.jsoftware.com/jwiki/Addons/xml/sax/x2j%20Examples#x2j4.ijs

I don't want to spoil your fun. Seriously.
Give it a try and let us know how it goes.





----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to