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

rookie problem with xml namespaces in c#

Avatar of jimbona27
jimbona27Flag for United Kingdom of Great Britain and Northern Ireland asked on
.NET ProgrammingC#ASP.NET
14 Comments1 Solution1564 ViewsLast Modified:
Hi EE,
I need to add multiple namespaces for Xpath a document.  I recently closed a question for one namespace but Im
not sure what happens when I need to add multiple namespaces.
 
<?xml version="1.0" encoding="utf-8"?>
<test xsi:schemaLocation="xxx" xmlns="xxx" xmlns:apd="xxx" xmlns:bs7666="xxx" xmlns:xsi="xxx" xmlns:con="xxx">
  <testdata1>example</testdata1>
  <testdata2>today</testdata2>
  <testdata3>monday</testdata3>


any ideas how I can add multiple namespaces using c# so I can iterate through XmlNodeList?
Many thanks,
XmlDocument xmldoc = new XmlDocument();
            XmlNamespaceManager nsMgr = new XmlNamespaceManager(xmldoc.NameTable);
            nsMgr.AddNamespace("xmlns:apd", "ass");
            nsMgr.AddNamespace("??", "xxxx");
            nsMgr.AddNamespace("??", "xxxx");
            nsMgr.AddNamespace("??", "xxxx");
            xmldoc.LoadXml(xstring);
            XmlNodeList nodeList = xmldoc.SelectNodes("??", nsMgr);
 
            foreach (XmlNode Xnode in nodeList)
            {
            }
ASKER CERTIFIED SOLUTION
Avatar of kruegerste
kruegersteFlag of United States of America image

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

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