Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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 );

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://989085]
Approved by herveus
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2017-12-13 03:44 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (345 votes). Check out past polls.