getOutput should return a const reference.
diff --git a/ndn-cpp/encoding/binary-xml-encoder.hpp b/ndn-cpp/encoding/binary-xml-encoder.hpp
index 9e52613..6c560b1 100644
--- a/ndn-cpp/encoding/binary-xml-encoder.hpp
+++ b/ndn-cpp/encoding/binary-xml-encoder.hpp
@@ -30,7 +30,7 @@
   /**
    * Return the output as a shared_ptr.
    */
-  ptr_lib::shared_ptr<std::vector<unsigned char> > getOutput() 
+  const ptr_lib::shared_ptr<std::vector<unsigned char> > &getOutput() 
   {
     return output_.get();
   }