in reply to XML::Twig output with delimiter
#!/usr/bin/perl -- use strict; use warnings; use XML::Twig; my $xml = <<'__XML__'; <root> <record> <id>1</id> <sched>QWERTY</sched> <filePath>D:/Book1.xls</filePath> <fString>bata</fString> </record> <record> <id>2</id> <sched>PANAMA</sched> <filePath>C:/test.doc</filePath> <fString>vata</fString> </record> </root> __XML__ my $t= XML::Twig->new(); $t->parse($xml); my $root= $t->root; my @para= $root->children(); # get the root's children foreach my $para (@para) { for my $pan( $para->children ){ print $pan->text, "\n"; } print $para->_dump(), "\n"; } __END__
1 QWERTY D:/Book1.xls bata | |-record | | |-id | | | |-PCDATA: '1' | | |-sched | | | |-PCDATA: 'QWERTY' | | |-filePath | | | |-PCDATA: 'D:/Book1.xls' | | |-fString | | | |-PCDATA: 'bata' 2 PANAMA C:/test.doc vata | |-record | | |-id | | | |-PCDATA: '2' | | |-sched | | | |-PCDATA: 'PANAMA' | | |-filePath | | | |-PCDATA: 'C:/test.doc' | | |-fString | | | |-PCDATA: 'vata'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Twig output with delimiter
by pankaj_it09 (Scribe) on Dec 09, 2008 at 12:06 UTC | |
by Anonymous Monk on Dec 09, 2008 at 12:11 UTC | |
by pankaj_it09 (Scribe) on Dec 09, 2008 at 12:56 UTC | |
by Anonymous Monk on Dec 10, 2008 at 07:43 UTC |