Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 12th, 2010, 05:18 PM
Authorized User
Points: 97, Level: 1
Points: 97, Level: 1 Points: 97, Level: 1 Points: 97, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2010
Location: New Zealand
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
Default Vb.Net 2003 : How to Open and Read an XML File to TEXT File.

Hi Good Guys,
I have another interest problem. I need your help. Thank you in advance.

I have created 2 format types (ELEMENT, ATTRIBUTE) of XML File. To open and read the ELEMENT Format type
and write the row into TEXT string for display is fine but the ATTRIBUTE Format is not working.
The problem is how to identify the format type at runtime in order to develop the script.



The scripts below works on ELEMENT format and not on ATTRIBUTE format type :
How to identify the Format type ?


---------------------------------------------------------
Code:
Imports System.Xml
Imports System.IO
Imports System.Data
Imports System.Text
 

 Private Function FReadXMLFile()
        Dim xmlDoc As New XmlDataDocument
        Dim xmlNode As XmlNodeList
        Dim intNode As Integer = 0
        Dim x As Integer = 0
        Dim i As Integer = 0

        Dim strText As String   ' use for display
        Dim fs As New FileStream(Me.txtFileName.Text, FileMode.Open, FileAccess.Read)

        xmlDoc.Load(fs)
        Dim intRowCnt As Integer = xmlDoc.GetElementsByTagName("row").Count
        xmlNode = xmlDoc.GetElementsByTagName("row")
     
        For x = 0 To (intRowCnt - 2)
            i = 0
            For i = 0 To (xmlNode.Count - 3)
                strText &= xmlNode(x).ChildNodes(i).InnerText.Trim & "|"
 
                If i = (xmlNode.Count - 3) Then
                    strText &= ControlChars.NewLine
                End If
            Next
        Next
 
        MessageBox.Show(strText)
End Function
__________________


Thank you very much.

Have a good day.

Cheers,
Lennie
Reply With Quote
Reply


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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read an already open Excel file in VB.NET sunilr General .NET 4 February 28th, 2014 07:20 AM
Read Text file and convert to Binary file VB.net sjlsysprg1 Pro VB.NET 2002/2003 4 June 29th, 2007 07:53 AM
Save PDF file as text file in VB.Net kvenkatu Classic ASP Basics 0 April 7th, 2006 02:09 PM
save a PDF file as text file through VB. NET kvenkatu VB.NET 0 April 6th, 2006 01:15 PM
Read text file and out to serial port VB.net noomkmitl Pro VB.NET 2002/2003 0 December 27th, 2004 08:44 AM



All times are GMT -4. The time now is 10:34 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.