Added readOptionalBinaryDTagElement
diff --git a/ndn-cpp/c/encoding/BinaryXMLInterest.c b/ndn-cpp/c/encoding/BinaryXMLInterest.c
index a6e4ea8..6b02176 100644
--- a/ndn-cpp/c/encoding/BinaryXMLInterest.c
+++ b/ndn-cpp/c/encoding/BinaryXMLInterest.c
@@ -241,17 +241,9 @@
else
interest->interestLifetime = -1;
- if (error = ndn_BinaryXMLDecoder_peekDTag(decoder, ndn_BinaryXML_DTag_Nonce, &gotExpectedTag))
+ if (error = ndn_BinaryXMLDecoder_readOptionalBinaryDTagElement
+ (decoder, ndn_BinaryXML_DTag_Nonce, 0, &interest->nonce, &interest->nonceLength))
return error;
- if (gotExpectedTag) {
- if (error = ndn_BinaryXMLDecoder_readBinaryDTagElement
- (decoder, ndn_BinaryXML_DTag_Nonce, 0, &interest->nonce, &interest->nonceLength))
- return error;
- }
- else {
- interest->nonce = 0;
- interest->nonceLength = 0;
- }
if (error = ndn_BinaryXMLDecoder_readElementClose(decoder))
return error;