473,385 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

XML encoding using C#

I've a string which needs to be converted to valid XML string. The original
string might have characters such as "%", "!", "+", etc.
Is there any function available in C# that could do this?
Thanks,
Gilgamesh
Mar 31 '06 #1
4 1707
Research the XmlTextWriter class.

<%= Clinton Gallagher

"Gilgamesh" <gi************@aol.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
I've a string which needs to be converted to valid XML string. The
original string might have characters such as "%", "!", "+", etc.
Is there any function available in C# that could do this?
Thanks,
Gilgamesh

Mar 31 '06 #2
This is good, but how do I keep this XML document in memory? This class
requires an output file and, in my case, I can't have any output file. The
XML stream is to be passed to another class using parameters.
_G

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:ew**************@TK2MSFTNGP14.phx.gbl...
Research the XmlTextWriter class.

<%= Clinton Gallagher

"Gilgamesh" <gi************@aol.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
I've a string which needs to be converted to valid XML string. The
original string might have characters such as "%", "!", "+", etc.
Is there any function available in C# that could do this?
Thanks,
Gilgamesh


Mar 31 '06 #3
Your first RFI didn't ask for help designing your application. Since there's
several ways to answer your latest question perhaps asking at
news://microsoft.public.dotnet.xml will attract the attention of somebody
who knows an optimal solution.

<%= Clinton Gallagher

"Gilgamesh" <gi************@aol.com> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
This is good, but how do I keep this XML document in memory? This class
requires an output file and, in my case, I can't have any output file. The
XML stream is to be passed to another class using parameters.
_G

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:ew**************@TK2MSFTNGP14.phx.gbl...
Research the XmlTextWriter class.

<%= Clinton Gallagher

"Gilgamesh" <gi************@aol.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
I've a string which needs to be converted to valid XML string. The
original string might have characters such as "%", "!", "+", etc.
Is there any function available in C# that could do this?
Thanks,
Gilgamesh



Mar 31 '06 #4

you can use the XMLTextWriter to write to a memorystream

hth,
Alan.

Mar 31 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: CMan | last post by:
Hi, I am reading a text file using a StreamReader in C# but the reader is unable to handle some of the characheters. Using the default encoding the program cannot handle accented characters. I...
10
by: Christopher H. Laco | last post by:
Long story longer. I need to get web user input into a backend system that a) only grocks single byte encoding, b) expectes the data transer to be 1 bytes = 1 character, and c) uses the HP Roman-6...
4
by: H Lee | last post by:
Hi, I'm an XML newbie, and not sure if this is the appropriate newsgroup to post my question, so feel free to suggest other newgroups where I should post this message if this is the case. I'm...
8
by: Demon News | last post by:
I'm trying to do a transform (Using XmlTransform class in c#) and in the Transform I'm specifying the the output xsl below: <xsl:output method="xml" encoding="UTF-8" indent="no"/> the...
2
by: lprisr | last post by:
Hi, I have double byte characters in the content that I am returning using Web Services. However, the encoding in the xml file returned by Web Services is utf-8 and I am unable to read the...
4
by: Bob | last post by:
Hi Need to produce a Doc with no encoding info. Is there anyway of doing this? Thanks Bob i.e. <?xml version=\"1.0\" ?>
19
by: Thomas W | last post by:
I'm getting really annoyed with python in regards to unicode/ascii-encoding problems. The string below is the encoding of the norwegian word "fødselsdag". I stored the string as "fødselsdag"...
0
by: Janusz Nykiel | last post by:
I've stumbled upon unexpected behavior of the .NET 2.0 System.Xml.XmlWriter class when using it to write data to a binary stream (System.IO.Stream). If the amount of data is less than a certain...
1
by: ujjwaltrivedi | last post by:
Hey guys, Can anyone tell me how to create a text file with Unicode Encoding. In am using FileStream Finalfile = new FileStream("finalfile.txt", FileMode.Append, FileAccess.Write); ...
14
by: Zoro | last post by:
My task is to read html files from disk and save them onto SQL Server database field. I have created an nvarchar(max) field to hold them. The problem is that some characters, particularly html...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.