From a0b2a76fd8ef0146015d267fdce0f10ce6fae6fa Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Thu, 29 Nov 2007 06:45:34 +1300 Subject: [PATCH] Try and make the XML recovery a bit more silent, but provide a verbose option to enable it. --- bin/mythtv-status | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bin/mythtv-status b/bin/mythtv-status index 97d37f9..6d533b9 100755 --- a/bin/mythtv-status +++ b/bin/mythtv-status @@ -28,6 +28,7 @@ my @email; my $email_only_on_conflict = 0; my $help = undef; my $xml_file = undef; +my $verbose = 0; my $VERSION = '0.5.1'; @@ -49,6 +50,7 @@ GetOptions( 'file=s' => \$xml_file, + 'verbose' => \$verbose, 'help|?' => \$help, ) || pod2usage("\nUse --help for help.\n"); @@ -296,7 +298,13 @@ sub load_xml { # Parse the XML my $parser = XML::LibXML->new(); + + # Some XML data seems to have badness in it, including non-existant + # UTF-8 characters. We'll try and recover. $parser->recover(1); + $parser->recover_silently(1) + unless $verbose; + my $xml = eval { $parser->parse_string( $status ) }; if ($@) { @@ -497,6 +505,11 @@ Suppress displaying blocks of the output if they would normally be displayed. The port to use when connecting to MythTV, defaults to 6544. +=item B<--verbose> + +Have slightly more verbose output. This includes any warnings that might +be generated while parsing the XML. + =item B<-v, --version> Show the version of mythtv-status and then exit. -- 2.30.2