diff --git a/ndn-cpp/Name.cpp b/ndn-cpp/Name.cpp
index fbb2675..fca3e05 100644
--- a/ndn-cpp/Name.cpp
+++ b/ndn-cpp/Name.cpp
@@ -99,7 +99,7 @@
   trimLeft(str);
   trimRight(str);
 }
-  
+
 /**
  * Convert the hex character to an integer from 0 to 15, or -1 if not a hex character.
  * @param c
@@ -147,6 +147,85 @@
   return result.str();
 }
 
+bool NameComponent::setFromEscapedString(const char *first, const char *last)
+{
+  string trimmedString(first, last);
+  trim(trimmedString);
+  string component = unescape(trimmedString);
+        
+  if (component.find_first_not_of(".") == string::npos) {
+    // Special case for component of only periods.  
+    if (component.size() <= 2)
+      // Zero, one or two periods is illegal.  Ignore this component.
+      return false;
+    else {
+      // Remove 3 periods.
+      value_.clear();
+      value_.insert(value_.begin(), component.begin() + 3, component.end()); 
+    }
+  }
+  else {
+    value_.clear();
+    value_.insert(value_.begin(), component.begin(), component.end()); 
+  }
+  
+  return true;
+}
+
+Name::Name(const char *uri_cstr) 
+{
+  string uri = uri_cstr;
+  trim(uri);
+  if (uri.size() == 0)
+    return;
+
+  size_t iColon = uri.find(':');
+  if (iColon != string::npos) {
+    // Make sure the colon came before a '/'.
+    size_t iFirstSlash = uri.find('/');
+    if (iFirstSlash == string::npos || iColon < iFirstSlash) {
+      // Omit the leading protocol such as ndn:
+      uri.erase(0, iColon + 1);
+      trim(uri);
+    }
+  }
+    
+  // Trim the leading slash and possibly the authority.
+  if (uri[0] == '/') {
+    if (uri.size() >= 2 && uri[1] == '/') {
+      // Strip the authority following "//".
+      size_t iAfterAuthority = uri.find('/', 2);
+      if (iAfterAuthority == string::npos)
+        // Unusual case: there was only an authority.
+        return;
+      else {
+        uri.erase(0, iAfterAuthority + 1);
+        trim(uri);
+      }
+    }
+    else {
+      uri.erase(0, 1);
+      trim(uri);
+    }
+  }
+
+  size_t iComponentStart = 0;
+  
+  // Unescape the components.
+  while (iComponentStart < uri.size()) {
+    size_t iComponentEnd = uri.find("/", iComponentStart);
+    if (iComponentEnd == string::npos)
+      iComponentEnd = uri.size();
+    
+    components_.push_back(NameComponent());
+    if (!components_[components_.size() - 1].setFromEscapedString(&uri[iComponentStart], &uri[iComponentEnd]))
+      // Ignore the illegal component.  This also gets rid of a trailing '/'.
+      components_.pop_back();
+    
+    iComponentStart = iComponentEnd + 1;
+  }
+}
+
 void Name::get(struct ndn_Name &nameStruct) 
 {
   if (nameStruct.maxComponents < components_.size())
diff --git a/ndn-cpp/Name.hpp b/ndn-cpp/Name.hpp
index 48dd706..bd89377 100644
--- a/ndn-cpp/Name.hpp
+++ b/ndn-cpp/Name.hpp
@@ -8,6 +8,7 @@
 #define	NDN_NAME_HPP
 
 #include <vector>
+#include <string>
 #include "common.h"
 #include "c/Name.h"
 #include "encoding/BinaryXMLWireFormat.hpp"
@@ -16,6 +17,10 @@
   
 class NameComponent {
 public:
+  NameComponent() 
+  {    
+  }
+  
   NameComponent(unsigned char * value, unsigned int valueLen) 
   : value_(value, value + valueLen)
   {
@@ -32,6 +37,16 @@
     componentStruct.valueLength = value_.size(); 
   }
   
+  /**
+   * Set this component value by decoding the escapedString between first and last according to the NDN URI Scheme.
+   * If the escaped string is "", "." or ".." then return false, which means this component value was not changed, and
+   * the component should be skipped in a URI name.
+   * @param first pointer to the beginning of the escaped string
+   * @param last pointer to the first character past the end of the escaped string
+   * @return true for success, false if escapedString is not a valid escaped component.
+   */
+  bool setFromEscapedString(const char *first, const char *last);
+  
   const std::vector<unsigned char> &getValue() const { return value_; }
   
 private:
@@ -40,8 +55,16 @@
   
 class Name {
 public:
+  /**
+   * Create a new Name with no components.
+   */
   Name() {
   }
+  
+  /**
+   * Parse the uri according to the NDN URI Scheme and create the name with the components.
+   * @param uri the URI string.
+   */
   Name(const char *uri);
   
   void encode(std::vector<unsigned char> &output, WireFormat &wireFormat) 
@@ -104,6 +127,8 @@
     return components_.size();
   }
   
+  const NameComponent &getComponent(unsigned int i) const { return components_[i]; }
+  
   /**
    * Encode this name as a URI.
    * @return the encoded URI.
