You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2001/04/12 07:08:43 UTC

cvs commit: xml-xerces/perl/samples DOMPrint.pl

jasons      01/04/11 22:08:43

  Modified:    perl/samples DOMPrint.pl
  Log:
  	* samples/DOMPrint.pl (Repository):
  	Set defaults for validate and namespace
  	Needed to set an error handler
  
  Revision  Changes    Path
  1.5       +10 -3     xml-xerces/perl/samples/DOMPrint.pl
  
  Index: DOMPrint.pl
  ===================================================================
  RCS file: /home/cvs/xml-xerces/perl/samples/DOMPrint.pl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DOMPrint.pl	2001/03/22 23:46:17	1.4
  +++ DOMPrint.pl	2001/04/12 05:08:43	1.5
  @@ -67,10 +67,11 @@
   ######################################################################
   
   use strict;
  -
  +# use blib;
   use XML::Xerces;
   use XML::Xerces::DOMParse;
   use Getopt::Std;
  +use vars qw($opt_v $opt_n);
   
   #
   # Read and validate command line args
  @@ -81,8 +82,8 @@
   getopts ('vn') and ($#ARGV == 0)	or die "$USAGE";
   -f $ARGV[0] or die "File '$ARGV[0]' does not exist!\n";
   
  -my $validate = $::opt_v;
  -my $namespace = $::opt_n;
  +my $validate = $opt_v || 0;
  +my $namespace = $opt_n || 0;
   my $file = $ARGV[0];
   
   
  @@ -94,6 +95,12 @@
   my $parser = XML::Xerces::DOMParser->new();
   $parser->setDoNamespaces ($namespace);
   $parser->setDoValidation ($validate);
  +$parser->setToCreateXMLDeclTypeNode(1);
  +my $ERROR_HANDLER = XML::Xerces::perlErrorHandler->new();
  +$ERROR_HANDLER->setWarningFunction(\&XML::Xerces::warning);
  +$ERROR_HANDLER->setErrorFunction(\&XML::Xerces::error);
  +$ERROR_HANDLER->setFatalErrorFunction(\&XML::Xerces::fatal_error);
  +$parser->setErrorHandler($ERROR_HANDLER);
   $parser->parse (XML::Xerces::LocalFileInputSource->new($file));
   my $doc = $parser->getDocument ();
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org