Added findElementEnd
diff --git a/ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp b/ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp
index d7cc9c7..3ff2397 100644
--- a/ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp
+++ b/ndn-cpp/encoding/BinaryXMLStructureDecoder.hpp
@@ -7,6 +7,7 @@
 #ifndef BINARYXMLSTRUCTUREDECODER_HPP
 #define	BINARYXMLSTRUCTUREDECODER_HPP
 
+#include <stdexcept>
 #include "BinaryXMLStructureDecoder.h"
 
 namespace ndn {
@@ -18,11 +19,30 @@
 class BinaryXMLStructureDecoder {
 public:
   BinaryXMLStructureDecoder() {
-    ndn_BinaryXMLStructureDecoder_init(&base);
+    ndn_BinaryXMLStructureDecoder_init(&base_);
   }
   
+  /**
+   * Continue scanning input starting from getOffset() to find the element end.  
+   * If the end of the element which started at offset 0 is found, then return true and getOffset() is the length of 
+   *   the element.  Otherwise return false, which means you should read more into input and call again.
+   * @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 true if found the element end, false if need to read more. (This is the same as returning gotElementEnd().)
+   */
+  bool findElementEnd(const unsigned char *input, unsigned int inputLength) {
+    const char *error;
+    if (error = ndn_BinaryXMLStructureDecoder_findElementEnd(&base_, input, inputLength))
+      throw std::runtime_error(error);
+    return gotElementEnd();
+  }
+  
+  unsigned int getOffset() { return base_.
+          offset; }
+  bool gotElementEnd() { return base_.gotElementEnd != 0; }
+  
 private:
-  struct ndn_BinaryXMLStructureDecoder base;
+  struct ndn_BinaryXMLStructureDecoder base_;
 };
 
 }