[open-ils-commits] r7948 - trunk/Open-ILS/src/perlmods/OpenILS

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Oct 30 22:29:31 EDT 2007


Author: dbs
Date: 2007-10-30 22:14:52 -0400 (Tue, 30 Oct 2007)
New Revision: 7948

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Event.pm
Log:
Use getAttributeNS with the XML namespace to retrieve
the xml:lang attributes from ils_events.xml.

Throw explicit error messages if things go bad.


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Event.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Event.pm	2007-10-31 01:22:18 UTC (rev 7947)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Event.pm	2007-10-31 02:14:52 UTC (rev 7948)
@@ -1,4 +1,5 @@
 package OpenILS::Event;
+# vim:noet:ts=4
 use strict; use warnings;
 use XML::LibXML;
 use OpenSRF::Utils::SettingsClient;
@@ -75,10 +76,16 @@
 	$descs = {};
 	my @desc = $doc->documentElement->findnodes('//desc');
 	for my $d (@desc) {
-		my $lang = $d->getAttribute('lang');
+		my $lang = $d->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang');
 		my $code = $d->parentNode->getAttribute('code');
-		if (!exists $descs->{$lang}) {
+		unless ($descs && $lang && exists $descs->{$lang}) {
 			$descs->{$lang} = {};
+			if (!$descs) {
+				$logger->error("No error description nodes found in $eventsxml.");
+			}
+			if (!$lang) {
+				$logger->error("No xml:lang attribute found for node in $eventsxml.");
+			}
 		}
 		$descs->{$lang}->{$code} = $d->textContent;
 	}



More information about the open-ils-commits mailing list