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/11/03 06:29:51 UTC
cvs commit: xml-xerces/perl/t EntityResolver.t
jasons 01/11/02 21:29:51
Modified: perl/t EntityResolver.t
Log:
* t/EntityResolver.t (Repository):
Wrap methods in eval{}
Revision Changes Path
1.5 +46 -8 xml-xerces/perl/t/EntityResolver.t
Index: EntityResolver.t
===================================================================
RCS file: /home/cvs/xml-xerces/perl/t/EntityResolver.t,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- EntityResolver.t 2001/10/06 23:51:17 1.4
+++ EntityResolver.t 2001/11/03 05:29:51 1.5
@@ -49,8 +49,8 @@
sub resolve_entity {
my ($self,$pub,$sys) = @_;
-# print STDERR "Got PUBLIC: $pub\n";
-# print STDERR "Got SYSTEM: $sys\n";
+# print STDERR "Got PUBLIC: $pub\n";
+# print STDERR "Got SYSTEM: $sys\n";
$main::test = 1;
# we parse the example XML Catalog
@@ -77,7 +77,16 @@
} else {
croak("Neither PublicId or SystemId were defined");
}
- return XML::Xerces::LocalFileInputSource->new($href);
+ my $is;
+ eval {
+ $is = XML::Xerces::LocalFileInputSource->new($href);
+ };
+ if ($@) {
+ print STDERR "Resolver: ", $@->getMessage(), "\n"
+ if ref $@;
+ print STDERR "Resolver: $@\n";
+ }
+ return $is;
}
package main;
@@ -92,10 +101,25 @@
result(1);
# now lets see if the resolver gets invoked
-$DOM->parse($SYSTEM_RESOLVER_FILE_NAME);
+eval {
+ $DOM->parse($SYSTEM_RESOLVER_FILE_NAME);
+};
+if ($@) {
+ print STDERR $@->getMessage()
+ if ref $@;
+ print STDERR $@;
+}
result($test);
-my $doc = $DOM->getDocument();
+my $doc;
+eval {
+ $doc = $DOM->getDocument();
+};
+if ($@) {
+ print STDERR $@->getMessage()
+ if ref $@;
+ print STDERR $@;
+}
result(ref $doc && $doc->isa('XML::Xerces::DOM_Document'));
my $root = $doc->getDocumentElement();
@@ -106,7 +130,14 @@
$DOM->reset();
$test = 0;
-$DOM->parse($PUBLIC_RESOLVER_FILE_NAME);
+eval {
+ $DOM->parse($PUBLIC_RESOLVER_FILE_NAME);
+};
+if ($@) {
+ print STDERR $@->getMessage()
+ if ref $@;
+ print STDERR $@;
+}
result($test);
$doc = $DOM->getDocument();
@@ -119,7 +150,7 @@
);
my $document = <<'SCHEMA';
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="ISO-8859-1"?>
<personnel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation='bar.xsd'>
@@ -166,5 +197,12 @@
$DOM->setDoSchema(1);
$DOM->setDoNamespaces(1);
# $DOM->setValidationScheme($XML::Xerces::DOMParser::Val_Always);
-$DOM->parse(XML::Xerces::MemBufInputSource->new($document));
+eval {
+ $DOM->parse(XML::Xerces::MemBufInputSource->new($document));
+};
+if ($@) {
+ die $@->getMessage()
+ if ref $@;
+ die $@;
+}
result(1);
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org