Menu

#9 Allow injection of XmlAttributeOverrides into XmlSerializer

open
None
5
2005-02-09
2004-12-31
No

Sometimes it is desireable to modify the xml
serialization process with XmlAttributeOverrides, for
example, if the base class contains undesireable
attributes. This could be made with an interface:

interface IXmlAttributeOverrides
{
XmlAttributeOverrides GetOverrides();
}

One could implement this interface in his
serializable class, and then return the modifications
which get injected into the constructor of the
XmlSerializer:

View\XmlSerializingView.cs:48
XmlSerializer ser = new XmlSerializer
(model.GetType(), xmlOverrides.GetOverrides());

Regards, Alexander Gräf

Discussion

  • Alexander Graef

    Alexander Graef - 2005-01-26

    Logged In: YES
    user_id=1030440

    I implemented it the following way (see attached file)

     
  • Alexander Graef

    Alexander Graef - 2005-01-26

    XmlSerializingView.cs modified source

     
  • Cort Schaefer

    Cort Schaefer - 2005-02-09
    • assigned_to: nobody --> corts
     

Log in to post a comment.