Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 17th, 2006, 5:00 AM   #1
nascar2000
Newbie
 
Join Date: Apr 2006
Posts: 9
Rep Power: 0 nascar2000 is on a distinguished road
help in reading XML

hello everybody, i need help in reading a XML file , can somebody teach me how to read from a xml file within visual basic frame.
nascar2000 is offline   Reply With Quote
Old Nov 17th, 2006, 6:27 AM   #2
alphonso
Programmer
 
Join Date: Dec 2005
Location: Philippines, where the seasons are: hot, and hotter
Posts: 72
Rep Power: 3 alphonso is on a distinguished road
You might wanna start reading here
__________________
"The most incomprehensible idea about the universe is that it is comprehensible" - Albert Einstein
alphonso is offline   Reply With Quote
Old Nov 17th, 2006, 9:11 AM   #3
melbolt
Hobbyist Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 237
Rep Power: 4 melbolt is on a distinguished road
Send a message via AIM to melbolt Send a message via Yahoo to melbolt
here is an example from one of my programs where i read xml from a file and puts the data into an array. The xml contains a bunch of random phrases.

here's an example of what my Phrases.xml file looks like
xml Syntax (Toggle Plain Text)
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <phrases>
  3. <phrase>phrase 1</phrase>
  4. <phrase>phrase 2</phrase>
  5. <phrase>phrase 3</phrase>
  6. <phrase>phrase 4</phrase>
  7. </phrases>


vbnet Syntax (Toggle Plain Text)
  1. Dim PhraseArray(500) As String
  2. Dim MyXmlTextReader As New XmlTextReader("S:\ApplicationPool\CIMS Talker\Phrases.xml")
  3. Dim i As Integer = 0
  4. MyXmlTextReader.WhitespaceHandling = WhitespaceHandling.None
  5.  
  6. 'initial read to get past xml declaration
  7. MyXmlTextReader.Read()
  8.  
  9. While MyXmlTextReader.Read()
  10. If MyXmlTextReader.Value.Length > 0 Then
  11. PhraseArray(i) = MyXmlTextReader.Value
  12. i = i + 1
  13. End If
  14. End While
  15.  
  16. MyXmlTextReader.Close()


much like using a sqldatareader, everytime you call .Read() it retrieves the next value.

btw import system.xml
__________________
I have never let my schooling interfere with my education. -Mark Twain-

Xbox live gamertag: melbolt

Last edited by melbolt; Nov 17th, 2006 at 10:09 AM.
melbolt is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading a string dmcl2000 Visual Basic 4 Sep 13th, 2006 6:14 AM
c++ reading from a file ... programmingnoob C++ 8 Apr 22nd, 2006 6:17 PM
CPU Usage goes to 100% when pthread_cond_wait is being used zen_buddha C++ 1 Oct 13th, 2005 5:59 AM
Code Reading Tips linuxpimp20 Other Programming Languages 4 Sep 8th, 2005 3:53 PM
reading in a file in java ryanl Java 3 Sep 8th, 2005 9:54 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:36 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC