Click here to Skip to main content
15,891,855 members
Home / Discussions / C#
   

C#

 
GeneralRe: Save to default program files folder Pin
Luc Pattyn21-May-09 13:35
sitebuilderLuc Pattyn21-May-09 13:35 
QuestionCurious question as I am c# developer. [modified] Pin
Blubbo21-May-09 2:23
Blubbo21-May-09 2:23 
AnswerRe: Curious question as I am c# developer. Pin
musefan21-May-09 2:33
musefan21-May-09 2:33 
AnswerRe: Curious question as I am c# developer. Pin
EliottA21-May-09 3:01
EliottA21-May-09 3:01 
JokeRe: Curious question as I am c# developer. Pin
Manas Bhardwaj21-May-09 4:02
professionalManas Bhardwaj21-May-09 4:02 
GeneralRe: Curious question as I am c# developer. Pin
PIEBALDconsult21-May-09 5:20
mvePIEBALDconsult21-May-09 5:20 
QuestionUsing UserFields and Date Fields in Web Parts Pin
lday8621-May-09 2:22
lday8621-May-09 2:22 
QuestionCombining default xml serialization and custom xml serialization. Pin
rahulvb2821-May-09 2:03
rahulvb2821-May-09 2:03 
Hi,

I am using xsd.exe to generate the .cs file to serialize and deserialize the xml responce. .cs file contains number os classes. I want to use defauls xml serialization for some classes and custom serialization for some.
<Job>
<tm>
     <source>source1</source_transfer_method>
     <group>1</group>
 </tm>
 <active_flag>A</active_flag>
</job>

for the above xml responce xsd had created tow class "job" and "TM". I want to override the serialization of TM class and want to apply custome serialization to create collection (hashtable) for the elements under "TM"

When I Deserialize it both default serialization for "job" class and my custom serialization for "TM" class is not working. Please help.

Using xsd.exe generated below class

[
System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class Job
{
    private string active_flagField;
       .....and so on 
    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute (Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string active_flag {
        get {
            return this.active_flagField;
        }
        set {
            this.active_flagField = value;
        }
    }

}
public partial class TM : Hashtable, IxmlSerializable
{
public System.Xml.Schema.XmlSchema GetSchema()
    {
        throw new System.Exception("The method or operation is not implemented.");
    }

    public void ReadXml(System.Xml.XmlReader reader)
    {
        reader.Read();
               

        // Read all elements
        while ((reader.Name != "TM"))
        {
           if (reader.NodeType == XmlNodeType.Element)
            {
                // PArsing the key and value 
                string key = reader.Name;
                reader.Read();
                string value = reader.Value;
                // en reading the item.

                // add the item
                this.Add(key, value);

            }
            reader.Read();
        }

        
    }

    public void WriteXml(System.Xml.XmlWriter writer)
    {
        throw new System.Exception("The method or operation is not implemented.");
    }

}

QuestionCrysatal Report Problem Pin
Mogaambo21-May-09 1:48
Mogaambo21-May-09 1:48 
QuestionRegion based shape representation Pin
raouaa21-May-09 1:15
raouaa21-May-09 1:15 
AnswerRe: Region based shape representation Pin
Henry Minute21-May-09 1:50
Henry Minute21-May-09 1:50 
QuestionReturning Field Names in SharePoint Pin
lday8621-May-09 1:04
lday8621-May-09 1:04 
GeneralGantt chart control Pin
hairy_hats21-May-09 0:48
hairy_hats21-May-09 0:48 
GeneralRe: Gantt chart control Pin
musefan21-May-09 1:06
musefan21-May-09 1:06 
GeneralRe: Gantt chart control Pin
hairy_hats21-May-09 1:22
hairy_hats21-May-09 1:22 
GeneralRe: Gantt chart control Pin
musefan21-May-09 1:25
musefan21-May-09 1:25 
GeneralRe: Gantt chart control Pin
hairy_hats21-May-09 1:33
hairy_hats21-May-09 1:33 
GeneralRe: Gantt chart control Pin
musefan21-May-09 1:41
musefan21-May-09 1:41 
QuestionWord automation using C# Pin
Niks775521-May-09 0:32
Niks775521-May-09 0:32 
AnswerRe: Word automation using C# Pin
musefan21-May-09 0:46
musefan21-May-09 0:46 
GeneralRe: Word automation using C# Pin
Niks775521-May-09 1:23
Niks775521-May-09 1:23 
GeneralRe: Word automation using C# Pin
musefan21-May-09 1:31
musefan21-May-09 1:31 
GeneralRe: Word automation using C# Pin
Niks775521-May-09 19:39
Niks775521-May-09 19:39 
AnswerRe: Word automation using C# Pin
Pete O'Hanlon21-May-09 1:50
mvePete O'Hanlon21-May-09 1:50 
GeneralRe: Word automation using C# Pin
Niks775521-May-09 18:24
Niks775521-May-09 18:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.