smunro16 has asked for the wisdom of the Perl Monks concerning the following question:
(The data is taken from a mixed xml file that looks a bit like:jobname: A Days:1,2,3 jobname: B Days: 1,3 OR jobname: A days:1,2,3 jobname: B days:1,3
my code is<DEFTABLE DATA... <SCHED_GROUP DATA... <JOB DATA...JOBNAME...WEEKDAYS... </JOB> </SCHED_TABLE> </DEFTABLE> At the moment my output is <code> jobnamedaysjobnamedays
Can someone tell me how to output the text in the format i want please?#!/usr/bin/perl -w use warnings; no warnings 'uninitialized'; use strict; use XML::Twig; use XML::LibXML; my $file = 'PYR.xml'; my $twig = new XML::Twig(KeepSpaces => 'true',TwigHandlers => { "JOB " + => \&Output}); open(INFO3, "+>$file.xml"); $twig->parsefile($file); sub Output { my( $twig, $s )= @_; print $s->att('JOBNAME',"\n"); print $s->att('WEEKDAYS',"\n"); print INFO3 $s->att("<JOBNAME>",'JOBNAME',"\n"); print INFO3 $s->att("<WEEKDAYS>",'WEEKDAYS',"\n"); print "Converted XML file into WORD file\n\n"; print $file." WORD docu +ment generated"; close(INFO3);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Twig Output Help
by Corion (Patriarch) on Aug 04, 2008 at 18:05 UTC | |
|
Re: XML::Twig Output Help
by Lawliet (Curate) on Aug 04, 2008 at 18:34 UTC | |
|
Re: XML::Twig Output Help
by toolic (Bishop) on Aug 05, 2008 at 01:38 UTC | |
by Anonymous Monk on Aug 05, 2008 at 08:22 UTC | |
by toolic (Bishop) on Aug 05, 2008 at 21:32 UTC |