Added appendTo.
diff --git a/ndn-cpp/encoding/BinaryXMLWireFormat.cpp b/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
index a103106..e56673b 100644
--- a/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
+++ b/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
@@ -25,8 +25,8 @@
 
   BinaryXMLEncoder encoder;
   ndn_encodeBinaryXMLName(&nameStruct, encoder.getEncoder());
-          
-  output.insert(output.end(), encoder.getEncoder()->output.array, encoder.getEncoder()->output.array + encoder.getEncoder()->offset);
+     
+  encoder.appendTo(output);
 }
 
 void BinaryXMLWireFormat::decodeName(Name &name, const unsigned char *input, unsigned int inputLength)