Extracting text from XML elements is easily done with
xml/sax addon, see example below. Also it can be done
with xml/xslt as shown in xml/xslt/test/test01.ijs
NB. =========================================================
NB. object oriented sax parser specialization
NB. extract text of specific elements
require 'xml/sax'
saxclass 'psax4'
TAG=: 'test'
startDocument=: 3 : 'PATH=: R=: $0'
endDocument=: 3 : 'R'
startElement=: 4 : 'PATH=: PATH,<y'
endElement=: 3 : 'PATH=: }:PATH'
characters=: 3 : 'if. TAG -: >@{: PATH do. R=: R,<y end.'
NB. =========================================================
cocurrent 'base'
TEST4=: 0 : 0
<body><test>s123</test><test>zz</test><q>z456</q><test>s456</test></body>
)
0 : 0 NB. Test
process_psax4_ TEST3
TAG_psax4_=: 'td'
process_psax4_ fread jpath '~addons/xml/sax/test/table.xml'
)
NB. =========================================================
--- Cliff Reiter <[EMAIL PROTECTED]> wrote:
> Hi,
> The legend gives the style of the trails. Each a color with gray edges.
> I assume you zoomed the png to full scale? As for parsing, I glanced
> at the xml addons and did not immediately see how to get what I wanted
> more gracefully than essentially just using cut; for example,
>
> rnd=:<.@(0.5&+)
>
> headnum=:[: ".@, (0 i.~ ] e. '0123456789.-'"_){.]
>
> cuts=:4 : 0
> (x E. y) <@((#x)&}.) ;.1 y
> )
>
> d_in_lap=:3 : 0
> 0.01*rnd 0.06214*headnum ; '<DistanceMeters>'&cuts y
> )
>
> is used to find the distance in a xml lap and convert from meters
> to rounded miles.
>
>
>
> [EMAIL PROTECTED] wrote:
> > Cliff, I stared at that .png file for about a minute, but did not see a
> > clearly marked route. I am severely color-blind so maybe the color of the
> > route is blending in with the color of other non-route lines on the map.
> > I certainly would like to know what you used to parse XML data in J.
> >
> >
> >
> >
> > Cliff Reiter <[EMAIL PROTECTED]>
> > Sent by: [EMAIL PROTECTED]
> > 05/18/2007 04:40 PM
> > Please respond to
> > General forum <[email protected]>
> >
> > An example of routes I take to Sunfish pond is shown at:
> > http://ww2.lafayette.edu/~reiterc/hikes/sunfish/home/sunfish_routes.png
____________________________________________________________________________________Choose
the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm