in reply to Re: Parsing an XML file with an undefined value
in thread Parsing an XML file with an undefined value

Thanks to both of you. I figured it out based on your comments. This is what I did:
my $text = qw/test4/; $test4 = $entry->getElementsByTagName( $text)->item(0); if (defined $test4) { $test4 = $entry->getElementsByTagName( $text)->item(0)->getFirstCh +ild->getNodeValue; }
Reps to both of you!

Replies are listed 'Best First'.
Re^3: Parsing an XML file with an undefined value
by Anonymous Monk on Jun 21, 2017 at 18:49 UTC
    I am a novice to perl and trying to implement this approach in my code. I am using ActivePerl on Windows. 2 questions: 1. I am getting an error stating that "parsefile" is undefined. I have defined the following modules in my code:
    use strict; use XML::Twig; use File::Basename; use XML::DOM;
    since I use parsefile through Twig for my previous code, would this be the cause of my error? I think it's interfering with calling parsefile through DOM. 2. Would this approach also work if I want to validate attributes instead of tags in an XML file? Thanks
      copy/paste the error message