Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

how to include xml contents in another xml file

by perlCrazy (Monk)
on Aug 22, 2012 at 16:04 UTC ( #989085=perlquestion: print w/ replies, xml ) Need Help??
perlCrazy has asked for the wisdom of the Perl Monks concerning the following question:

I am using xml::simple module to create xml file. have another template which is xml file. how to bring all the contents of template xml file into new xml file which is getting created ?

##Creating object for xml file my $xmls = XML::Simple->new( RootName => 'POWERMART', KeepRoot => 1, ForceContent => 1, ForceArray => ['SOURCE'] + + ); my $contents = {}; $contents->{POWERMART}->{creattion_date} = '02/08/2012'; ##Generate the xml file my $xmlFile = "test.xml"; $xmls->XMLout( $contents, xmldecl => '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n".' +<!DOCTYPE POWERMART SYSTEM "powrmart.dtd">', OutputFile => $xmlFile );

Comment on how to include xml contents in another xml file
Download Code
Re: how to include xml contents in another xml file
by zentara (Archbishop) on Aug 22, 2012 at 16:07 UTC
Re: how to include xml contents in another xml file
by ig (Vicar) on Aug 22, 2012 at 18:43 UTC

    You can read your template file with XML::Simple, then add elements to the resulting data structure and, finally, create a new xml file from the combined contents, again with XML::Simple.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://989085]
Approved by herveus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2014-09-20 08:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (157 votes), past polls