Change all C code to return ndn_Error enum instead of char * error string.
diff --git a/ndn-cpp/c/encoding/BinaryXMLDecoder.c b/ndn-cpp/c/encoding/BinaryXMLDecoder.c
index 311b30a..025e679 100644
--- a/ndn-cpp/c/encoding/BinaryXMLDecoder.c
+++ b/ndn-cpp/c/encoding/BinaryXMLDecoder.c
@@ -30,9 +30,9 @@
  * @param value
  * @param valueLength
  * @param resultOut output the parsed integer.
- * @return 0 for success, else an error string, including if an element of value is not a decimal digit.
+ * @return 0 for success, else an error code, including if an element of value is not a decimal digit.
  */
-static char *parseUnsignedDecimalInt(unsigned char *value, unsigned int valueLength, unsigned int *resultOut)
+static ndn_Error parseUnsignedDecimalInt(unsigned char *value, unsigned int valueLength, unsigned int *resultOut)
 {
   unsigned int result = 0;
   
@@ -40,7 +40,7 @@
   for (i = 0; i < valueLength; ++i) {
     unsigned char digit = value[i];
     if (!(digit >= '0' && digit <= '9'))
-      return "parseUnsignedDecimalInt: element of value is not a decimal digit";
+      return NDN_ERROR_element_of_value_is_not_a_decimal_digit;
 
     result *= 10;
     result += (unsigned int)(digit - '0');
@@ -50,20 +50,20 @@
   return 0;
 }
 
-char *ndn_BinaryXMLDecoder_decodeTypeAndValue(struct ndn_BinaryXMLDecoder *self, unsigned int *type, unsigned int *valueOut) 
+ndn_Error ndn_BinaryXMLDecoder_decodeTypeAndValue(struct ndn_BinaryXMLDecoder *self, unsigned int *type, unsigned int *valueOut) 
 {
   unsigned int value = 0;
   int gotFirstOctet = 0;
   
 	while (1) {
     if (self->offset >= self->inputLength)
-      return "ndn_BinaryXMLDecoder_decodeTypeAndVal: read past the end of the input";
+      return NDN_ERROR_read_past_the_end_of_the_input;
     
 		unsigned int octet = unsafeReadOctet(self);
 		
     if (!gotFirstOctet) {
       if (octet == 0)
-        return "ndn_BinaryXMLDecoder_decodeTypeAndVal: the first header octet may not be zero";
+        return NDN_ERROR_the_first_header_octet_may_not_be_zero;
       
       gotFirstOctet = 1;
     }
@@ -82,49 +82,49 @@
   return 0;
 }
 
-char *ndn_BinaryXMLDecoder_readElementStartDTag(struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag)
+ndn_Error ndn_BinaryXMLDecoder_readElementStartDTag(struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag)
 {
-  char *error;
+  ndn_Error error;
   unsigned int type;
   unsigned int value;
   if (error = ndn_BinaryXMLDecoder_decodeTypeAndValue(self, &type, &value))
     return error;
   
   if (type != ndn_BinaryXML_DTAG)
-    return "ndn_BinaryXMLDecoder_readElementStartDTag: header type is not a DTAG";
+    return NDN_ERROR_header_type_is_not_a_DTAG;
   
   if (value != expectedTag)
-    return "ndn_BinaryXMLDecoder_readElementStartDTag: did not get the expected DTAG";
+    return NDN_ERROR_did_not_get_the_expected_DTAG;
   
   return 0;
 }
 
-char *ndn_BinaryXMLDecoder_readElementClose(struct ndn_BinaryXMLDecoder *self)
+ndn_Error ndn_BinaryXMLDecoder_readElementClose(struct ndn_BinaryXMLDecoder *self)
 {
   if (self->offset >= self->inputLength)
-    return "ndn_BinaryXMLDecoder_readElementClose: read past the end of the input";
+    return NDN_ERROR_read_past_the_end_of_the_input;
   
   if (unsafeReadOctet(self) != ndn_BinaryXML_CLOSE)
-    return "ndn_BinaryXMLDecoder_readElementStartDTag: did not get the expected element close";
+    return NDN_ERROR_did_not_get_the_expected_element_close;
   
   return 0;
 }
 
-char *ndn_BinaryXMLDecoder_peekDTag(struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int *gotExpectedTag)
+ndn_Error ndn_BinaryXMLDecoder_peekDTag(struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int *gotExpectedTag)
 {
   // Default to 0.
   *gotExpectedTag = 0;
 
   // First check if it is an element close (which cannot be the expected tag).  
   if (self->offset >= self->inputLength)
-    return "ndn_BinaryXMLDecoder_readElementClose: read past the end of the input";
+    return NDN_ERROR_read_past_the_end_of_the_input;
   if (unsafeGetOctet(self) == 0)
     return 0;
 
   unsigned int type;
   unsigned int value;
   unsigned int saveOffset = self->offset;
-  char *error = ndn_BinaryXMLDecoder_decodeTypeAndValue(self, &type, &value);
+  ndn_Error error = ndn_BinaryXMLDecoder_decodeTypeAndValue(self, &type, &value);
   // Restore offset.
   self->offset = saveOffset;
   
@@ -137,16 +137,16 @@
   return 0;
 }
 
-char *ndn_BinaryXMLDecoder_readBinaryDTagElement
+ndn_Error ndn_BinaryXMLDecoder_readBinaryDTagElement
   (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLen)
 {
-  char *error;
+  ndn_Error error;
   if (error = ndn_BinaryXMLDecoder_readElementStartDTag(self, expectedTag))
     return error;
   
   if (allowNull) {
     if (self->offset >= self->inputLength)
-      return "ndn_BinaryXMLDecoder_readBinaryDTagElement: read past the end of the input";
+      return NDN_ERROR_read_past_the_end_of_the_input;
   
     if (unsafeGetOctet(self) == ndn_BinaryXML_CLOSE) {
       // The binary item is missing, and this is allowed, so read the element close and return a null value.
@@ -170,10 +170,10 @@
   return 0;
 }
 
-char *ndn_BinaryXMLDecoder_readUDataDTagElement
+ndn_Error ndn_BinaryXMLDecoder_readUDataDTagElement
   (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, unsigned char **value, unsigned int *valueLen)
 {
-  char *error;
+  ndn_Error error;
   if (error = ndn_BinaryXMLDecoder_readElementStartDTag(self, expectedTag))
     return error;
     
@@ -181,7 +181,7 @@
   if (error = ndn_BinaryXMLDecoder_decodeTypeAndValue(self, &itemType, valueLen))
     return error;
   if (itemType != ndn_BinaryXML_UDATA)
-    return "ndn_BinaryXMLDecoder_readUDataDTagElement: item is not UDATA";
+    return NDN_ERROR_item_is_not_UDATA;
   *value = self->input + self->offset;
   self->offset += *valueLen;
   
@@ -191,12 +191,12 @@
   return 0;
 }
 
-char *ndn_BinaryXMLDecoder_readUnsignedIntegerDTagElement
+ndn_Error ndn_BinaryXMLDecoder_readUnsignedIntegerDTagElement
   (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, unsigned int *value)
 {
   unsigned char *udataValue;
   unsigned int udataValueLength;
-  char *error;
+  ndn_Error error;
   if (error = ndn_BinaryXMLDecoder_readUDataDTagElement(self, expectedTag, &udataValue, &udataValueLength))
     return error;
   
@@ -206,11 +206,11 @@
   return 0;
 }
 
-char *ndn_BinaryXMLDecoder_readOptionalUnsignedIntegerDTagElement
+ndn_Error ndn_BinaryXMLDecoder_readOptionalUnsignedIntegerDTagElement
   (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int *value)
 {
   int gotExpectedTag;
-  char *error;
+  ndn_Error error;
   if (error = ndn_BinaryXMLDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
     return error;
     
diff --git a/ndn-cpp/c/encoding/BinaryXMLDecoder.h b/ndn-cpp/c/encoding/BinaryXMLDecoder.h
index 9c83c3b..0c1427e 100644
--- a/ndn-cpp/c/encoding/BinaryXMLDecoder.h
+++ b/ndn-cpp/c/encoding/BinaryXMLDecoder.h
@@ -6,6 +6,8 @@
 #ifndef NDN_BINARYXMLDECODER_H
 #define	NDN_BINARYXMLDECODER_H
 
+#include "../errors.h"
+
 #ifdef	__cplusplus
 extern "C" {
 #endif
@@ -28,25 +30,25 @@
  * @param self pointer to the ndn_BinaryXMLDecoder struct
  * @param type output for the header type
  * @param value output for the header value
- * @return 0 for success, else an error string for read past the end of the input or if the initial byte is zero
+ * @return 0 for success, else an error code for read past the end of the input or if the initial byte is zero
  */
-char *ndn_BinaryXMLDecoder_decodeTypeAndValue(struct ndn_BinaryXMLDecoder *self, unsigned int *type, unsigned int *value);
+ndn_Error ndn_BinaryXMLDecoder_decodeTypeAndValue(struct ndn_BinaryXMLDecoder *self, unsigned int *type, unsigned int *value);
 
 /**
  * Decode the header from self's input starting at offset, expecting the type to be DTAG and the value to be expectedTag.
  * Update offset.
  * @param self pointer to the ndn_BinaryXMLDecoder struct
  * @param expectedTag the expected value for DTAG
- * @return 0 for success, else an error string, including an error if not the expected tag
+ * @return 0 for success, else an error code, including an error if not the expected tag
  */
-char *ndn_BinaryXMLDecoder_readElementStartDTag(struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag);
+ndn_Error ndn_BinaryXMLDecoder_readElementStartDTag(struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag);
 
 /**
  * Read one byte from self's input starting at offset, expecting it to be the element close.
  * @param self pointer to the ndn_BinaryXMLDecoder struct
- * @return 0 for success, else an error string, including an error if not the element close
+ * @return 0 for success, else an error code, including an error if not the element close
  */
-char *ndn_BinaryXMLDecoder_readElementClose(struct ndn_BinaryXMLDecoder *self);
+ndn_Error ndn_BinaryXMLDecoder_readElementClose(struct ndn_BinaryXMLDecoder *self);
 
 /**
  * Decode the header from self's input starting at offset, and if it is a DTAG where the value is the expectedTag,
@@ -54,9 +56,9 @@
  * @param self pointer to the ndn_BinaryXMLDecoder struct
  * @param expectedTag the expected value for DTAG
  * @param gotExpectedTag output a 1 if got the expected tag, else 0
- * @return 0 for success, else an error string for read past the end of the input
+ * @return 0 for success, else an error code for read past the end of the input
  */
-char *ndn_BinaryXMLDecoder_peekDTag(struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int *gotExpectedTag);
+ndn_Error ndn_BinaryXMLDecoder_peekDTag(struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int *gotExpectedTag);
 
 /**
  * Decode the header from self's input starting at offset, expecting the type to be DTAG and the value to be expectedTag.
@@ -70,10 +72,10 @@
  * binary data item is absent, then return 0.
  * @param valueLen output the length of the binary data. However, if allowNull is 1 and the
  * binary data item is absent, then return 0.
- * @return 0 for success, else an error string, including an error if not the expected tag, or if allowNull is 0
+ * @return 0 for success, else an error code, including an error if not the expected tag, or if allowNull is 0
  * and the binary data is absent
  */
-char *ndn_BinaryXMLDecoder_readBinaryDTagElement
+ndn_Error ndn_BinaryXMLDecoder_readBinaryDTagElement
   (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLen);
 
 /**
@@ -84,9 +86,9 @@
  * @param expectedTag the expected value for DTAG
  * @param value output a pointer to the binary data inside self's input buffer.
  * @param valueLen output the length of the binary data.
- * @return 0 for success, else an error string, including an error if not the expected tag, or if the item is not UDATA.
+ * @return 0 for success, else an error code, including an error if not the expected tag, or if the item is not UDATA.
  */
-char *ndn_BinaryXMLDecoder_readUDataDTagElement
+ndn_Error ndn_BinaryXMLDecoder_readUDataDTagElement
   (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, unsigned char **value, unsigned int *valueLen);
 
 /**
@@ -96,10 +98,10 @@
  * @param self pointer to the ndn_BinaryXMLDecoder struct
  * @param expectedTag the expected value for DTAG
  * @param value output the unsigned integer
- * @return 0 for success, else an error string, including an error if not the expected tag, or if the item is not UDATA,
+ * @return 0 for success, else an error code, including an error if not the expected tag, or if the item is not UDATA,
  * or can't parse the integer
  */
-char *ndn_BinaryXMLDecoder_readUnsignedIntegerDTagElement
+ndn_Error ndn_BinaryXMLDecoder_readUnsignedIntegerDTagElement
   (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, unsigned int *value);
 
 /**
@@ -108,10 +110,10 @@
  * @param self pointer to the ndn_BinaryXMLDecoder struct
  * @param expectedTag the expected value for DTAG
  * @param value output the unsigned integer cast to int, or -1 if the next element doesn't have expectedTag.
- * @return 0 for success, else an error string, including an error if the item is not UDATA,
+ * @return 0 for success, else an error code, including an error if the item is not UDATA,
  * or can't parse the integer
  */
-char *ndn_BinaryXMLDecoder_readOptionalUnsignedIntegerDTagElement
+ndn_Error ndn_BinaryXMLDecoder_readOptionalUnsignedIntegerDTagElement
   (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int *value);
 
 /**
diff --git a/ndn-cpp/c/encoding/BinaryXMLEncoder.c b/ndn-cpp/c/encoding/BinaryXMLEncoder.c
index cf35741..eacd197 100644
--- a/ndn-cpp/c/encoding/BinaryXMLEncoder.c
+++ b/ndn-cpp/c/encoding/BinaryXMLEncoder.c
@@ -19,11 +19,11 @@
  * @param self pointer to the ndn_BinaryXMLEncoder struct
  * @param array the array to copy
  * @param arrayLength the length of the array
- * @return 0 for success, else an error string
+ * @return 0 for success, else an error code
  */
-static char *writeArray(struct ndn_BinaryXMLEncoder *self, unsigned char *array, unsigned int arrayLength)
+static ndn_Error writeArray(struct ndn_BinaryXMLEncoder *self, unsigned char *array, unsigned int arrayLength)
 {
-  char *error;
+  ndn_Error error;
   if (error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + arrayLength))
     return error;
   
@@ -59,14 +59,14 @@
 	return nBytes;
 }
 
-char *ndn_BinaryXMLEncoder_encodeTypeAndValue(struct ndn_BinaryXMLEncoder *self, unsigned int type, unsigned int value)
+ndn_Error ndn_BinaryXMLEncoder_encodeTypeAndValue(struct ndn_BinaryXMLEncoder *self, unsigned int type, unsigned int value)
 {
 	if (type > ndn_BinaryXML_UDATA)
-		return "ndn_BinaryXMLEncoder_encodeTypeAndValue: type is out of range";
+		return NDN_ERROR_header_type_is_out_of_range;
   
 	// Encode backwards. Calculate how many bytes we need.
 	unsigned int nEncodingBytes = getNEncodingBytes(value);
-  char *error;
+  ndn_Error error;
   if (error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + nEncodingBytes))
     return error;
 
@@ -86,16 +86,16 @@
 	}
 	if (value != 0)
     // This should not happen if getNEncodingBytes is correct.
-		return "ndn_BinaryXMLEncoder_encodeTypeAndValue: : miscalculated N encoding bytes";
+		return NDN_ERROR_encodeTypeAndValue_miscalculated_N_encoding_bytes;
 	
 	self->offset+= nEncodingBytes;
   
   return 0;
 }
 
-char *ndn_BinaryXMLEncoder_writeElementClose(struct ndn_BinaryXMLEncoder *self)
+ndn_Error ndn_BinaryXMLEncoder_writeElementClose(struct ndn_BinaryXMLEncoder *self)
 {
-  char *error;
+  ndn_Error error;
   if (error = ndn_DynamicUCharArray_ensureLength(&self->output, self->offset + 1))
     return error;
   
@@ -105,9 +105,9 @@
   return 0;
 }
 
-char *ndn_BinaryXMLEncoder_writeBlob(struct ndn_BinaryXMLEncoder *self, unsigned char *value, unsigned int valueLength)
+ndn_Error ndn_BinaryXMLEncoder_writeBlob(struct ndn_BinaryXMLEncoder *self, unsigned char *value, unsigned int valueLength)
 {
-  char *error;
+  ndn_Error error;
   if (error = ndn_BinaryXMLEncoder_encodeTypeAndValue(self, ndn_BinaryXML_BLOB, valueLength))
     return error;
   
@@ -117,9 +117,9 @@
   return 0;
 }
 
-char *ndn_BinaryXMLEncoder_writeBlobDTagElement(struct ndn_BinaryXMLEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength)
+ndn_Error ndn_BinaryXMLEncoder_writeBlobDTagElement(struct ndn_BinaryXMLEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength)
 {
-  char *error;
+  ndn_Error error;
   if (error = ndn_BinaryXMLEncoder_writeElementStartDTag(self, tag))
     return error;
   
diff --git a/ndn-cpp/c/encoding/BinaryXMLEncoder.h b/ndn-cpp/c/encoding/BinaryXMLEncoder.h
index 2805d81..eb87602 100644
--- a/ndn-cpp/c/encoding/BinaryXMLEncoder.h
+++ b/ndn-cpp/c/encoding/BinaryXMLEncoder.h
@@ -6,6 +6,7 @@
 #ifndef NDN_BINARYXMLENCODER_H
 #define	NDN_BINARYXMLENCODER_H
 
+#include "../errors.h"
 #include "../util/DynamicUCharArray.h"
 #include "BinaryXML.h"
 
@@ -42,17 +43,17 @@
  * @param self pointer to the ndn_BinaryXMLEncoder struct
  * @param type the header type
  * @param value the header value
- * @return 0 for success, else an error string
+ * @return 0 for success, else an error code
  */
-char *ndn_BinaryXMLEncoder_encodeTypeAndValue(struct ndn_BinaryXMLEncoder *self, unsigned int type, unsigned int value);
+ndn_Error ndn_BinaryXMLEncoder_encodeTypeAndValue(struct ndn_BinaryXMLEncoder *self, unsigned int type, unsigned int value);
 
 /**
  * Write an element start header using DTAG with the tag to self->output.
  * @param self pointer to the ndn_BinaryXMLEncoder struct
  * @param tag the DTAG tag
- * @return 0 for success, else an error string
+ * @return 0 for success, else an error code
  */
-static inline char *ndn_BinaryXMLEncoder_writeElementStartDTag(struct ndn_BinaryXMLEncoder *self, unsigned int tag) 
+static inline ndn_Error ndn_BinaryXMLEncoder_writeElementStartDTag(struct ndn_BinaryXMLEncoder *self, unsigned int tag) 
 {
   return ndn_BinaryXMLEncoder_encodeTypeAndValue(self, ndn_BinaryXML_DTAG, tag);
 }
@@ -60,18 +61,18 @@
 /**
  * Write an element close to self->output.
  * @param self pointer to the ndn_BinaryXMLEncoder struct
- * @return 0 for success, else an error string
+ * @return 0 for success, else an error code
  */
-char *ndn_BinaryXMLEncoder_writeElementClose(struct ndn_BinaryXMLEncoder *self);
+ndn_Error ndn_BinaryXMLEncoder_writeElementClose(struct ndn_BinaryXMLEncoder *self);
 
 /**
  * Write a BLOB header, then the bytes of the blob value to self->output.
  * @param self pointer to the ndn_BinaryXMLEncoder struct
  * @param value an array of bytes for the blob value
  * @param valueLength the length of the array
- * @return 0 for success, else an error string
+ * @return 0 for success, else an error code
  */
-char *ndn_BinaryXMLEncoder_writeBlob(struct ndn_BinaryXMLEncoder *self, unsigned char *value, unsigned int valueLength);
+ndn_Error ndn_BinaryXMLEncoder_writeBlob(struct ndn_BinaryXMLEncoder *self, unsigned char *value, unsigned int valueLength);
 
 /**
  * Write an element start header using DTAG with the tag to self->output, then the blob, then an element close.
@@ -80,9 +81,9 @@
  * @param tag the DTAG tag
  * @param value an array of bytes for the blob value
  * @param valueLength the length of the array
- * @return 0 for success, else an error string
+ * @return 0 for success, else an error code
  */
-char *ndn_BinaryXMLEncoder_writeBlobDTagElement(struct ndn_BinaryXMLEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength);
+ndn_Error ndn_BinaryXMLEncoder_writeBlobDTagElement(struct ndn_BinaryXMLEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength);
 
 #ifdef	__cplusplus
 }
diff --git a/ndn-cpp/c/encoding/BinaryXMLInterest.c b/ndn-cpp/c/encoding/BinaryXMLInterest.c
index a00d3be..1131428 100644
--- a/ndn-cpp/c/encoding/BinaryXMLInterest.c
+++ b/ndn-cpp/c/encoding/BinaryXMLInterest.c
@@ -8,9 +8,9 @@
 #include "BinaryXMLName.h"
 #include "BinaryXMLInterest.h"
 
-char *ndn_decodeBinaryXMLInterest(struct ndn_Interest *interest, struct ndn_BinaryXMLDecoder *decoder)
+ndn_Error ndn_decodeBinaryXMLInterest(struct ndn_Interest *interest, struct ndn_BinaryXMLDecoder *decoder)
 {
-  char *error;
+  ndn_Error error;
   if (error = ndn_BinaryXMLDecoder_readElementStartDTag(decoder, ndn_BinaryXML_DTag_Interest))
     return error;
     
diff --git a/ndn-cpp/c/encoding/BinaryXMLInterest.h b/ndn-cpp/c/encoding/BinaryXMLInterest.h
index 12de088..38917aa 100644
--- a/ndn-cpp/c/encoding/BinaryXMLInterest.h
+++ b/ndn-cpp/c/encoding/BinaryXMLInterest.h
@@ -6,15 +6,16 @@
 #ifndef NDN_BINARYXMLINTEREST_H
 #define	NDN_BINARYXMLINTEREST_H
 
+#include "../errors.h"
 #include "../Interest.h"
 
 #ifdef	__cplusplus
 extern "C" {
 #endif
 
-char *ndn_encodeBinaryXMLInterest(struct ndn_Interest *interest, struct ndn_BinaryXMLEncoder *encoder);
+ndn_Error ndn_encodeBinaryXMLInterest(struct ndn_Interest *interest, struct ndn_BinaryXMLEncoder *encoder);
 
-char *ndn_decodeBinaryXMLInterest(struct ndn_Interest *interest, struct ndn_BinaryXMLDecoder *decoder);
+ndn_Error ndn_decodeBinaryXMLInterest(struct ndn_Interest *interest, struct ndn_BinaryXMLDecoder *decoder);
 
 #ifdef	__cplusplus
 }
diff --git a/ndn-cpp/c/encoding/BinaryXMLName.c b/ndn-cpp/c/encoding/BinaryXMLName.c
index 9c2ea6a..bc32058 100644
--- a/ndn-cpp/c/encoding/BinaryXMLName.c
+++ b/ndn-cpp/c/encoding/BinaryXMLName.c
@@ -7,9 +7,9 @@
 #include "BinaryXMLDecoder.h"
 #include "BinaryXMLName.h"
 
-char *ndn_encodeBinaryXMLName(struct ndn_Name *name, struct ndn_BinaryXMLEncoder *encoder)
+ndn_Error ndn_encodeBinaryXMLName(struct ndn_Name *name, struct ndn_BinaryXMLEncoder *encoder)
 {
-  char *error;
+  ndn_Error error;
   if (error = ndn_BinaryXMLEncoder_writeElementStartDTag(encoder, ndn_BinaryXML_DTag_Name))
     return error;
   
@@ -26,9 +26,9 @@
   return 0;
 }
 
-char *ndn_decodeBinaryXMLName(struct ndn_Name *name, struct ndn_BinaryXMLDecoder *decoder)
+ndn_Error ndn_decodeBinaryXMLName(struct ndn_Name *name, struct ndn_BinaryXMLDecoder *decoder)
 {
-  char *error;
+  ndn_Error error;
   if (error = ndn_BinaryXMLDecoder_readElementStartDTag(decoder, ndn_BinaryXML_DTag_Name))
     return error;
     
@@ -48,7 +48,7 @@
     
     // Add the component to the name.
     if (name->nComponents >= name->maxComponents)
-      return "ndn_decodeBinaryXMLName: read a component past the maximum number of components allowed in the name";
+      return NDN_ERROR_read_a_component_past_the_maximum_number_of_components_allowed_in_the_name;
     ndn_NameComponent_init(name->components + name->nComponents, component, componentLen);
     ++name->nComponents;
   }
diff --git a/ndn-cpp/c/encoding/BinaryXMLName.h b/ndn-cpp/c/encoding/BinaryXMLName.h
index 764fc1e..6560f3e 100644
--- a/ndn-cpp/c/encoding/BinaryXMLName.h
+++ b/ndn-cpp/c/encoding/BinaryXMLName.h
@@ -6,6 +6,7 @@
 #ifndef NDN_BINARYXMLNAME_H
 #define	NDN_BINARYXMLNAME_H
 
+#include "../errors.h"
 #include "../Name.h"
 #include "BinaryXMLEncoder.h"
 
@@ -13,9 +14,9 @@
 extern "C" {
 #endif
 
-char *ndn_encodeBinaryXMLName(struct ndn_Name *name, struct ndn_BinaryXMLEncoder *encoder);
+ndn_Error ndn_encodeBinaryXMLName(struct ndn_Name *name, struct ndn_BinaryXMLEncoder *encoder);
 
-char *ndn_decodeBinaryXMLName(struct ndn_Name *name, struct ndn_BinaryXMLDecoder *decoder);
+ndn_Error ndn_decodeBinaryXMLName(struct ndn_Name *name, struct ndn_BinaryXMLDecoder *decoder);
 
 #ifdef	__cplusplus
 }
diff --git a/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.c b/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.c
index 571db24..f9d7dda 100644
--- a/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.c
+++ b/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.c
@@ -29,7 +29,7 @@
   self->state = ndn_BinaryXMLStructureDecoder_READ_HEADER_OR_CLOSE;    
 }
 
-char *ndn_BinaryXMLStructureDecoder_findElementEnd
+ndn_Error ndn_BinaryXMLStructureDecoder_findElementEnd
   (struct ndn_BinaryXMLStructureDecoder *self, unsigned char *input, unsigned int inputLength) 
 {
   if (self->gotElementEnd)
@@ -56,7 +56,7 @@
           return 0;
         }
         if (self->level < 0)
-          return "ndn_BinaryXMLStructureDecoder_findElementEnd: Unexpected close tag";
+          return NDN_ERROR_findElementEnd_unexpected_close_tag;
           
         // Get ready for the next header.
         startHeader(self);
@@ -68,7 +68,7 @@
         if (self->offset >= inputLength) {
           // We can't get all of the header bytes from this input. Save in headerBuffer.
           if (self->headerLength > sizeof(self->headerBuffer))
-            return "ndn_BinaryXMLStructureDecoder_findElementEnd: Can't store more header bytes than the size of headerBuffer";
+            return NDN_ERROR_cannot_store_more_header_bytes_than_the_size_of_headerBuffer;
           self->useHeaderBuffer = 1;
           unsigned int nNewBytes = self->headerLength - startingHeaderLength;
           ndn_memcpy(self->headerBuffer + startingHeaderLength, input + (self->offset - nNewBytes), nNewBytes);
@@ -87,7 +87,7 @@
       if (self->useHeaderBuffer) {
         // Copy the remaining bytes into headerBuffer.
         if (self->headerLength > sizeof(self->headerBuffer))
-          return "ndn_BinaryXMLStructureDecoder_findElementEnd: Can't store more header bytes than the size of headerBuffer";
+          return NDN_ERROR_cannot_store_more_header_bytes_than_the_size_of_headerBuffer;
         unsigned int nNewBytes = self->headerLength - startingHeaderLength;
         ndn_memcpy(self->headerBuffer + startingHeaderLength, input + (self->offset - nNewBytes), nNewBytes);
 
@@ -95,13 +95,13 @@
         struct ndn_BinaryXMLDecoder bufferDecoder;
         ndn_BinaryXMLDecoder_init(&bufferDecoder, self->headerBuffer, sizeof(self->headerBuffer));
         if (ndn_BinaryXMLDecoder_decodeTypeAndValue(&bufferDecoder, &type, &value))
-          return "ndn_BinaryXMLStructureDecoder_findElementEnd: Can't read header type and value";
+          return NDN_ERROR_findElementEnd_cannot_read_header_type_and_value;
       }
       else {
         // We didn't have to use the headerBuffer.
         ndn_BinaryXMLDecoder_seek(&decoder, self->offset - self->headerLength);
         if (ndn_BinaryXMLDecoder_decodeTypeAndValue(&decoder, &type, &value))
-          return "ndn_BinaryXMLStructureDecoder_findElementEnd: Can't read header type and value";
+          return NDN_ERROR_findElementEnd_cannot_read_header_type_and_value;
       }
         
       // Set the next state based on the type.
@@ -128,7 +128,7 @@
         self->state = ndn_BinaryXMLStructureDecoder_READ_BYTES;
       }
       else
-        return "ndn_BinaryXMLStructureDecoder_findElementEnd: Unrecognized header type";
+        return NDN_ERROR_findElementEnd_unrecognized_header_type;
     }  
     else if (self->state == ndn_BinaryXMLStructureDecoder_READ_BYTES) {
       unsigned int nRemainingBytes = inputLength - self->offset;
@@ -144,6 +144,6 @@
     }
     else
       // We don't expect this to happen.
-      return "ndn_BinaryXMLStructureDecoder_findElementEnd: Unrecognized state";
+      return NDN_ERROR_findElementEnd_unrecognized_state;
   }
 }
diff --git a/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.h b/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.h
index 2d91562..04ddd08 100644
--- a/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.h
+++ b/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.h
@@ -6,6 +6,8 @@
 #ifndef NDN_BINARYXMLSTRUCTUREDECODER_H
 #define	NDN_BINARYXMLSTRUCTUREDECODER_H
 
+#include "../errors.h"
+
 #ifdef	__cplusplus
 extern "C" {
 #endif
@@ -37,9 +39,9 @@
  * @param self pointer to the ndn_BinaryXMLStructureDecoder struct
  * @param input the input buffer. You have to pass in input each time because the buffer could be reallocated.
  * @param inputLength the number of bytes in input.
- * @return 0 for success, else an error string
+ * @return 0 for success, else an error code
  */
-char *ndn_BinaryXMLStructureDecoder_findElementEnd
+ndn_Error ndn_BinaryXMLStructureDecoder_findElementEnd
   (struct ndn_BinaryXMLStructureDecoder *self, unsigned char *input, unsigned int inputLength);
 
 #ifdef	__cplusplus