Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dealing with empty string in .InnerText problem
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
XML
Titre:
Dealing with empty string in .InnerText problem
Divers
Thread ID:
00894839
Message ID:
00894839
Vues:
53
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform