PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
New line and Tabs in XML files?
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
New line and Tabs in XML files?
![]() |
New line and Tabs in XML files? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi, I have a strange problem - when writing to a file from a Full framework
application I get the normal XML format but when I write to a file in a Compact Framework application using the exact same code I get one single unwrapped linin XML.?? I'm using XML serialization like this: TestObject test = new TestObject(); XmlSerializer ser = new XmlSerializer(test.GetType()); StreamWriter file = new StreamWriter(@"C:\test.xml"); ser.Serialize(file, test); file.Flush(); file.Close(); What can I do correct that problem? Thanks Ole |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Try this:
System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(test.GetType()); System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\test.xml"); System.Xml.XmlTextWriter xtr = new System.Xml.XmlTextWriter(file); xtr.Formatting = System.Xml.Formatting.Indented; ser.Serialize(xtr, test); file.Flush(); file.Close(); HTH Ciaran O'Donnell "Ole" wrote: > Hi, I have a strange problem - when writing to a file from a Full framework > application I get the normal XML format but when I write to a file in a > Compact Framework application using the exact same code I get one single > unwrapped linin XML.?? I'm using XML serialization like this: > > TestObject test = new TestObject(); > XmlSerializer ser = new XmlSerializer(test.GetType()); > > StreamWriter file = new StreamWriter(@"C:\test.xml"); > ser.Serialize(file, test); > file.Flush(); > file.Close(); > > What can I do correct that problem? > > Thanks > Ole > > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Thanks Ciaran!
"Ciaran O''Donnell" <CiaranODonnell@discussions.microsoft.com> wrote in message news:ECFBF4E4-4ECF-4717-9740-920F69FED89A@microsoft.com... > Try this: > > > System.Xml.Serialization.XmlSerializer ser = new > System.Xml.Serialization.XmlSerializer(test.GetType()); > > System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\test.xml"); > System.Xml.XmlTextWriter xtr = new System.Xml.XmlTextWriter(file); > xtr.Formatting = System.Xml.Formatting.Indented; > ser.Serialize(xtr, test); > file.Flush(); > file.Close(); > > HTH > > Ciaran O'Donnell > > > "Ole" wrote: > >> Hi, I have a strange problem - when writing to a file from a Full >> framework >> application I get the normal XML format but when I write to a file in a >> Compact Framework application using the exact same code I get one single >> unwrapped linin XML.?? I'm using XML serialization like this: >> >> TestObject test = new TestObject(); >> XmlSerializer ser = new XmlSerializer(test.GetType()); >> >> StreamWriter file = new StreamWriter(@"C:\test.xml"); >> ser.Serialize(file, test); >> file.Flush(); >> file.Close(); >> >> What can I do correct that problem? >> >> Thanks >> Ole >> >> >> |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

