Is there a way to parse the XML file(with different objects) line-by-line to read and rebuild the data from the file?

  • Thread starter Thread starter E-John
  • Start date Start date
E

E-John

Guest
Dear SIR,


In general, data with identical data structure can be serialized to XML file and be de-serialized from XML file by API



XmlSerializer SerializerObj = new XmlSerializer(typeof(CustomDataType)); // Serialize

CustomDataType data = (CustomDataType)SerializerObj.Deserialize(ReadFileStream); // Deserialize

If there are objects with different kind of data structure be saved to the XML file, and there are not a rule for saving,

that means, the order, number and type be saved depends on user's edition

it could be saved for edition2

objType1-1(Class CustomDataType01)

objType1-2(Class CustomDataType01)

objType2-1(Class CustomDataType02)

objType2-2(Class CustomDataType02)

objType2-3(Class CustomDataType02)

...

or be saved of edition 2

objType1-1(Class CustomDataType01)

objType2-1(Class CustomDataType02)

objType2-2(Class CustomDataType02)

objType2-3(Class CustomDataType02)

objType1-2(Class CustomDataType01)

...



Is there a way to parse the XML file(with different objects) line-by-line to read and rebuild the data from the file?

Thanks and Best regards,

E-John

Continue reading...
 
Back
Top