Re: copying nodes from one xml file to an other
Petr Pajas <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
2010/4/7 Michael Ludwig <[email protected]>: > Tere Kristian, > > Am 07.04.2010 um 10:55 schrieb Kristian Kankainen: >> Tere Miikael! >> >>> Take a look at *importNode* and *adoptNode* in XML::LibXML::Document. >> This I allready did, but doesn't seem to work with XML::LibXML::Reader nodes, eg >> $outxml->adoptNode( $reader->copyCurrentNode ); >> doesn't seem to do anything (not even a warning or error) > > Then I suggest you post your code sample in the form of a runnable program stripped down to the bare > minimum so we can try and figure out what the error is. Also, you have to do something with the node as well, e.g. attach it to some node in the target document, otherwise $outxml->adoptNode( $reader->copyCurrentNode ); simply sets the document ownership on the extracted node. You need something like this: my $node = $reader->copyCurrentNode; $outxml->adoptNode( $node ); $target_parent_node->appendChild( $node ); -- Petr > -- > Michael.Ludwig (#) XING.com > > _______________________________________________ > Perl-XML mailing list > [email protected] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs