Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dealing with empty string in .InnerText problem
Message
General information
Forum:
ASP.NET
Category:
XML
Miscellaneous
Thread ID:
00894839
Message ID:
00894890
Views:
9
Glad it works for you

>I process the XML file on VFP side (version 6) where I have to parse the XML string to "get" the values. If I change my .NET code as you suggested, I have to figure out how to change the VFP code too.
>
>But while I was looking at your code, I realized that I can deal with my problem by setting a one-character string to the .InnerText property. Then .NET does not insert CR into the XML file and the resulting XML node looks like this:
>
>
><Fld name="REQUESTOR"> </Fld>
>
>
>There, on VFP side I can trip the value extracted from the XML file.
>
>Thank you so much for your help and for spurring my thought process <g>
>
>>Will
>>
>>oChild.IsEmpty = true;
>>
>>
>>do what you want? It will produce
>>
>><Fld name="REQUESTOR" />
>>
>>
>>>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform