locked
Dynamic Xml data models RRS feed

  • Question

  • Hi,

    I need to create the XML data models as dynamic in portable library class.

    XML Data

    <sample>
    <androidAppVersion/>
    <callSyncTime>5</callSyncTime>
    <cellPin/>
    <id>1234</id>
    <locationSyncTime>15</locationSyncTime>
    <loginTimeout>-1</loginTimeout>
    <name>test user</name>
    <permissions>
    <permission>login.web</permission>
    <permission>attendance.view</permission>
    <permission>complaint.activity.create</permission>
    <permission>complaint.schedule</permission>
    <permission>complaint.web.create</permission>
    <permission>complaint.list</permission>
    <permission>update.line.item</permission>
    <permission>view.line.item.report</permission>
    <permission>complaint.cell.create</permission>
    <permission>attendance.location.list</permission>
    <permission>view.location</permission>
    <permission>complaint.web.edit</permission>
    <permission>create.line.item</permission>
    <permission>login.cell</permission>
    <permission>attendance.location.search</permission>
    <permission>save.schedule</permission>
    </permissions>
    <productMaster>false</productMaster>
    <role>Field Staffs</role>
    <roleType>2</roleType>
    <strictClientVersionCheck>false</strictClientVersionCheck>
    <workflows>
    <workflowId>test1</workflowId>
    <workflowId>test2</workflowId>
    <workflowId>test3</workflowId>
    </workflows>
    </sample>

    XML Data Models

     [XmlRoot("sample")]
        public class UserInfo
        {
            public UserInfo() { }
    
            [XmlElement("androidAppVersion")]
            public string AndroidAppVersion { get; set; }
    
            #region Permissions
            [XmlArray("permissions")]
            [XmlArrayItem("permission")]
            public List<string> Permission { get; set; }
            #endregion
    
            #region WorkFlowId
            [XmlArray("workflows")]
            [XmlArrayItem("workflowId")]
            public List<string> WorkFlowIds { get; set; }
            #endregion
    
            [XmlElement("callSyncTime")]
            public string CallSyncTime { get; set; }
    
            [XmlElement("cellPin")]
            public string CellPin { get; set; }
    
            [XmlElement("id")]
            public string Id { get; set; }
    
            [XmlElement("locationSyncTime")]
            public string LocationSyncTime { get; set; }
    
            [XmlElement("loginTimeout")]
            public string LoginTimeOut { get; set; }
    
            [XmlElement("name")]
            public string Name { get; set; }
    
            [XmlElement("productMaster")]
            public string ProductMaster { get; set; }
    
            [XmlElement("role")]
            public string Role { get; set; }
    
            [XmlElement("roleType")]
            public string RoleType { get; set; }
    
            [XmlElement("strictClientVersionCheck")]
            public string ClientVersionCheck { get; set; }
        }

    For the above Xml Data i created the Xml data models as static and it's working fine. Now i need to create dynamic xml data models for the same Xml data.

    Please give me any idea to do this.

    Monday, February 3, 2014 7:36 AM

All replies