Added ndn_decodeOptionalBinaryXMLPublisherPublicKeyDigest
diff --git a/ndn-cpp/c/encoding/BinaryXMLInterest.c b/ndn-cpp/c/encoding/BinaryXMLInterest.c
index c7e4177..a6e4ea8 100644
--- a/ndn-cpp/c/encoding/BinaryXMLInterest.c
+++ b/ndn-cpp/c/encoding/BinaryXMLInterest.c
@@ -203,18 +203,10 @@
       (decoder, ndn_BinaryXML_DTag_MaxSuffixComponents, &interest->maxSuffixComponents))
     return error;
   
-  int gotExpectedTag;
-  if (error = ndn_BinaryXMLDecoder_peekDTag(decoder, ndn_BinaryXML_DTag_PublisherPublicKeyDigest, &gotExpectedTag))
+  if (error = ndn_decodeOptionalBinaryXMLPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, decoder))
     return error;
-  if (gotExpectedTag) {
-    if (error = ndn_decodeBinaryXMLPublisherPublicKeyDigest(&interest->publisherPublicKeyDigest, decoder))
-      return error;
-  }
-  else {
-    interest->publisherPublicKeyDigest.publisherPublicKeyDigest = 0;
-    interest->publisherPublicKeyDigest.publisherPublicKeyDigestLength = 0;
-  }
   
+  int gotExpectedTag;
   if (error = ndn_BinaryXMLDecoder_peekDTag(decoder, ndn_BinaryXML_DTag_Exclude, &gotExpectedTag))
     return error;
   if (gotExpectedTag) {
diff --git a/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.c b/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.c
index b1ee3f8..00e3582 100644
--- a/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.c
+++ b/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.c
@@ -33,3 +33,22 @@
   
   return 0;
 }
+
+ndn_Error ndn_decodeOptionalBinaryXMLPublisherPublicKeyDigest
+  (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXMLDecoder *decoder)
+{
+  int gotExpectedTag;
+  ndn_Error error; 
+  if (error = ndn_BinaryXMLDecoder_peekDTag(decoder, ndn_BinaryXML_DTag_PublisherPublicKeyDigest, &gotExpectedTag))
+    return error;
+  if (gotExpectedTag) {
+    if (error = ndn_decodeBinaryXMLPublisherPublicKeyDigest(publisherPublicKeyDigest, decoder))
+      return error;
+  }
+  else {
+    publisherPublicKeyDigest->publisherPublicKeyDigest = 0;
+    publisherPublicKeyDigest->publisherPublicKeyDigestLength = 0;
+  }
+  
+  return 0;
+}
diff --git a/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.h b/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.h
index 430395c..178a767 100644
--- a/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.h
+++ b/ndn-cpp/c/encoding/BinaryXMLPublisherPublicKeyDigest.h
@@ -34,6 +34,16 @@
 ndn_Error ndn_decodeBinaryXMLPublisherPublicKeyDigest
   (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXMLDecoder *decoder);
 
+/**
+ * Peek the next element and if it is a Binary XML PublisherPublicKeyDigest and decode into the ndn_PublisherPublicKeyDigest struct.
+ * Otherwise, set the ndn_PublisherPublicKeyDigest struct to none.
+ * @param publisherPublicKeyDigest pointer to the ndn_PublisherPublicKeyDigest struct
+ * @param decoder pointer to the ndn_BinaryXMLDecoder struct
+ * @return 0 for success, else an error code, including if the next element is not PublisherPublicKeyDigest.
+ */
+ndn_Error ndn_decodeOptionalBinaryXMLPublisherPublicKeyDigest
+  (struct ndn_PublisherPublicKeyDigest *publisherPublicKeyDigest, struct ndn_BinaryXMLDecoder *decoder);
+
 #ifdef	__cplusplus
 }
 #endif