Click here to Skip to main content
15,886,362 members
Home / Discussions / C#
   

C#

 
GeneralRe: CSV file formate Pin
Christian Graus8-Oct-09 10:41
protectorChristian Graus8-Oct-09 10:41 
GeneralRe: CSV file formate Pin
PIEBALDconsult8-Oct-09 10:44
mvePIEBALDconsult8-Oct-09 10:44 
GeneralRe: CSV file formate Pin
Christian Graus8-Oct-09 10:53
protectorChristian Graus8-Oct-09 10:53 
GeneralRe: CSV file formate Pin
DarrellRobertParker8-Oct-09 11:34
DarrellRobertParker8-Oct-09 11:34 
GeneralRe: CSV file formate Pin
Luc Pattyn8-Oct-09 11:11
sitebuilderLuc Pattyn8-Oct-09 11:11 
GeneralRe: CSV file formate Pin
Christian Graus8-Oct-09 11:16
protectorChristian Graus8-Oct-09 11:16 
GeneralRe: CSV file formate Pin
Anthony Mushrow8-Oct-09 13:43
professionalAnthony Mushrow8-Oct-09 13:43 
QuestionProblem serializing object to XML Pin
AndyASPVB8-Oct-09 8:50
AndyASPVB8-Oct-09 8:50 
Hi
I have problem returning an XML document in my c# code. The code I am using is as follows:

string xmlString = null;
MemoryStream memoryStream = new MemoryStream();
XmlSerializer xs = new XmlSerializer(typeof(T));
XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
xs.Serialize(xmlTextWriter, obj);
memoryStream = (MemoryStream)xmlTextWriter.BaseStream;
xmlString = UTF8ByteArrayToString(memoryStream.ToArray());
return xmlString;

private static string UTF8ByteArrayToString(byte[] characters)
{
UTF8Encoding encoding = new UTF8Encoding();
string constructedString = encoding.GetString(characters);
return (constructedString);
}

The problem I have is when the xml string is returned, the namespace and declaration at the start of the xml string is not in a well formed xml document.

What it is doing is inserting / in front of the equal sign in the name space, thus:



Therefore, I am looking for advice on how to stop this happening.

Can anyone help?

Thanks
AnswerRe: Problem serializing object to XML Pin
Henry Minute8-Oct-09 11:36
Henry Minute8-Oct-09 11:36 
QuestionHelp with Constants Pin
yogi_bear_798-Oct-09 8:07
yogi_bear_798-Oct-09 8:07 
AnswerRe: Help with Constants Pin
Ennis Ray Lynch, Jr.8-Oct-09 8:09
Ennis Ray Lynch, Jr.8-Oct-09 8:09 
GeneralRe: Help with Constants Pin
yogi_bear_798-Oct-09 8:28
yogi_bear_798-Oct-09 8:28 
AnswerRe: Help with Constants Pin
Richard MacCutchan8-Oct-09 8:37
mveRichard MacCutchan8-Oct-09 8:37 
GeneralRe: Help with Constants Pin
yogi_bear_798-Oct-09 8:55
yogi_bear_798-Oct-09 8:55 
GeneralRe: Help with Constants Pin
Richard MacCutchan8-Oct-09 22:02
mveRichard MacCutchan8-Oct-09 22:02 
AnswerRe: Help with Constants Pin
harold aptroot8-Oct-09 8:41
harold aptroot8-Oct-09 8:41 
GeneralRe: Help with Constants Pin
yogi_bear_798-Oct-09 9:03
yogi_bear_798-Oct-09 9:03 
GeneralRe: Help with Constants Pin
yogi_bear_798-Oct-09 10:09
yogi_bear_798-Oct-09 10:09 
GeneralRe: Help with Constants Pin
harold aptroot8-Oct-09 10:58
harold aptroot8-Oct-09 10:58 
GeneralRe: Help with Constants Pin
yogi_bear_798-Oct-09 12:31
yogi_bear_798-Oct-09 12:31 
GeneralRe: Help with Constants Pin
harold aptroot8-Oct-09 12:34
harold aptroot8-Oct-09 12:34 
AnswerRe: Help with Constants Pin
Md. Marufuzzaman8-Oct-09 9:26
professionalMd. Marufuzzaman8-Oct-09 9:26 
AnswerRe: Help with Constants Pin
Luc Pattyn8-Oct-09 9:29
sitebuilderLuc Pattyn8-Oct-09 9:29 
GeneralRe: Help with Constants Pin
yogi_bear_798-Oct-09 9:42
yogi_bear_798-Oct-09 9:42 
GeneralRe: Help with Constants Pin
yogi_bear_798-Oct-09 9:55
yogi_bear_798-Oct-09 9:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.