7-line XPath parser

Date view Thread view Subject view Author view

From: Kragen Sitaker (kragen@pobox.com)
Date: Fri Aug 18 2000 - 11:05:35 PDT

Note that this has been corrupted via cut-and-paste and, apparently,
prior decoding.


Some day I hope to be clever enough but till then:

Somebody else's 7 line xml (sort of) parser: The '$/043'
(that was a 'backslash043' below, but reversed here so emailers won't
change it to the russian 'yo' (?) or English pound symbol) is $^A or
$ACCUMULATOR var, I'm told.

---------- Forwarded message ----------
Date: Tue, 15 Aug 2000 18:02:55 +0100
From: David Ashe <dave@inta.net.uk>
...but somebody had to do it sooner or later...

xml parser including xml in 7 lines
does not support dtd's or entites, thats for the next version!

use strict; # xml path parser (c) david ashe
my $b=sub{print join('/',@{$_[0]}),'='.$_[1],"\n";};
my $a=sub{($_=$_[1])ne''?((s/^\///go)?pop
@@,$_:&$b(\@@,$@))))&int(!$_[0]):return 1;};
($<A3>?(($^ eq '>')?($<A3>,$@)=&$a($<A3>,$@):$@.=$^):(($^ eq

Perl-XML mailing list

Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Aug 18 2000 - 11:08:01 PDT