gam3 has asked for the wisdom of the Perl Monks concerning the following question:
I did not see how to replace the node with XML::XPath and I could not get XML::Twig to find my paths. I gave up at one point and wrote it in ruby:
This is a bit slow but works and was easy to find and get to work.#!/usr/bin/ruby -w require 'rexml/document' include REXML xmlfile1 = File.new("wiki.html") xmldoc1 = Document.new(xmlfile1) xmlfile2 = File.new("timeline.html") xmldoc2 = Document.new(xmlfile2) node1 = XPath.first(xmldoc1, "//div[@id=\"metanav\"]") node2 = XPath.first(xmldoc2, "//div[@id=\"metanav\"]") node1.replace_with(node2) print xmldoc1.to_s;
Maybe there are just too many XML packages available in Perl and that makes it hard to find the right one.
Anyway I would love to find a solution to this problem with a perl package.
Thanks in advance.
A picture is worth a thousand words, but takes 200K.