Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Deserialize xml with namespace

Avatar of jimbona27
jimbona27Flag for United Kingdom of Great Britain and Northern Ireland asked on
.NET ProgrammingC#
7 Comments1 Solution2172 ViewsLast Modified:
hi EE,
I'm having issues with Deserialize'ing an XML Stream that has the xmlns namepsace in the file??!!

If I take this out my code works fine but I'm not sure how to add the namespace into the Deserializing bit of the code!

Can anyone advise/ show me how to get this working!

P.S.  The object I deserialize the data into has no mention of xml namespaces as I dont know how!!

Many thanks,


<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>xxx</title>
  <subtitle></subtitle>
...


foreach (StreamReader sr in this.AtomStream)
            {
                try
                {
                    XmlSerializer mySerializer = new XmlSerializer(typeof(XmlFeed));
                    XmlResponse = (XmlFeed)mySerializer.Deserialize(sr);  // errors when I use xml data with a namespace
                    this.AtomDeserializeList.Add(XmlResponse);
                }
                catch { }
                finally { }
            }
ASKER CERTIFIED SOLUTION
Avatar of Anurag Thakur
Anurag ThakurFlag of India imageTechnical Manager

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answers