Click here to Skip to main content
15,909,645 members
Home / Discussions / C#
   

C#

 
GeneralRe: uploading xml to database Pin
kalyan_241617-Aug-07 1:13
kalyan_241617-Aug-07 1:13 
GeneralRe: uploading xml to database Pin
Rocky#17-Aug-07 1:25
Rocky#17-Aug-07 1:25 
GeneralRe: uploading xml to database Pin
kalyan_241617-Aug-07 1:29
kalyan_241617-Aug-07 1:29 
Questionxml serialization for multiple arraylists Pin
cyn817-Aug-07 0:13
cyn817-Aug-07 0:13 
AnswerRe: xml serialization for multiple arraylists Pin
Giorgi Dalakishvili17-Aug-07 0:39
mentorGiorgi Dalakishvili17-Aug-07 0:39 
GeneralRe: xml serialization for multiple arraylists Pin
cyn819-Aug-07 16:53
cyn819-Aug-07 16:53 
AnswerRe: xml serialization for multiple arraylists [modified] Pin
Hessam Jalali17-Aug-07 4:02
Hessam Jalali17-Aug-07 4:02 
GeneralRe: xml serialization for multiple arraylists [modified] Pin
cyn819-Aug-07 16:43
cyn819-Aug-07 16:43 
hi there,
With your help last time, i've manage to use binary serialization to serialize and deserialize the arraylistsSmile | :)

However, now i have abit problem with xml.serializations. Looking at the examples given, it seems that for each arraylist i need to create a class each? If it is so, which class should is labelled as "XmlRoot"? in an XML file there should have only one root and can have many elements right? Sorry if i still don't quite understand.

Besides, i try to modify the codes by replacing all the functions that uses binary formatter to xml serializer, which does not works as shown below.

XmlSerializer s = new XmlSerializer( typeof(ArrayList) );<br />
		private ArrayList alDrawingObjects = new ArrayList();<br />
		public ArrayList CoordList=new ArrayList (); <br />
		public ArrayList ShapeTypeList=new ArrayList (); <br />
		public ArrayList ColorList=new ArrayList ();<br />
		public ArrayList PolyCoord = new ArrayList();<br />
		public ArrayList SizeList = new ArrayList();

Serializing:
Stream myStream ;<br />
					myStream = File.OpenWrite(filename);<br />
					ArrayList arr = new ArrayList();<br />
					if (myStream != null)<br />
					{<br />
						<br />
						TextWriter w = new StreamWriter( filename );<br />
						s.Serialize( w, ShapeTypeList );<br />
						s.Serialize( w, ColorList );<br />
						s.Serialize( w, CoordList);<br />
						s.Serialize( w, SizeList );<br />
<br />
						for(int i=0;i<PathList.Count;i++)<br />
						{<br />
							GraphicsPathData gpd = new GraphicsPathData((GraphicsPath)PathList[i]);<br />
							Stream gpdStream = GraphicsPathData.Serialize(gpd);<br />
							arr.Add(gpdStream);<br />
					 <br />
						}<br />
						s.Serialize( w, arr);<br />
<br />
						w.Close();


Deserializing:
ArrayList newList;<br />
					TextReader r = new StreamReader(filename);<br />
					ShapeTypeList = (ArrayList) s.Deserialize(myStream);<br />
					ColorList = (ArrayList) s.Deserialize(myStream);<br />
					CoordList = (ArrayList)s.Deserialize(myStream);<br />
					SizeList = (ArrayList) s.Deserialize(myStream);<br />
					arr=(ArrayList) s.Deserialize(myStream);<br />
					for(int i=0;i<arr.Count;i++)<br />
					{<br />
						Stream newStream = new MemoryStream(((MemoryStream)arr[i]).ToArray());<br />
						GraphicsPath gpDeserialized = GraphicsPathData.GetGraphicsPath(newStream);					<br />
						PathList.Add(gpDeserialized); <br />
					}<br />
					myStream.Close();	<br />
					r.Close();


Please help to explain on which part i should change?
Thanks again.



-- modified at 2:42 Monday 20th August, 2007
GeneralRe: xml serialization for multiple arraylists Pin
cyn819-Aug-07 19:00
cyn819-Aug-07 19:00 
GeneralRe: xml serialization for multiple arraylists Pin
Hessam Jalali19-Aug-07 22:16
Hessam Jalali19-Aug-07 22:16 
GeneralRe: xml serialization for multiple arraylists Pin
cyn820-Aug-07 0:53
cyn820-Aug-07 0:53 
QuestionInput string was not in a correct format Pin
project c16-Aug-07 23:57
project c16-Aug-07 23:57 
AnswerRe: Input string was not in a correct format Pin
Giorgi Dalakishvili17-Aug-07 0:03
mentorGiorgi Dalakishvili17-Aug-07 0:03 
AnswerRe: Input string was not in a correct format Pin
Luc Pattyn17-Aug-07 1:38
sitebuilderLuc Pattyn17-Aug-07 1:38 
Questionupdating a DB using a windows form Pin
helloise16-Aug-07 23:49
helloise16-Aug-07 23:49 
AnswerRe: updating a DB using a windows form Pin
Giorgi Dalakishvili16-Aug-07 23:55
mentorGiorgi Dalakishvili16-Aug-07 23:55 
AnswerRe: updating a DB using a windows form Pin
Rocky#17-Aug-07 1:20
Rocky#17-Aug-07 1:20 
GeneralRe: updating a DB using a windows form Pin
helloise17-Aug-07 1:40
helloise17-Aug-07 1:40 
GeneralRe: updating a DB using a windows form Pin
Rocky#17-Aug-07 1:47
Rocky#17-Aug-07 1:47 
AnswerRe: updating a DB using a windows form Pin
Talal Sultan17-Aug-07 1:33
Talal Sultan17-Aug-07 1:33 
GeneralRe: updating a DB using a windows form Pin
helloise17-Aug-07 4:45
helloise17-Aug-07 4:45 
QuestionHow to export datagridview columns to MS Word using c# Pin
Exelioindia16-Aug-07 23:22
Exelioindia16-Aug-07 23:22 
AnswerRe: How to export datagridview columns to MS Word using c# Pin
Giorgi Dalakishvili16-Aug-07 23:30
mentorGiorgi Dalakishvili16-Aug-07 23:30 
GeneralRe: How to export datagridview columns to MS Word using c# Pin
Exelioindia16-Aug-07 23:41
Exelioindia16-Aug-07 23:41 
GeneralRe: How to export datagridview columns to MS Word using c# Pin
Giorgi Dalakishvili16-Aug-07 23:51
mentorGiorgi Dalakishvili16-Aug-07 23:51 

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.