Last post Jun 10, 2013 05:25 AM by css-chlukito
Jun 03, 2013 02:41 PM|march11|LINK
I have some standard web services used to pass in and out data from a sql express database on a web site. The VB.net app which runs on a client PC makes comparisons against some of the text string data returned from these web services.
Some of the text strings have CRLF embedded in the text string to create multi-paragraph type text blocks for presentation to the users.
This data is also stored in an Access database on the local PC.
I have discovered that the CRs are being removed from the text string as is the standard of XML.
How can I put them back in or get XML to leave them in? Isn't there a Normilzation setting that will over ride this behavior?
All of my web services were created by the Visual Studio wizards to build the WSDL, not sure I can change that code without breaking it.
Jun 04, 2013 05:56 AM|DarrellNorton|LINK
Wrap the contents in a CDATA section, like this:
Hey look I can use reserved characters
like > < " and &
or xml tags like <joe>NeedsCoffee</joe>
Also the line breaks are here
You can use CData tags in .NET easily like this:
XDocument doc = XDocument.Parse( myXml, LoadOptions.SetLineInfo );
XElement dataNode = doc.Descendants( "Data" ).First();
dataNode.Add ( new XCData( "<h1>Hello</h1>" ));
See more here:
http://msdn.microsoft.com/en-us/library/bb384869.aspx/html (for VB)
Jun 04, 2013 09:36 AM|march11|LINK
Thanks for the reply but I am not using any html here, this is a dataadapter that has read records from an Access table and is trying to match against strings returned from a web service which populated a datatable.
When the strings from the Access table are first read and processed to the web, the CRs are stripped out. This interface is all done in code on a local PC app. The LF which is what is left when the CRs are stripped out allows the strings to display correctly
on the web site.
The issue is that when the local PC app is run again, it thinks that the web site does not have the string since the CRs are missing and so do not match. Long story why I cannot use a key ID.
not sure how your answer applies.
Jun 10, 2013 05:25 AM|css-chlukito|LINK
You can encode the strings after you read from Access table and decode when insert to datatable. For comparison, you can encode both strings then compare.