public NodeId Construct()
{
StringBuilder buffer = new StringBuilder();
// add the root type.
buffer.Append(RootType);
buffer.Append(':');
// add the root identifier.
if (this.RootId != null)
{
for (int ii = 0; ii < this.RootId.Length; ii++)
{
char ch = this.RootId[ii];
// escape any special characters.
if (ch == '&' || ch == '?')
{
buffer.Append('&');
}
buffer.Append(ch);
}
}
// add the component path.
if (!String.IsNullOrEmpty(this.ComponentPath))
{
buffer.Append('?');
buffer.Append(this.ComponentPath);
}
// construct the node id with the namespace index provided.
return new NodeId(buffer.ToString(), this.NamespaceIndex);
}