?
Solved

XML escape character (&) in writing web services.

Posted on 2008-06-12
1
Medium Priority
?
1,657 Views
Last Modified: 2008-06-13
Suppose I'm writing a web service:

string TestService()
{
...
}

Currently, a client calling the service will get the result string as (If saving the result string as result.xml and opened in XML browser):
Company & Country

instead of Company & Country.

Do I need to write a line at the end of the service something like this:
RegEx.Replace("&", "&");

What is the best way to deal with the 5 XML escape characters in designing my web services so that my service can be consumed without problems for the web services clients with different platforms?
Thanks!
0
Comment
Question by:heyday2004
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 18

Accepted Solution

by:
philipjonathan earned 2000 total points
ID: 21776312
Check out System.Web.HttpUtility class. There are many useful functions there. It should be HtmlEncode() that you are looking for.
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question