diff Lib/IMPL/DOM/XMLReader.pm @ 368:010ceafd0c5a

form metadata + tests
author cin
date Wed, 04 Dec 2013 17:31:53 +0400
parents 4ddb27ff4a0b
children 4edd36025051
line wrap: on
line diff
--- a/Lib/IMPL/DOM/XMLReader.pm	Tue Dec 03 17:55:36 2013 +0400
+++ b/Lib/IMPL/DOM/XMLReader.pm	Wed Dec 04 17:31:53 2013 +0400
@@ -91,12 +91,18 @@
     
     $parser->ParseFile($file);
     my $doc = $parser->Navigator->Document;
+    my @errors;
     if ($schema) {
-        my @errors = $parser->Navigator->BuildErrors;
+        @errors = $parser->Navigator->BuildErrors;
         push @errors, $schema->Validate($doc);
-        die new IMPL::Exception("Loaded document doesn't match the schema", @errors) if @errors;
     }
-    return $doc;
+    
+    if (wantarray) {
+    	return $doc,\@errors;
+    } else {
+    	die new IMPL::Exception("Loaded document doesn't match the schema", @errors) if @errors;
+    	return $doc;
+    } 
 }
 
 1;