Solved

How to access this data ( XML, C# Deserialize )

Posted on 2008-06-25
4
1,389 Views
Last Modified: 2008-09-18
I need to deserialize this xml file. And access the value using C#..

the value i want to access is

<Image Kdf=\"PRgo=\" />

thanks
so far what i have 
 

 XmlReaderSettings settings = new XmlReaderSettings();

            XmlSerializer serializer2 = new XmlSerializer(typeof(ISOReponsesType1));

            System.IO.StringReader stringReader2 = new System.IO.StringReader(myString);

            XmlReader xmlReader2 = XmlReader.Create(stringReader2, settings);

            ISOReponsesType1 svcResp = (ISOReponsesType1)serializer2.Deserialize(xmlReader2);
 
 

            ReportsType report = (ReportsType)svcResp.Items[1];
 
 

            string myText = "";

            ResponsesType responses = (ResponsesType)report.Responses;
 

            ....
 

we also have a wrapper class

Open in new window

0
Comment
Question by:beos1907
  • 2
4 Comments
 

Author Comment

by:beos1907
Comment Utility
also we have a wrapper class
public partial class ResponseType

{

    private ReportType report2Field;

    private object itemField;
 

    /// <remarks/>

    [System.Xml.Serialization.XmlElementAttribute("ErrorReturn", typeof(ErrorReturn))]

    [System.Xml.Serialization.XmlElementAttribute("Report", typeof(RepCostReportType), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]

    [System.Xml.Serialization.XmlElementAttribute("root", typeof(HomeValueErrorsType), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]

    public object Item

    {

        get

        {

            return this.itemField;

        }

        set

        {

            this.itemField = value;

        }

    }
 

etc.. 

Open in new window

0
 
LVL 11

Accepted Solution

by:
Vivek Thangaswamy earned 500 total points
Comment Utility
Hope this helps you
http://www.codeproject.com/KB/XML/webservicessimple.aspx
// Data Binding :: DataSet Appending

public void DataBindFrmWS()

{

   XmlDocument myServiceDoc = new XmlDocument();

   System.Xml.XmlNode neNode;

   //Adding the resulting XML from WebMethod to a user created XmlNode

   neNode = myService1.GetDataFromDB();

   //Creating a Dataset

   DataSet myDataSet = new DataSet();

   //The XmlNode is added to a byte[]

   byte[] buf = System.Text.ASCIIEncoding.ASCII.GetBytes(neNode.OuterXml);

   System.IO.MemoryStream ms = new System.IO.MemoryStream(buf);

   //The XML is readed from the MemoryStream

   myDataSet.ReadXml(ms);

   

   GridView1.DataSource = myDataSet.Tables[0];

   GridView1.DataBind();

}

Open in new window

0
 
LVL 11

Expert Comment

by:Vivek Thangaswamy
Comment Utility
Hi beos1907,
Is my solution helped you?
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now