diff --git a/ndn-cpp/c/encoding/BinaryXMLDecoder.c b/ndn-cpp/c/encoding/BinaryXMLDecoder.c
index 23dd67d..a44af26 100644
--- a/ndn-cpp/c/encoding/BinaryXMLDecoder.c
+++ b/ndn-cpp/c/encoding/BinaryXMLDecoder.c
@@ -11,7 +11,7 @@
  * Return the octet at self->offset, converting to unsigned int.  Increment self->offset.
  * This does not check for reading past the end of the input, so this is called "unsafe".
  */
-static inline unsigned int unsafeReadOctet(struct ndn_BinaryXMLDecoder *self) 
+static inline unsigned int unsafeReadOctet(struct ndn_BinaryXmlDecoder *self) 
 {
   return (unsigned int)(self->input[self->offset++] & 0xff);  
 }
@@ -20,7 +20,7 @@
  * Return the octet at self->offset, converting to unsigned int.  Do not increment self->offset.
  * This does not check for reading past the end of the input, so this is called "unsafe".
  */
-static inline unsigned int unsafeGetOctet(struct ndn_BinaryXMLDecoder *self) 
+static inline unsigned int unsafeGetOctet(struct ndn_BinaryXmlDecoder *self) 
 {
   return (unsigned int)(self->input[self->offset] & 0xff);  
 }
@@ -51,7 +51,7 @@
   return 0;
 }
 
-ndn_Error 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;
@@ -69,29 +69,29 @@
       gotFirstOctet = 1;
     }
     
-		if (octet & ndn_BinaryXML_TT_FINAL) {
+		if (octet & ndn_BinaryXml_TT_FINAL) {
       // Finished.
-			*type = octet & ndn_BinaryXML_TT_MASK;
-			value = (value << ndn_BinaryXML_TT_VALUE_BITS) | ((octet >> ndn_BinaryXML_TT_BITS) & ndn_BinaryXML_TT_VALUE_MASK);
+			*type = octet & ndn_BinaryXml_TT_MASK;
+			value = (value << ndn_BinaryXml_TT_VALUE_BITS) | ((octet >> ndn_BinaryXml_TT_BITS) & ndn_BinaryXml_TT_VALUE_MASK);
       break;
 		}
 		
-    value = (value << ndn_BinaryXML_REGULAR_VALUE_BITS) | (octet & ndn_BinaryXML_REGULAR_VALUE_MASK);		
+    value = (value << ndn_BinaryXml_REGULAR_VALUE_BITS) | (octet & ndn_BinaryXml_REGULAR_VALUE_MASK);		
 	}
 
 	*valueOut = value;
   return 0;
 }
 
-ndn_Error ndn_BinaryXMLDecoder_readElementStartDTag(struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag)
+ndn_Error ndn_BinaryXmlDecoder_readElementStartDTag(struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag)
 {
   ndn_Error error;
   unsigned int type;
   unsigned int value;
-  if (error = ndn_BinaryXMLDecoder_decodeTypeAndValue(self, &type, &value))
+  if (error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &type, &value))
     return error;
   
-  if (type != ndn_BinaryXML_DTAG)
+  if (type != ndn_BinaryXml_DTAG)
     return NDN_ERROR_header_type_is_not_a_DTAG;
   
   if (value != expectedTag)
@@ -100,18 +100,18 @@
   return 0;
 }
 
-ndn_Error ndn_BinaryXMLDecoder_readElementClose(struct ndn_BinaryXMLDecoder *self)
+ndn_Error ndn_BinaryXmlDecoder_readElementClose(struct ndn_BinaryXmlDecoder *self)
 {
   if (self->offset >= self->inputLength)
     return NDN_ERROR_read_past_the_end_of_the_input;
   
-  if (unsafeReadOctet(self) != ndn_BinaryXML_CLOSE)
+  if (unsafeReadOctet(self) != ndn_BinaryXml_CLOSE)
     return NDN_ERROR_did_not_get_the_expected_element_close;
   
   return 0;
 }
 
-ndn_Error 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;
@@ -125,31 +125,31 @@
   unsigned int type;
   unsigned int value;
   unsigned int saveOffset = self->offset;
-  ndn_Error error = ndn_BinaryXMLDecoder_decodeTypeAndValue(self, &type, &value);
+  ndn_Error error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &type, &value);
   // Restore offset.
   self->offset = saveOffset;
   
   if (error)
     return error;
   
-  if (type == ndn_BinaryXML_DTAG && value == expectedTag)
+  if (type == ndn_BinaryXml_DTAG && value == expectedTag)
     *gotExpectedTag = 1;
   
   return 0;
 }
 
-ndn_Error ndn_BinaryXMLDecoder_readBinaryDTagElement
-  (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLength)
+ndn_Error ndn_BinaryXmlDecoder_readBinaryDTagElement
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLength)
 {
   ndn_Error error;
-  if (error = ndn_BinaryXMLDecoder_readElementStartDTag(self, expectedTag))
+  if (error = ndn_BinaryXmlDecoder_readElementStartDTag(self, expectedTag))
     return error;
   
   if (allowNull) {
     if (self->offset >= self->inputLength)
       return NDN_ERROR_read_past_the_end_of_the_input;
   
-    if (unsafeGetOctet(self) == ndn_BinaryXML_CLOSE) {
+    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.
       ++self->offset;
       *value = 0;
@@ -159,27 +159,27 @@
   }
   
   unsigned int itemType;
-  if (error = ndn_BinaryXMLDecoder_decodeTypeAndValue(self, &itemType, valueLength))
+  if (error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &itemType, valueLength))
     return error;
   // Ignore itemType.
   *value = self->input + self->offset;
   self->offset += *valueLength;
   
-  if (error = ndn_BinaryXMLDecoder_readElementClose(self))
+  if (error = ndn_BinaryXmlDecoder_readElementClose(self))
     return error;
   
   return 0;
 }
 
-ndn_Error ndn_BinaryXMLDecoder_readOptionalBinaryDTagElement
-  (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLength)
+ndn_Error ndn_BinaryXmlDecoder_readOptionalBinaryDTagElement
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int allowNull, unsigned char **value, unsigned int *valueLength)
 {
   ndn_Error error;
   int gotExpectedTag;
-  if (error = ndn_BinaryXMLDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
+  if (error = ndn_BinaryXmlDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
     return error;
   if (gotExpectedTag) {
-    if (error = ndn_BinaryXMLDecoder_readBinaryDTagElement(self, expectedTag, allowNull, value, valueLength))
+    if (error = ndn_BinaryXmlDecoder_readBinaryDTagElement(self, expectedTag, allowNull, value, valueLength))
       return error;
   }
   else {
@@ -190,34 +190,34 @@
   return 0;
 }
 
-ndn_Error ndn_BinaryXMLDecoder_readUDataDTagElement
-  (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, unsigned char **value, unsigned int *valueLength)
+ndn_Error ndn_BinaryXmlDecoder_readUDataDTagElement
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, unsigned char **value, unsigned int *valueLength)
 {
   ndn_Error error;
-  if (error = ndn_BinaryXMLDecoder_readElementStartDTag(self, expectedTag))
+  if (error = ndn_BinaryXmlDecoder_readElementStartDTag(self, expectedTag))
     return error;
     
   unsigned int itemType;
-  if (error = ndn_BinaryXMLDecoder_decodeTypeAndValue(self, &itemType, valueLength))
+  if (error = ndn_BinaryXmlDecoder_decodeTypeAndValue(self, &itemType, valueLength))
     return error;
-  if (itemType != ndn_BinaryXML_UDATA)
+  if (itemType != ndn_BinaryXml_UDATA)
     return NDN_ERROR_item_is_not_UDATA;
   *value = self->input + self->offset;
   self->offset += *valueLength;
   
-  if (error = ndn_BinaryXMLDecoder_readElementClose(self))
+  if (error = ndn_BinaryXmlDecoder_readElementClose(self))
     return error;
   
   return 0;
 }
 
-ndn_Error ndn_BinaryXMLDecoder_readUnsignedIntegerDTagElement
-  (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, unsigned int *value)
+ndn_Error ndn_BinaryXmlDecoder_readUnsignedIntegerDTagElement
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, unsigned int *value)
 {
   unsigned char *udataValue;
   unsigned int udataValueLength;
   ndn_Error error;
-  if (error = ndn_BinaryXMLDecoder_readUDataDTagElement(self, expectedTag, &udataValue, &udataValueLength))
+  if (error = ndn_BinaryXmlDecoder_readUDataDTagElement(self, expectedTag, &udataValue, &udataValueLength))
     return error;
   
   if (error = parseUnsignedDecimalInt(udataValue, udataValueLength, value))
@@ -226,12 +226,12 @@
   return 0;
 }
 
-ndn_Error ndn_BinaryXMLDecoder_readOptionalUnsignedIntegerDTagElement
-  (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, int *value)
+ndn_Error ndn_BinaryXmlDecoder_readOptionalUnsignedIntegerDTagElement
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, int *value)
 {
   int gotExpectedTag;
   ndn_Error error;
-  if (error = ndn_BinaryXMLDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
+  if (error = ndn_BinaryXmlDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
     return error;
     
   if (!gotExpectedTag) {
@@ -240,32 +240,32 @@
   }
 
   unsigned int unsignedValue;
-  if (error = ndn_BinaryXMLDecoder_readUnsignedIntegerDTagElement(self, expectedTag, &unsignedValue))
+  if (error = ndn_BinaryXmlDecoder_readUnsignedIntegerDTagElement(self, expectedTag, &unsignedValue))
     return error;
   
   *value = (int)unsignedValue;
   return 0;
 }
 
-ndn_Error ndn_BinaryXMLDecoder_readTimeMillisecondsDTagElement
-  (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, double *milliseconds)
+ndn_Error ndn_BinaryXmlDecoder_readTimeMillisecondsDTagElement
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, double *milliseconds)
 {
   ndn_Error error;
   unsigned char *bytes;
   unsigned int bytesLength;
-  if (error = ndn_BinaryXMLDecoder_readBinaryDTagElement(self, expectedTag, 0, &bytes, &bytesLength))
+  if (error = ndn_BinaryXmlDecoder_readBinaryDTagElement(self, expectedTag, 0, &bytes, &bytesLength))
     return error;
     
-  *milliseconds = 1000.0 * ndn_BinaryXMLDecoder_unsignedBigEndianToDouble(bytes, bytesLength) / 4096.0;
+  *milliseconds = 1000.0 * ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(bytes, bytesLength) / 4096.0;
   return 0;  
 }
 
-ndn_Error ndn_BinaryXMLDecoder_readOptionalTimeMillisecondsDTagElement
-  (struct ndn_BinaryXMLDecoder *self, unsigned int expectedTag, double *milliseconds)
+ndn_Error ndn_BinaryXmlDecoder_readOptionalTimeMillisecondsDTagElement
+  (struct ndn_BinaryXmlDecoder *self, unsigned int expectedTag, double *milliseconds)
 {
   int gotExpectedTag;
   ndn_Error error;
-  if (error = ndn_BinaryXMLDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
+  if (error = ndn_BinaryXmlDecoder_peekDTag(self, expectedTag, &gotExpectedTag))
     return error;
     
   if (!gotExpectedTag) {
@@ -273,13 +273,13 @@
     return 0;
   }
 
-  if (error = ndn_BinaryXMLDecoder_readTimeMillisecondsDTagElement(self, expectedTag, milliseconds))
+  if (error = ndn_BinaryXmlDecoder_readTimeMillisecondsDTagElement(self, expectedTag, milliseconds))
     return error;
   
   return 0;
 }
 
-double ndn_BinaryXMLDecoder_unsignedBigEndianToDouble(unsigned char *bytes, unsigned int bytesLength) 
+double ndn_BinaryXmlDecoder_unsignedBigEndianToDouble(unsigned char *bytes, unsigned int bytesLength) 
 {
   double result = 0.0;
   unsigned int i;
