The ' ' character hexadecimal value 0x20, cannot be included in a

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am getting The ' ' character hexadecimal value 0x20, cannot be included in
a name in the following module:

public XmlRegistryKey GetSubKey(string path, bool createpath)
{
XmlElement e = Elem, parent = null;
for (int len, start = 0; start < path.Length; start += len + 1)
{
len = path.IndexOf('/', start);
if (len == -1)
len = path.Length;
len -= start;
string node = path.Substring(start, len);
parent = e;
e = e[node];
if (e == null)
if (createpath)
parent.AppendChild(e =
Elem.OwnerDocument.CreateElement(node));
else
return null;
}
return new XmlRegistryKey(e, Reg);
}


When parent.AppendChild(e = Elem.OwnerDocument.CreateElement(node)) is
executed.
 
Mike9900 said:
I am getting The ' ' character hexadecimal value 0x20, cannot be included in
a name in the following module:

Yes. An XmlElement is something that look a bit like "<something>" in
XML. If it has a space, then it won't be an element any more, because
that would make it look like "<some thing>", and the 'thing' would look
like the start of an attribute.

So, either you need to rule out spaces, or you need to devise some
escaping mechanism to substitute the spaces with some other characters.

-- Barry
 
Back
Top