Unable to retrieve nodes using SelectSingleNode

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kavijaya
    New Member
    • Jul 2010
    • 3

    #1

    Unable to retrieve nodes using SelectSingleNode

    Error message: "Unable to retrieve nodes using SelectSingleNod e."
    Can anyone tell me correct way of implementing this?
    The following code always returns null:
    (XML I am working with)
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <WdprAccountProfileResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://Broadridge.com/Ascendis/Services/PhaseIV/Entities/">
      <Details i:nil="true" />
      <RawData>
        <ADP_MESSAGE Client_Number="0096" Message_id="WDPR/WDPR_ACCTPROFILES" Version="1.0" Session_Pool_id="mqpool096">
        <RESPONSE>
          <Turnaround/>
          <RequestReturn>N</RequestReturn>
          <Error_Response>
            <Error_Number>9022</Error_Number>
            <Error_Message>User not authorized for service</Error_Message>
          </Error_Response>
        </RESPONSE>
        </ADP_MESSAGE>
      </RawData>
      <StatusCode>SUCCESS</StatusCode>
      <AccountProfilesList>
        <AccountProfileEntity>
          <AccountName>TAIFOOK SECURITIES LIMITED</AccountName>
          <AddDate>03/29/2010</AddDate>
          <AdditionalInformation i:nil="true" />
      <ProfileNum>01</ProfileNum>
    </AccountPortFolioEntity>
    Here is the code I have return to retrieve node with profilenum='01' :
    (C# code)
    Code:
     XmlDocument xdoc = new XmlDocument();
                xdoc.Load("C:\\Documents and Settings\\My Documents\\Visual Studio 2008\\Projects\\ConsoleApplication5\\WireProfile.xml");
    
                string profileno = "01";
                XmlNode root = xdoc.DocumentElement;
     
    
          XmlNode node = xdoc.SelectSingleNode("./AccountProfilesList[AccountProfileEntity/ProfileNum = '" + profileno + "']");
                Console.WriteLine(node["RecBankLocation"].InnerText);
                Console.WriteLine(node["ReceivingBankName"].InnerText);
    Last edited by Frinavale; Sep 21 '10, 03:27 PM. Reason: In the future please post code in [code] ... [/code] tags. Added code tags, added the question to the thread (spelling errors etc corrected). Also updated the title to better reflect the problem.
Working...