Click here to Skip to main content
14,970,106 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Here I have a scenario that Create xml file dynamically and it should be serialisable and my xml is like following
HTML
<person>
<personaldata>
<name>gopi</name>
<lastname>ch</lastname>
</personaladata>
<Educationaladata>
<Graduation>b.tech</graduation>
<designation>Engineer</designation>
</educationaldata>
</person>


and my c# code is following
public string CreateXmlObject(Person objPerson)
        {
            var objXmlDocument = new XmlDocument();
            var objXpath = objXmlDocument.CreateNavigator();
            var objXmlSeialiser = new XmlSerializer(objPerson.GetType());
            using (var xs = objXpath.AppendChild())
            {
                objXmlSeialiser.Serialize(xs, objPerson);
            }
            return objXmlDocument.OuterXml;

        }


but my actual Problem is i have to read specifc data like personaldata or educationaldata and when i update data from text boxes only neccessary data should be updated like only personal data


How to read specific data like only personaldata
Posted
Comments
[no name] 8-Dec-15 1:22am
   
You implemented XML serialization here. You want to serialize either personal or educational data. When you say "update data from textboxes" then will it update data in objPerson object and serialize it. Please clarify..

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900