Error when attempting to use cloneNode - Can't locate object method "cloneNode" via package "XML::DOM::NodeList"
by John Krewson other posts by this author
Jul 25 2007 11:35AM messages near this date
view in the new Beta List Site
Re: XML::LibXML::Reader
|
Re: Error when attempting to use cloneNode - Can't locate object method "cloneNode" via package "XML::DOM::NodeList"
& XSLT Greetings,
I'm pulling my hair out with this one as it seems to me it should work based
upon the examples I have found. I'm worried that I need to update a module
but I don't have the rights to do so - it would take longer than the
timeline on this particular task )-: I wonder if someone might have a
sample, full script that uses cloneNode so I can check to see if I might be
missing something?
I am running the following version of Perl:
This is perl, version 5.005_03 built for sun4-solaris
I am getting the following error when attempting to use cloneNode, in order
to clone a node and then paste this node into a target file:
Can't locate object method "cloneNode" via package "XML::DOM::NodeList"
Here are the related modules I am including:
use XML::LibXSLT;
use XML::LibXML;
use XML::DOM;
use XML::Parser;
And here is the tiny code block that is driving me nuts:
#### Source
my $parser = XML::DOM::Parser-> new();
my $source_xml = $parser-> parsefile($article_xml);
my $target_xml = $parser-> parsefile($article_xml);
#### Try the cloning technique
my $article = $source_xml-> getElementsByTagName('Article');
my $clone = $article-> cloneNode("deep"); # do a deep clone
Here is the source XML:
?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://w
ww.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Article>
<id> 1378264</id><section>AH RECIPES OTHER</section><create_date>Sep
05 2
002 05:28:12:000AM</create_date> <last_updated_date>May 07 2007
06:41:54:000PM</l
ast_updated_date> <publication_date>May 24,
2002</publication_date> <headline>Cook
ing with Garlic</headline> <url>
http://www.hgtv.com/hgtv/ah_recipes_other/article
/0,1801,HGTV_3186_1378264,00.html</url> <copyright>Copyright 2007,
</copyright>
</Article>
Here is the target:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.or
g/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<articles>
<article version="1.1" article_xml_create_date="July 09 2007
04:00:00:000PM">
</articles>
Thread:
John Krewson
Bjoern Hoehrmann
John Krewson
Richard E. Rathmann
John Krewson
James Woodworth
John Krewson
|