I guess & should be escaped as & so that your xml data is
malformed.

linefeed should be regarded as whitespace, not sure whether it
is a bug in sax addon or a feature of sax dll.

Пн, 11 авг 2014, Tom Arneson написал(а):
> I discovered that an '&' in a tagged field also messes up the SAX paser.
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Tom Arneson
> Sent: Sunday, August 10, 2014 21:02
> To: [email protected]
> Subject: [Jprogramming] Help for SAX addon
> 
> I have a need to parse XML data. So I'm trying the SAX addon. It is not in
> the 802 addon, so I got it from the JAL/801 addon.
> 
> Part of the XML data
> ======================================
> <wpt lat="41.08439000" lon="-93.50432000">
> <time>2014-08-10T11:28:59.289Z</time>
> <name>75PIJU</name>
> <desc>420 f w:2:05-06:Bahamas
> </desc>
> <link href="http://geovexilla.gpsgames.org/cgi-bin/vx.pl?wp=VX75-PIJU";>
> <text>VX75-PIJU</text>
> <type>text/html</type>
> </link>
> <sym>City (Medium)</sym>
> <type>3</type>
> <extensions>
> <time
> xmlns="http://www.topografix.com/GPX/gpx_modified/0/1";>2014-08-10T11:52:16.6
> 80Z</time>
> <label xmlns="http://www.topografix.com/GPX/gpx_overlay/0/3";>
> <label_text>75PIJU</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>
> ========================================
> 
> Note that there is a CRLF at the end of the string between the  <desc>
> </desc> tags
> 
> When this is parsed I get:
> ______________________
> │420 f w:2:05-06:Bahamas│ │
>                                                        ^boxed LF the CRLF
> causes <10{a to be appended to the result list.
> 
> NB. My script to parse (modified from sax_test4.ijs) NB.
> =========================================================
> NB. return a boxed list of the field with tag TAG NB.
> =========================================================
> 
> 
> require 'xml/sax'
> 
> saxclass 'psaxtag'
> 
> TAG=: 'desc'
> 
> 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'
> 
> desc=: process_psaxtag_ z
> 
> TAG_psaxtag_ =: 'label_text'
> 
> name=: process_psaxtag_ z
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to