(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);
In reply to XML::Twig Output Help by smunro16
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |