Click here to Skip to main content
15,898,134 members
Home / Discussions / C#
   

C#

 
AnswerRe: Two questions on COM Add-in for Outlook 2003 Pin
OctopusThu6-Nov-06 19:53
OctopusThu6-Nov-06 19:53 
Question.NET remoting with DCOM Pin
Andy UK6-Nov-06 6:31
Andy UK6-Nov-06 6:31 
QuestionXML: Deserialize but don't Serialize Pin
Clive Pottinger6-Nov-06 5:58
Clive Pottinger6-Nov-06 5:58 
AnswerRe: XML: Deserialize but don't Serialize Pin
led mike6-Nov-06 9:21
led mike6-Nov-06 9:21 
AnswerRe: XML: Deserialize but don't Serialize Pin
beatles16927-Nov-06 0:28
beatles16927-Nov-06 0:28 
GeneralRe: XML: Deserialize but don't Serialize Pin
Clive Pottinger8-Nov-06 14:52
Clive Pottinger8-Nov-06 14:52 
GeneralRe: XML: Deserialize but don't Serialize Pin
Clive Pottinger8-Nov-06 16:54
Clive Pottinger8-Nov-06 16:54 
QuestionXML Deserialization question Pin
Clive Pottinger6-Nov-06 5:49
Clive Pottinger6-Nov-06 5:49 
Hello everyone,

My questions is in regards to finding information for an ancestor item while deserialising an XML document. The following is similar to the problem I am facing:
<teacher name="Johnson">
<class name="Hydrodynamics 101">
<student name="Billy"/>
</course>
</teacher>

I have classes for objects Teacher, Class and Student.

When a Teacher is deserialised, all the Class objects are created and passed to Teacher.AddClasses where each class is added to a private ArrayList Teacher.ClassList. Additionally, the Class.TeacherName is set. So far so good.

But during the creation of the Class objects, C# needs to create the Student objects. So the Student objects are deserialised BEFORE the Class objects are passed to Teacher.AddClasses. We are getting there...

When a Student object is created, I wish to add the student to the ArrayList Teacher.StudentList. That is a problem. Because the Class has not yet been added to the Teacher and had the Class.TeacherName value set, the Student object is unable to find out which Teacher it should be added to. We can't even search the Teacher objects looking for one that has that Class in Teacher.ClassList, because the Class has not been added there yet either.

Does anyone know a way around this? Is there a way, during deserialisation, to find out the Student["billy"] belongs to Teacher["Johnson"]?

Note: This is not exactly the situation I am facing: it is just a simplified example. So, though it may seem easier to rearrange the XML into a better order, that is not going to be an option for me. I need to deserialise object C inside B inside A and add C to a value in A while doing so.

Many thanks in advance.

Clive Pottinger,
Hamilton ON
AnswerRe: XML Deserialization question Pin
S. Senthil Kumar6-Nov-06 6:41
S. Senthil Kumar6-Nov-06 6:41 
GeneralRe: XML Deserialization question [modified] Pin
Clive Pottinger6-Nov-06 7:25
Clive Pottinger6-Nov-06 7:25 
AnswerRe: XML Deserialization question Pin
Clive Pottinger6-Nov-06 7:52
Clive Pottinger6-Nov-06 7:52 
GeneralRe: XML Deserialization question Pin
S. Senthil Kumar7-Nov-06 5:30
S. Senthil Kumar7-Nov-06 5:30 
AnswerRe: XML Deserialization question Pin
Clive Pottinger8-Nov-06 15:10
Clive Pottinger8-Nov-06 15:10 
QuestionNearest neighbour algorithm Pin
Islam Khalil Saber6-Nov-06 4:35
Islam Khalil Saber6-Nov-06 4:35 
AnswerRe: Nearest neighbour algorithm Pin
J4amieC6-Nov-06 4:42
J4amieC6-Nov-06 4:42 
AnswerCross posting Pin
leckey6-Nov-06 6:41
leckey6-Nov-06 6:41 
Questiondatagridview help needed Pin
giddy_guitarist6-Nov-06 4:34
giddy_guitarist6-Nov-06 4:34 
AnswerRe: datagridview help needed Pin
Rey99997-Nov-06 6:36
Rey99997-Nov-06 6:36 
GeneralRe: datagridview help needed Pin
giddy_guitarist7-Nov-06 21:59
giddy_guitarist7-Nov-06 21:59 
QuestionTesting the presence of a reference Pin
Maercu6-Nov-06 4:23
Maercu6-Nov-06 4:23 
AnswerRe: Testing the presence of a reference Pin
led mike6-Nov-06 5:08
led mike6-Nov-06 5:08 
AnswerRe: Testing the presence of a reference Pin
liRetro6-Nov-06 5:51
liRetro6-Nov-06 5:51 
AnswerRe: Testing the presence of a reference Pin
Maercu6-Nov-06 21:46
Maercu6-Nov-06 21:46 
QuestionWhich class I should use in communication? Pin
mertkan656-Nov-06 4:11
mertkan656-Nov-06 4:11 
QuestionWeird problem... [modified] Pin
Support1236-Nov-06 3:52
Support1236-Nov-06 3:52 

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.