Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 12th, 2010, 05:18 PM
Authorized User
Join Date: Feb 2010
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 ?

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)

        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
End Function

Thank you very much.

Have a good day.


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 06:53 AM
Save PDF file as text file in VB.Net kvenkatu Classic ASP Basics 0 April 7th, 2006 01:09 PM
save a PDF file as text file through VB. NET kvenkatu VB.NET 0 April 6th, 2006 12: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

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.