Serializing Object Model

Discussion in 'ASP .Net' started by Dave T, Mar 24, 2008.

  1. Dave T

    Dave T Guest

    From a web service I'm serializing out an object model. Is there a way to
    only include those elements of the object model which actually contain data?
    Dave T, Mar 24, 2008
    #1
    1. Advertising

  2. Dave T

    PJ6 Guest

    "Dave T" <> wrote in message
    news:...
    > From a web service I'm serializing out an object model. Is there a way to
    > only include those elements of the object model which actually contain
    > data?


    It can be done, you will need a to write custom serializer for for that.
    I've written one before and don't remember it being too difficult.

    If you do that, though, you may have trouble deserializaing the result to
    any wsdl-generated classes you may be using on the consumer side. To get
    around that you could break down the object in question into a hierarchy of
    classes; in that case you could probably eliminate your need for a custom
    serializer to crop away empty fields altogether if you're dealing with a
    broad yet deep tree of data.

    All that being said: if your reason for doing this is size, I wouldn't
    bother; 99% of the time doing this would be poor design, and if you turn on
    (or manually implement) compression you'll find that XML data shrinks by a
    factor of 30 because of its high tokenization.

    Paul
    PJ6, Mar 24, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Natan
    Replies:
    5
    Views:
    1,587
    Natan
    Sep 27, 2004
  2. Replies:
    1
    Views:
    471
    Andreas Wollschlaeger
    Oct 6, 2006
  3. Dave T

    Serializing Object Model

    Dave T, Mar 27, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    305
    Dave T
    Mar 27, 2008
  4. Dave T

    Serializing Object Model

    Dave T, Mar 24, 2008, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    139
  5. Dave T

    Serializing Object Model

    Dave T, Mar 27, 2008, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    89
    Dave T
    Mar 27, 2008
Loading...

Share This Page