← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-978254 into lp:zorba

 

Ghislain Fourny has proposed merging lp:~zorba-coders/zorba/bug-978254 into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-978254/+merge/103700

Fixed bug 978254 (QName comparison in item sequence chainer ignored namespaces and took prefixes into account).
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-978254/+merge/103700
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/api/item_sequence_chainer.h'
--- src/api/item_sequence_chainer.h	2012-04-24 12:39:38 +0000
+++ src/api/item_sequence_chainer.h	2012-04-26 14:12:26 +0000
@@ -17,13 +17,15 @@
 #ifndef ZORBA_ITERATOR_ITEM_SEQUENCE_CHAINER_H
 #define ZORBA_ITERATOR_ITEM_SEQUENCE_CHAINER_H
 
+#include <vector>
+#include <set>
+#include <assert.h>
+
 #include <zorba/config.h>
 #include <zorba/item_sequence.h>
 #include <zorba/iterator.h>
 #include <zorba/item.h>
 #include <zorba/zorba_string.h>
-#include <vector>
-#include <set>
 
 namespace zorba { 
 
@@ -85,7 +87,18 @@
           struct Comparator {
             bool operator()(const Item& i1, const Item& i2) const
             {
-              return i1.getStringValue().compare(i2.getStringValue()) < 0;
+              assert(i1.getType().getLocalName() == "QName");
+              assert(i2.getType().getLocalName() == "QName");
+	      if (i1.getNamespace().compare(i2.getNamespace()) < 0)
+		{
+		  return true;
+		}
+	      if (i1.getNamespace().compare(i2.getNamespace()) > 0)
+		{
+		  return false;
+		} 
+	      // Namespaces are equal, comparing local names.
+              return (i1.getLocalName().compare(i2.getLocalName()) < 0);
             }
           };
 


Follow ups