xml serilazation

Discussion in 'ASP .Net' started by =?Utf-8?B?Ym9iYnk=?=, Sep 28, 2007.

  1. am trying to inherits membership class and implementing IXmlSerializable but
    it doesn't work.


    public class SSOMembershipUser : System.Web.Security.MembershipUser
    ,IXmlSerializable

    'SSO.Security.SSOMembershipUser' does not implement interface member
    'System.Xml.Serialization.IXmlSerializable.GetSchema()'
    =?Utf-8?B?Ym9iYnk=?=, Sep 28, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?Ym9iYnk=?=

    bruce barker Guest

    you class says it will implement IXmlSerializable, so have to implement
    the methods.

    public XmlSchema GetSchema()
    {
    return null;
    }

    public void ReadXml(XmlReader reader)
    {
    // write code to read xml and fill in your object
    }

    public void WriteXml(XmlWriter writer)
    {
    // write code to save your object as xml
    }


    if you object follows all the rules (all public properties are
    serializable) and only public get/set properties need saving, then
    instead of implementing IXmlSerializable, you can use the [Serializable]
    attribute on your class:

    [Serializable]
    public class SSOMembershipUser
    {
    }

    this is just a flag the the default xmlserialier can serialize the
    object. it will throw a runtime error if it finds a property it can not
    serialize.


    -- bruce (sqlwork.com)


    bobby wrote:
    > am trying to inherits membership class and implementing IXmlSerializable but
    > it doesn't work.
    >
    >
    > public class SSOMembershipUser : System.Web.Security.MembershipUser
    > ,IXmlSerializable
    >
    > 'SSO.Security.SSOMembershipUser' does not implement interface member
    > 'System.Xml.Serialization.IXmlSerializable.GetSchema()'
    >
    >
    bruce barker, Sep 28, 2007
    #2
    1. Advertising

  3. Thanks for responding me back.
    Actually They are serilizing some properties if I use [Serializable()]
    but I have some fields and some properties which are read only like
    following I want to have serilaize in XML also. I am using
    [XmlRoot("SSOMembershipUser")] and [XmlElement("UserID")] but nothing is
    working.

    private SSOUser _User = null; //
    private SSOUser _LoggedInUser and some properties which are read only like
    public int UserID
    {
    get { return RealUser.UserID; }
    }



    "bruce barker" wrote:

    > you class says it will implement IXmlSerializable, so have to implement
    > the methods.
    >
    > public XmlSchema GetSchema()
    > {
    > return null;
    > }
    >
    > public void ReadXml(XmlReader reader)
    > {
    > // write code to read xml and fill in your object
    > }
    >
    > public void WriteXml(XmlWriter writer)
    > {
    > // write code to save your object as xml
    > }
    >
    >
    > if you object follows all the rules (all public properties are
    > serializable) and only public get/set properties need saving, then
    > instead of implementing IXmlSerializable, you can use the [Serializable]
    > attribute on your class:
    >
    > [Serializable]
    > public class SSOMembershipUser
    > {
    > }
    >
    > this is just a flag the the default xmlserialier can serialize the
    > object. it will throw a runtime error if it finds a property it can not
    > serialize.
    >
    >
    > -- bruce (sqlwork.com)
    >
    >
    > bobby wrote:
    > > am trying to inherits membership class and implementing IXmlSerializable but
    > > it doesn't work.
    > >
    > >
    > > public class SSOMembershipUser : System.Web.Security.MembershipUser
    > > ,IXmlSerializable
    > >
    > > 'SSO.Security.SSOMembershipUser' does not implement interface member
    > > 'System.Xml.Serialization.IXmlSerializable.GetSchema()'
    > >
    > >

    >
    =?Utf-8?B?Ym9iYnk=?=, Sep 29, 2007
    #3
    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. Bomb Diggy
    Replies:
    0
    Views:
    429
    Bomb Diggy
    Jul 28, 2004
  2. Tony Prichard
    Replies:
    0
    Views:
    706
    Tony Prichard
    Dec 12, 2003
  3. Mark Van Orman

    embedding xml in xml as non-xml :)

    Mark Van Orman, Sep 14, 2004, in forum: XML
    Replies:
    5
    Views:
    460
    Patrick TJ McPhee
    Sep 15, 2004
  4. Andy
    Replies:
    0
    Views:
    519
  5. Erik Wasser
    Replies:
    5
    Views:
    414
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page