I am trying to parse an xml file (sample input and out put below).I have some sample code written below,not sure how to proceed,I have the sample input xml file and the output.Please advise
Input XML file:- <build> <name>lpass</name> <build_id>M8960AAAAANAAL1004</build_id> <windows_root_path cmm_root_path_var="PASS_BUILD_ROOT">\\TEST\M9 +650AAAAANAAL1004\</windows_root_path> <linux_root_path cmm_root_path_var="PASS_BUILD_ROOT"/> <image_dir>lpass_proc</image_dir> <fat_file> <build> <name>rpm</name> <build_id>M8960AAAAANAAR1004</build_id> <windows_root_path cmm_root_path_var="PM_BUILD_ROOT">\\TEST\M965 +0AAAAANAAR1004\</windows_root_path> <linux_root_path cmm_root_path_var="PM_BUILD_ROOT"/> <image_dir>rpm_proc</image_dir> <download_file> <file_name>rpm.mbn</file_name> <file_path>rpm_proc/</file_path> </download_file> </build> <build> <name>wcnss</name> <build_id>M8960AAAAANAAW1004</build_id> <windows_root_path cmm_root_path_var="NSS_BUILD_ROOT">\\TEST\M96 +50AAAAANAAW1004\</windows_root_path> <linux_root_path cmm_root_path_var="NSS_BUILD_ROOT"/> <image_dir>wcnss_proc</image_dir> OUTPUT should be:- PASS_BUILD_ROOT \\TEST\M9650AAAAANAAL1004 PM_BUILD_ROOT \\TEST\M9650AAAAANAAR1004 NSS_BUILD_ROOT \\TEST\M9650AAAAANAAW1004 CURRENT CODE:- use strict; use warnings; use Getopt::Long; use File::Glob (); my %options=(); GetOptions (\%options,'loc=s'); #print "\n$options{loc}"; my $contents_xml = glob(($options{loc} . '\\contents.xml')); #print "\n$contents_xml";
In reply to Parsing an xml file by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |