Added BinaryXMLElementReader
diff --git a/ndn-cpp/c/encoding/BinaryXMLElementReader.c b/ndn-cpp/c/encoding/BinaryXMLElementReader.c
new file mode 100644
index 0000000..9561026
--- /dev/null
+++ b/ndn-cpp/c/encoding/BinaryXMLElementReader.c
@@ -0,0 +1,48 @@
+/**
+ * @author: Jeff Thompson
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "BinaryXMLElementReader.h"
+
+ndn_Error ndn_BinaryXMLElementReader_onReceivedData
+  (struct ndn_BinaryXMLElementReader *self, unsigned char *data, unsigned int dataLength)
+{
+  // Process multiple objects in the data.
+  while(1) {
+    // Scan the input to check if a whole binary XML object has been read.
+    ndn_BinaryXMLStructureDecoder_seek(&self->structureDecoder, 0);
+    
+    ndn_Error error;
+    if (error = ndn_BinaryXMLStructureDecoder_findElementEnd(&self->structureDecoder, data, dataLength))
+      return error;
+    if (self->structureDecoder.gotElementEnd) {
+      // Got the remainder of an element.  Report to the caller.
+#if 0 // TODO: implement saving data parts.
+      this.dataParts.push(data.subarray(0, this.structureDecoder.offset));
+      var element = DataUtils.concatArrays(this.dataParts);
+      this.dataParts = [];
+#endif
+      (*self->elementListener->onReceivedElement)(self->elementListener, data, self->structureDecoder.offset);
+        
+      // Need to read a new object.
+      data += self->structureDecoder.offset;
+      dataLength -= self->structureDecoder.offset;
+      ndn_BinaryXMLStructureDecoder_init(&self->structureDecoder);
+      if (dataLength == 0)
+        // No more data in the packet.
+        return 0;
+            
+      // else loop back to decode.
+    }
+    else {
+#if 0 // TODO: implement saving data parts.
+      // Save for a later call to concatArrays so that we only copy data once.
+      this.dataParts.push(data);
+#else
+      return -1; // TODO: implement saving data parts.
+#endif
+      return 0;
+    }
+  }      
+}
\ No newline at end of file
diff --git a/ndn-cpp/c/encoding/BinaryXMLElementReader.h b/ndn-cpp/c/encoding/BinaryXMLElementReader.h
new file mode 100644
index 0000000..09aeb03
--- /dev/null
+++ b/ndn-cpp/c/encoding/BinaryXMLElementReader.h
@@ -0,0 +1,73 @@
+/**
+ * @author: Jeff Thompson
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_BINARYXMLELEMENTREADER_H
+#define	NDN_BINARYXMLELEMENTREADER_H
+
+#include "../errors.h"
+#include "BinaryXMLStructureDecoder.h"
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/** An ndn_ElementListener struct holds a function pointer onReceivedElement.  You can extend this struct with data that
+ * will be passed to onReceivedElement.
+ */
+struct ndn_ElementListener {
+  void (*onReceivedElement)(struct ndn_ElementListener *self, unsigned char *element, unsigned int elementLength); /**< see ndn_ElementListener_init */
+};
+
+/**
+ * Initialize an ndn_ElementListener struct to use the onReceivedElement function pointer.
+ * @param self pointer to the ndn_ElementListener struct
+ * @param onReceivedElement pointer to a function which is called when an entire binary XML element is received.
+ * self is the pointer to this ndn_ElementListener struct.  See ndn_BinaryXMLElementReader_onReceivedData.
+ */
+static inline void ndn_ElementListener_init
+  (struct ndn_ElementListener *self, void (*onReceivedElement)(struct ndn_ElementListener *self, unsigned char *element, unsigned int elementLength))
+{
+  self->onReceivedElement = onReceivedElement;
+}
+  
+/**
+ * A BinaryXmlElementReader lets you call ndn_BinaryXMLElementReader_onReceivedData multiple times which uses an
+ * ndn_BinaryXMLStructureDecoder to detect the end of a binary XML element and calls
+ * (*elementListener->onReceivedElement)(element, elementLength) with the element. 
+ * This handles the case where a single call to onReceivedData may contain multiple elements.
+ */
+struct ndn_BinaryXMLElementReader {
+  struct ndn_ElementListener *elementListener;
+  struct ndn_BinaryXMLStructureDecoder structureDecoder;
+};
+
+/**
+ * Initialize an ndn_BinaryXMLElementReader struct with the elementListener.
+ * @param self pointer to the ndn_BinaryXMLElementReader struct
+ * @param elementListener pointer to the ndn_ElementListener used by ndn_BinaryXMLElementReader_onReceivedData.
+ */
+static inline void ndn_BinaryXMLElementReader_init
+  (struct ndn_BinaryXMLElementReader *self, struct ndn_ElementListener *elementListener)
+{
+  self->elementListener = elementListener;
+  ndn_BinaryXMLStructureDecoder_init(&self->structureDecoder);
+}
+
+/**
+ * Continue to read binary XML data until the end of an element, then call (*elementListener->onReceivedElement)(element, elementLength).
+ * The buffer passed to onReceivedElement is only valid during this call.  If you need the data later, you must copy.
+ * @param self pointer to the ndn_BinaryXMLElementReader struct
+ * @param data pointer to the buffer with the binary XML bytes
+ * @param dataLength length of data
+ * @return 0 for success, else an error code
+ */
+ndn_Error ndn_BinaryXMLElementReader_onReceivedData
+  (struct ndn_BinaryXMLElementReader *self, unsigned char *data, unsigned int dataLength);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif