Added writeUData, writeUDataDTagElement and writeOptionalUDataDTagElement
diff --git a/ndn-cpp/c/encoding/binary-xml-encoder.c b/ndn-cpp/c/encoding/binary-xml-encoder.c
index 1b0a99a..e39eb28 100644
--- a/ndn-cpp/c/encoding/binary-xml-encoder.c
+++ b/ndn-cpp/c/encoding/binary-xml-encoder.c
@@ -243,6 +243,33 @@
   return NDN_ERROR_success;
 }
 
+ndn_Error ndn_BinaryXmlEncoder_writeUData(struct ndn_BinaryXmlEncoder *self, unsigned char *value, unsigned int valueLength)
+{
+  ndn_Error error;
+  if ((error = ndn_BinaryXmlEncoder_encodeTypeAndValue(self, ndn_BinaryXml_UDATA, valueLength)))
+    return error;
+  
+  if ((error = writeArray(self, value, valueLength)))
+    return error;
+  
+  return NDN_ERROR_success;
+}
+
+ndn_Error ndn_BinaryXmlEncoder_writeUDataDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength)
+{
+  ndn_Error error;
+  if ((error = ndn_BinaryXmlEncoder_writeElementStartDTag(self, tag)))
+    return error;
+  
+  if ((error = ndn_BinaryXmlEncoder_writeUData(self, value, valueLength)))
+    return error;  
+  
+  if ((error = ndn_BinaryXmlEncoder_writeElementClose(self)))
+    return error;
+  
+  return NDN_ERROR_success;
+}
+
 ndn_Error ndn_BinaryXmlEncoder_writeUnsignedDecimalInt(struct ndn_BinaryXmlEncoder *self, unsigned int value)
 {
   // First write the decimal int (to find out how many bytes it is), then shift it forward to make room for the header.
diff --git a/ndn-cpp/c/encoding/binary-xml-encoder.h b/ndn-cpp/c/encoding/binary-xml-encoder.h
index 3f22319..d414dad 100644
--- a/ndn-cpp/c/encoding/binary-xml-encoder.h
+++ b/ndn-cpp/c/encoding/binary-xml-encoder.h
@@ -100,6 +100,43 @@
 }
 
 /**
+ * Write a UDATA header, then the bytes of the UDATA value to self->output.
+ * @param self pointer to the ndn_BinaryXmlEncoder struct
+ * @param value an array of bytes for the value
+ * @param valueLength the length of the array
+ * @return 0 for success, else an error code
+ */
+ndn_Error ndn_BinaryXmlEncoder_writeUData(struct ndn_BinaryXmlEncoder *self, unsigned char *value, unsigned int valueLength);
+
+/**
+ * Write an element start header using DTAG with the tag to self->output, then the UDATA value, then an element close.
+ * (If you want to just write the UDATA value, use ndn_BinaryXmlEncoder_writeUData .)
+ * @param self pointer to the ndn_BinaryXmlEncoder struct
+ * @param tag the DTAG tag
+ * @param value an array of bytes for the value
+ * @param valueLength the length of the array
+ * @return 0 for success, else an error code
+ */
+ndn_Error ndn_BinaryXmlEncoder_writeUDataDTagElement(struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength);
+
+/**
+ * If value or valueLen is 0 then do nothing, otherwise call ndn_BinaryXmlEncoder_writeUDataDTagElement.
+ * @param self pointer to the ndn_BinaryXmlEncoder struct
+ * @param tag the DTAG tag
+ * @param value an array of bytes for the value
+ * @param valueLength the length of the array
+ * @return 0 for success, else an error code
+ */
+static inline ndn_Error ndn_BinaryXmlEncoder_writeOptionalUDataDTagElement
+  (struct ndn_BinaryXmlEncoder *self, unsigned int tag, unsigned char *value, unsigned int valueLength)
+{
+  if (value && valueLength > 0)
+    return ndn_BinaryXmlEncoder_writeUDataDTagElement(self, tag, value, valueLength);
+  else
+    return NDN_ERROR_success;
+}
+
+/**
  * Write a UDATA header, then the value as an unsigned decimal integer.
  * @param self pointer to the ndn_BinaryXmlEncoder struct
  * @param value the unsigned int