[xquery-talk] XQuery Update vs. Perl

jidanni at jidanni.org jidanni at jidanni.org
Thu Apr 4 04:04:41 PST 2013


Gentlemen, though I read
http://docs.basex.org/wiki/XQuery_Update
http://docs.oracle.com/cd/E17276_01/html/gsg_xml/cxx/modifydocument.html
it seems nothing can beat
#!/usr/bin/perl
while(<>){
    s!<Point>!$&<extrude>1</extrude><altitudeMode>relativeToGround</altitudeMode>!;
    print;
}
for simply inserting nodes ___and getting the whole modified document
back, and not just the modified Point nodes___.

How can I do
$ perl above_program.pl < input > output
but instead e.g., with basex etc.?

P.S., I also want to change all the
	  120.8663222,24.1810570
	  120.8666897,24.1811994
	  120.8661032,24.1812131
to
	  120.8663222,24.1810570,10
	  120.8666897,24.1811994,10
	  120.8661032,24.1812131,10
I bet it is 1000 times easier with perl.

To see the source I want to modify, do
$ wget http://jidanni.org/location/zaokeng.kmz
$ unzip zaokeng.kmz


More information about the talk mailing list