Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dealing with empty string in .InnerText problem
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
XML
Title:
Dealing with empty string in .InnerText problem
Miscellaneous
Thread ID:
00894839
Message ID:
00894839
Views:
54
The following is a segment of code that adds a node to an XML document:
oChild = oXml.CreateElement("Fld");
oChild.InnerText = ""; 
oAttr = oXml.CreateAttribute("name");
oAttr.Value = "REQUESTOR";
oChild.Attributes.SetNamedItem(oAttr);
oRoot.AppendChild(oChild);
Even though .InnerText is empty string, the node in XML file looks like this:
<Fld name="REQUESTOR">
</Fld>
And when I programatically extract the value from the XML file, it contains:
chr(13)Chr(10)and then bunch of chr(32)

Instead, I would expect it to be:
<Fld name="REQUESTOR"></Fld>
Why does .net insert CR and bunch of empty characters when InnerText should be empty string?

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Next
Reply
Map
View

Click here to load this message in the networking platform