For Programmers: Free Programming Magazines  


Home > Archive > C# > November 2004 > SelectSingleNode with multiple namespaces (sort of)...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SelectSingleNode with multiple namespaces (sort of)...
455

2004-11-30, 4:01 pm

Hello all,

I've been trying to figure this out for hours now... can anyone help?

I have an XML document like this:

<?xml version="1.0" encoding="utf-8" ?>
<ICE:ServiceCall xmlns="ICE" xmlns:ICE="http://www.ice.net">
<ICE:Service name="">
<ICE:RetVal/>
<ICE:ConnString/>
<ICE:Params>
<Subject>TEST</Subject>
</ICE:Params>
</ICE:Service>
</ICE:ServiceCall>

For the life of me, I cannot selectsinglenode() to the Subject.

Here's the code:

XmlNamespaceManager _xnsmgr = new XmlNamespaceManager(xRequest.NameTable);

_xnsmgr.AddNamespace(string.Empty,"ICE");

_xnsmgr.AddNamespace("ICE",http://www.ice.net);

try

{

//THIS IS ALWAYS FAILING!!!

sSubject = xRequest.SelectSingleNode("//ICE:Params/Subject",
_xnsmgr).InnerText;

}

catch (Exception ex)

{

string sDEBUG = ex.Message;

}



Any help would be extremely .. um... helpful.

Thanks.




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com