Results 1 to 6 of 6

Thread: Can someone explain this code ??

Threaded View

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Can someone explain this code ??

    [2005]
    I have been asked to amend someone elses code and am not sure about it.
    Can someone explain this this to me :

    Code:
    Dim xmlSearchDoc As New XmlDocument()
    xmlSearchDoc.LoadXml(sb.ToString())
    Dim nameMan As New XmlNamespaceManager(xSearchDoc.NameTable)
    nameMan.AddNamespace("nameMan", xmlSearchDoc.DocumentElement.NamespaceURI)
    XmlNodeList nlResults = xmlSearchDoc.SelectNodes(@"//namesMan:LocationName", nameMan)
    xmlSearchDoc contains the following :

    Code:
    <Organisations>
     <Organisation xmlns="http://www.test.com/LocationRecord">
      <GUID>{0378BE2E-D3A5-4905-AA80-4C3138B6726E}</GUID> 
      <LocationName>Location Test</LocationName>
    </Organisation>
    </Organisations>
    Firstly, I dont understand the namespacemanager bit. Why add a namespacemanager ?
    And why is it that I return nothing when I do my "XmlNodeList nlResults = xmlSearchDoc.SelectNodes(@"//namesMan:LocationName", nameMan)"
    Last edited by venerable bede; Apr 17th, 2008 at 05:35 AM.

    Parksie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width