I have a blank XML file that looks like this
<root>
     <personal>
           <name></name>
           <address></address>
           <phone></phone>
     </personal>
     <car>
           <make></make>
           <model></model>
           <reg></reg>
     </car>
     <family>
           <familymember>
                  <name></name>
                  <age></age>
                  <relationship></relationship>
           </familymember>
           <familymember>
                  <name></name>
                  <age></age>
                  <relationship></relationship>
           </familymember>
           <familymember>
                  <name></name>
                  <age></age>
                  <relationship></relationship>
           </familymember>
    </family>
</root>
All of the data for this file is held in my local SQLite database (on the phone).
I can read the data into my container classes. These classes don't marry up 1:1 with the XML file elements
For example, my personal class looks like this
public class personal
{
    public string id {get;set;}
    public string name {get;set;}
    public string address1 {get;set;} 
    public string address2 {get;set;}
    public string address3 {get;set;}
    public string town {get;set;}
    public string country {get;set;}
    public string phone {get;set;}
    public string mobile {get;set;}
    public string email {get;set;}
    [Ignore]
    public string address {
        get
        { return string.Format("{0}\n{1}\n{2}\n{3}\n{4}", address1, address2, address3, town, county
        }
    }
}
Is there a simple(ish) way to fill the blank XML file with the selected contents from my SQLite container class (I don't mind creating a feeder class for the XML propogation)?
Aucun commentaire:
Enregistrer un commentaire