[open-ils-commits] r17288 - trunk/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Aug 20 13:18:32 EDT 2010
Author: phasefx
Date: 2010-08-20 13:18:28 -0400 (Fri, 20 Aug 2010)
New Revision: 17288
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent/ContentCafe.pm
Log:
eliminate false positives for ContentCafe features for a given bib
Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent/ContentCafe.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent/ContentCafe.pm 2010-08-20 15:41:43 UTC (rev 17287)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent/ContentCafe.pm 2010-08-20 17:18:28 UTC (rev 17288)
@@ -61,7 +61,9 @@
my $doc = XML::LibXML->new->parse_string($xml);
$doc->documentElement->setNamespace('http://ContentCafe2.btol.com', 'cc');
my $html = '';
- foreach my $node ( $doc->findnodes('//cc:Toc') ) {
+ my @nodes = $doc->findnodes('//cc:Toc');
+ return 0 if (scalar(@nodes) < 1);
+ foreach my $node ( @nodes ) {
$html .= $node->textContent . '</P></P>';
}
return $self->send_html($html);
@@ -87,7 +89,9 @@
my $doc = XML::LibXML->new->parse_string($xml);
$doc->documentElement->setNamespace('http://ContentCafe2.btol.com', 'cc');
my $html = '';
- foreach my $node ( $doc->findnodes('//cc:Biography') ) {
+ my @nodes = $doc->findnodes('//cc:Biography');
+ return 0 if (scalar(@nodes) < 1);
+ foreach my $node ( @nodes ) {
$html .= '<P class="biography">' . $node->textContent . '</P>';
}
return $self->send_html($html);
@@ -114,7 +118,9 @@
my $doc = XML::LibXML->new->parse_string($xml);
$doc->documentElement->setNamespace('http://ContentCafe2.btol.com', 'cc');
my $html = '';
- foreach my $node ( $doc->findnodes('//cc:Excerpt') ) {
+ my @nodes = $doc->findnodes('//cc:Excerpt');
+ return 0 if (scalar(@nodes) < 1);
+ foreach my $node ( @nodes ) {
$html .= $node->textContent;
}
return $self->send_html($html);
@@ -140,7 +146,9 @@
my $doc = XML::LibXML->new->parse_string($xml);
$doc->documentElement->setNamespace('http://ContentCafe2.btol.com', 'cc');
my $html = '<ul>';
- foreach my $node ( $doc->findnodes('//cc:ReviewItem') ) {
+ my @nodes = $doc->findnodes('//cc:ReviewItem');
+ return 0 if (scalar(@nodes) < 1);
+ foreach my $node ( @nodes ) {
my @s_nodes = $node->findnodes('./cc:Supplier');
my @p_nodes = $node->findnodes('./cc:Publication');
my @i_nodes = $node->findnodes('./cc:Issue');
@@ -174,7 +182,9 @@
my $doc = XML::LibXML->new->parse_string($xml);
$doc->documentElement->setNamespace('http://ContentCafe2.btol.com', 'cc');
my $html = '<ul>';
- foreach my $node ( $doc->findnodes('//cc:AnnotationItem') ) {
+ my @nodes = $doc->findnodes('//cc:AnnotationItem');
+ return 0 if (scalar(@nodes) < 1);
+ foreach my $node ( @nodes ) {
my @s_nodes = $node->findnodes('./cc:Supplier');
my @a_nodes = $node->findnodes('./cc:Annotation');
$html .= '<li><b>' . (scalar(@s_nodes) ? $s_nodes[0]->textContent : '') . '</b><br/>';
More information about the open-ils-commits
mailing list