Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. XML Serialization & Deserialization

XML Serialization & Deserialization

Scheduled Pinned Locked Moved XML / XSL
questionxmljsontutoriallearning
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mike123543
    wrote on last edited by
    #1

    Hi all I am looking at XML Serialization at the moment, most of it is pretty straight forward [so far]. I am after creating my own employee class that I am configuring for XML serialization, 1. declaring it as a Public class, 2. making all necessary variables Public and 3. adding a Parameterless constructor. When I was looking into BinaryFormatter and SoapFormatter, to handle Deserialization I had to implement the interface IDeserializationCallback and then create a method that implements IDeserializationCallback.OnDeserialization to populate any temporary variables. How do I do this with XML Serialization? The example I've seen in the book for MCTS exam 70-536 shows that you take your employee class and add the serializable attribute to it and implement IDeserializationCallback. You then use the attribute NonSerialized to mark a type that is not to be serialized. Michael.

    H 1 Reply Last reply
    0
    • M mike123543

      Hi all I am looking at XML Serialization at the moment, most of it is pretty straight forward [so far]. I am after creating my own employee class that I am configuring for XML serialization, 1. declaring it as a Public class, 2. making all necessary variables Public and 3. adding a Parameterless constructor. When I was looking into BinaryFormatter and SoapFormatter, to handle Deserialization I had to implement the interface IDeserializationCallback and then create a method that implements IDeserializationCallback.OnDeserialization to populate any temporary variables. How do I do this with XML Serialization? The example I've seen in the book for MCTS exam 70-536 shows that you take your employee class and add the serializable attribute to it and implement IDeserializationCallback. You then use the attribute NonSerialized to mark a type that is not to be serialized. Michael.

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      mike123543 wrote:

      The example I've seen in the book for MCTS exam 70-536 shows that you take your employee class and add the serializable attribute to it and implement IDeserializationCallback. You then use the attribute NonSerialized to mark a type that is not to be serialized

      And have you tried that?

      Henry Minute If you open a can of worms, any viable solution *MUST* involve a larger can.

      M 1 Reply Last reply
      0
      • H Henry Minute

        mike123543 wrote:

        The example I've seen in the book for MCTS exam 70-536 shows that you take your employee class and add the serializable attribute to it and implement IDeserializationCallback. You then use the attribute NonSerialized to mark a type that is not to be serialized

        And have you tried that?

        Henry Minute If you open a can of worms, any viable solution *MUST* involve a larger can.

        M Offline
        M Offline
        mike123543
        wrote on last edited by
        #3

        IDeserializationCallback does not seem to be available to me when using XML serialization. It would appear to be only available to SoapFormatter, BinaryFormatter or when completing Custom Serialization. This issue would only arise if I needed to customise the xml serialization, I can always rely on the standard Custom Serialization. Michael.

        H 1 Reply Last reply
        0
        • M mike123543

          IDeserializationCallback does not seem to be available to me when using XML serialization. It would appear to be only available to SoapFormatter, BinaryFormatter or when completing Custom Serialization. This issue would only arise if I needed to customise the xml serialization, I can always rely on the standard Custom Serialization. Michael.

          H Offline
          H Offline
          Henry Minute
          wrote on last edited by
          #4

          mike123543 wrote:

          This issue would only arise if I needed to customise the xml serialization

          This is true. Try this book, Chapter 7 to start[^] It is really thorough.

          Henry Minute If you open a can of worms, any viable solution *MUST* involve a larger can.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups