I am very new to working with XML. I've been weeding my way through debugging a project that was handed to me, but have run into quite a wall.
My code:
XmlWriter xmlWriter = XmlWriter.Create("ToPost.xml");
xmlWriter.WriteStartDocument();
xmlWriter.WriteStartElement("eclRequest xmlns='" + WebConfigurationManager.AppSettings.Get("urlAddress") + "'");
.....
But the WebConfigurationManager.AppSettings.Get("urlAddress") is giving me the following Exception:
Invalid name character in 'eclRequest xmlns='''. The ' ' character, hexadecimal value 0x20, cannot be included in a name.
I was wondering what exactly this Get() statement is accessing, and what could be causing the Exception?
This is not exception of
AppSettings.Get
but ofxmlWriter.WriteStartElement
, which has signature:and hence,
localName
is just name of start XML tag, cannot contain space (' '
). But there are other overloads, you are probably interested in:where
ns
: