Results 1 to 2 of 2

Thread: [RESOLVED] [2005] Reading XML

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2007
    Location
    Kentucky, USA
    Posts
    82

    Resolved [RESOLVED] [2005] Reading XML

    If I have the following XML file:

    Code:
    <Catalog>
      <Patch>
        <UpdateNumber>1</UpdateNumber>
        <properties>
          <ProductName>Sample Update</ProductName>
          <PatchName>Sample_Update.exe</PatchName>
          <Description>Installs the Sample Update</Description>
          <Reboot>1</Reboot>
          <file_1 style="normal">FILEPATH</file_1>
        </properties>
        <downloads>
              <DownloadURL>LOCATION</DownloadURL>
        </downloads>
        <detection style="applicable">
            <OSType>WIN_XP</OSType>
        </detection>
        <detection style="installed"> 
        </detection>
      </Patch>
    </Catalog>
    How would I read each node type. For example if I just wanted to read ProductName from the properties section?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] Reading XML

    Load it into an XmlDocument. Then

    vb Code:
    1. Dim productName As String
    2. productName = doc.SelectSingleNode("/Catalog/Patch/properties/ProductName").Value

    The argument to SelectSingleNode is an XPath string. You'd use similar XPath to get to your other nodes.

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