diff --git a/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.c b/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.c
index f9d7dda..dbd4ac5 100644
--- a/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.c
+++ b/ndn-cpp/c/encoding/BinaryXMLStructureDecoder.c
@@ -8,12 +8,12 @@
 #include "BinaryXMLDecoder.h"
 #include "BinaryXMLStructureDecoder.h"
 
-void ndn_BinaryXMLStructureDecoder_init(struct ndn_BinaryXMLStructureDecoder *self) 
+void ndn_BinaryXmlStructureDecoder_init(struct ndn_BinaryXmlStructureDecoder *self) 
 {
   self->gotElementEnd = 0;
   self->offset = 0;
   self->level = 0;
-  self->state = ndn_BinaryXMLStructureDecoder_READ_HEADER_OR_CLOSE;
+  self->state = ndn_BinaryXmlStructureDecoder_READ_HEADER_OR_CLOSE;
   self->headerLength = 0;
   self->useHeaderBuffer = 0;
   self->nBytesToRead = 0;
@@ -22,31 +22,31 @@
 /**
  * Set the state to READ_HEADER_OR_CLOSE and set up to start reading the header.
  */
-static inline void startHeader(struct ndn_BinaryXMLStructureDecoder *self)
+static inline void startHeader(struct ndn_BinaryXmlStructureDecoder *self)
 {
   self->headerLength = 0;
   self->useHeaderBuffer = 0;
-  self->state = ndn_BinaryXMLStructureDecoder_READ_HEADER_OR_CLOSE;    
+  self->state = ndn_BinaryXmlStructureDecoder_READ_HEADER_OR_CLOSE;    
 }
 
-ndn_Error ndn_BinaryXMLStructureDecoder_findElementEnd
-  (struct ndn_BinaryXMLStructureDecoder *self, unsigned char *input, unsigned int inputLength) 
+ndn_Error ndn_BinaryXmlStructureDecoder_findElementEnd
+  (struct ndn_BinaryXmlStructureDecoder *self, unsigned char *input, unsigned int inputLength) 
 {
   if (self->gotElementEnd)
     // Someone is calling when we already got the end.
     return 0;
   
-  struct ndn_BinaryXMLDecoder decoder;
-  ndn_BinaryXMLDecoder_init(&decoder, input, inputLength);
+  struct ndn_BinaryXmlDecoder decoder;
+  ndn_BinaryXmlDecoder_init(&decoder, input, inputLength);
   
   while (1) {
     if (self->offset >= inputLength)
       // All the cases assume we have some input. Return and wait for more.
       return 0;
     
-    if (self->state == ndn_BinaryXMLStructureDecoder_READ_HEADER_OR_CLOSE) {
+    if (self->state == ndn_BinaryXmlStructureDecoder_READ_HEADER_OR_CLOSE) {
       // First check for CLOSE.
-      if (self->headerLength == 0 && input[self->offset] == ndn_BinaryXML_CLOSE) {
+      if (self->headerLength == 0 && input[self->offset] == ndn_BinaryXml_CLOSE) {
         ++self->offset;
         // Close the level.
         --self->level;
@@ -77,7 +77,7 @@
         }
         unsigned int headerByte = (unsigned int)input[self->offset++];
         ++self->headerLength;
-        if (headerByte & ndn_BinaryXML_TT_FINAL)
+        if (headerByte & ndn_BinaryXml_TT_FINAL)
           // Break and read the header.
           break;
       }
@@ -92,45 +92,45 @@
         ndn_memcpy(self->headerBuffer + startingHeaderLength, input + (self->offset - nNewBytes), nNewBytes);
 
         // Use a local decoder just for the headerBuffer.
-        struct ndn_BinaryXMLDecoder bufferDecoder;
-        ndn_BinaryXMLDecoder_init(&bufferDecoder, self->headerBuffer, sizeof(self->headerBuffer));
-        if (ndn_BinaryXMLDecoder_decodeTypeAndValue(&bufferDecoder, &type, &value))
+        struct ndn_BinaryXmlDecoder bufferDecoder;
+        ndn_BinaryXmlDecoder_init(&bufferDecoder, self->headerBuffer, sizeof(self->headerBuffer));
+        if (ndn_BinaryXmlDecoder_decodeTypeAndValue(&bufferDecoder, &type, &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))
+        ndn_BinaryXmlDecoder_seek(&decoder, self->offset - self->headerLength);
+        if (ndn_BinaryXmlDecoder_decodeTypeAndValue(&decoder, &type, &value))
           return NDN_ERROR_findElementEnd_cannot_read_header_type_and_value;
       }
         
       // Set the next state based on the type.
-      if (type == ndn_BinaryXML_DATTR)
+      if (type == ndn_BinaryXml_DATTR)
         // We already consumed the item. READ_HEADER_OR_CLOSE again.
         // Binary XML has rules about what must follow an attribute, but we are just scanning.
         startHeader(self);
-      else if (type == ndn_BinaryXML_DTAG || type == ndn_BinaryXML_EXT) {
+      else if (type == ndn_BinaryXml_DTAG || type == ndn_BinaryXml_EXT) {
         // Start a new level and READ_HEADER_OR_CLOSE again.
         ++self->level;
         startHeader(self);
       }
-      else if (type == ndn_BinaryXML_TAG || type == ndn_BinaryXML_ATTR) {
-        if (type == ndn_BinaryXML_TAG)
+      else if (type == ndn_BinaryXml_TAG || type == ndn_BinaryXml_ATTR) {
+        if (type == ndn_BinaryXml_TAG)
           // Start a new level and read the tag.
           ++self->level;
         // Minimum tag or attribute length is 1.
         self->nBytesToRead = value + 1;
-        self->state = ndn_BinaryXMLStructureDecoder_READ_BYTES;
+        self->state = ndn_BinaryXmlStructureDecoder_READ_BYTES;
         // Binary XML has rules about what must follow an attribute, but we are just scanning.
       }
-      else if (type == ndn_BinaryXML_BLOB || type == ndn_BinaryXML_UDATA) {
+      else if (type == ndn_BinaryXml_BLOB || type == ndn_BinaryXml_UDATA) {
         self->nBytesToRead = value;
-        self->state = ndn_BinaryXMLStructureDecoder_READ_BYTES;
+        self->state = ndn_BinaryXmlStructureDecoder_READ_BYTES;
       }
       else
         return NDN_ERROR_findElementEnd_unrecognized_header_type;
     }  
-    else if (self->state == ndn_BinaryXMLStructureDecoder_READ_BYTES) {
+    else if (self->state == ndn_BinaryXmlStructureDecoder_READ_BYTES) {
       unsigned int nRemainingBytes = inputLength - self->offset;
       if (nRemainingBytes < self->nBytesToRead) {
         // Need more.
