David Graf has proposed merging lp:~davidagraf/zorba/trace_without_debug_info 
into lp:zorba.

Requested reviews:
  Chris Hillery (ceejatec)

For more details, see:
https://code.launchpad.net/~davidagraf/zorba/trace_without_debug_info/+merge/110377
-- 
https://code.launchpad.net/~davidagraf/zorba/trace_without_debug_info/+merge/110377
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/errors_and_diagnostics/errors_and_diagnostics_impl.cpp'
--- src/runtime/errors_and_diagnostics/errors_and_diagnostics_impl.cpp	2012-05-03 12:31:51 +0000
+++ src/runtime/errors_and_diagnostics/errors_and_diagnostics_impl.cpp	2012-06-14 17:55:23 +0000
@@ -16,6 +16,7 @@
 #include "stdafx.h"
 
 #include <iostream>
+#include <zorba/singleton_item_sequence.h>
 
 #include "diagnostics/xquery_diagnostics.h"
 #include "diagnostics/user_exception.h"
@@ -31,6 +32,10 @@
 #include "system/globalenv.h"
 #include "zorbatypes/zstring.h"
 
+#include "api/serialization/serializer.h"
+#include "api/serializerimpl.h"
+#include "api/unmarshaller.h"
+
 namespace zorba 
 {
 
@@ -102,9 +107,42 @@
   while (consumeNext(result, theChildren[0], planState)) 
   {
     (*state->theOS) << state->theTagItem->getStringValue() 
-      << " [" << state->theIndex << "]: "
-      << result->show()
-      << std::endl;
+      << " [" << state->theIndex << "]: ";
+
+    if (result->getNodeKind() == store::StoreConsts::attributeNode)
+    {
+      store::Item* qnameItem = result->getNodeName();
+      const zstring& prefix = qnameItem->getPrefix();
+      const zstring& local = qnameItem->getLocalName();
+
+      if (prefix.empty())
+        (*state->theOS) << " " << local << "=\"";
+      else
+        (*state->theOS) << " " << prefix << ":" << local << "=\"";
+
+      zstring value;
+      result->getStringValue2(value);
+      (*state->theOS) << value;
+
+      (*state->theOS) << "\"";
+    }
+    else
+    {
+      serializer ser(NULL);
+      Zorba_SerializerOptions options;
+      options.omit_xml_declaration = ZORBA_OMIT_XML_DECLARATION_YES;
+      SerializerImpl::setSerializationParameters(ser, options);
+      const Item lItem(result);
+      SingletonItemSequence lSequence(lItem);
+      Iterator_t seq_iter = lSequence.getIterator();
+      seq_iter->open();
+      ser.serialize(
+          Unmarshaller::getInternalIterator(seq_iter.get()), 
+          (*state->theOS));
+      seq_iter->close(); 
+    }
+
+    (*state->theOS) << std::endl;
     ++state->theIndex;
 
     STACK_PUSH(true, state);

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to