Results 1 to 5 of 5

Thread: Reading An XML File

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2009
    Location
    Scotland
    Posts
    417

    Reading An XML File

    Hi GUys,

    i have my .xml files written like:

    vb.net Code:
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <hiddenFields>
    3.    <hiddenFieldsIDNumber0>sta</hiddenFieldsIDNumber0>
    4.    <hiddenFieldsIDNumber1>mand</hiddenFieldsIDNumber1>
    5. </hiddenFields>

    I'm trying to read the values but i'm not having much luck, i have this:

    vb.net Code:
    1. Function functionLoadHiddenFields(ByVal fileLocation As String)
    2.  
    3.         Try
    4.  
    5.             '// Check if the file exists
    6.             If File.Exists(fileLocation) Then
    7.  
    8.                 '// Load the xml document
    9.                 Dim XMLDoc As New Xml.XmlDocument
    10.  
    11.                 '// Find and load the XML file
    12.                 XMLDoc.Load(fileLocation)
    13.  
    14.                 '// Tell where to look for the data we need
    15.                 Dim XMLItem As Xml.XmlNode = XMLDoc.SelectSingleNode("hiddenFields/")
    16.  
    17.             Else
    18.                 '// oops, the file is missing or wasn't written!
    19.                 MessageBox.Show("A file is missing that we need to use!, please restart the program", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    20.             End If
    21.  
    22.         Catch ex As Exception
    23.  
    24.             Return False
    25.  
    26.         End Try
    27.  
    28.     End Function

    i'm not to sure how to get the individual values, any help would be great!

    thanks guys

    Graham
    Last edited by graham23s; Aug 26th, 2009 at 07:28 AM.

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