|
-
May 8th, 2010, 12:03 AM
#5
Re: Data at the root level is invalid. Line 1, position 1
Thank you so much for the attachments ... I have proceeded with your advise to use the XmlTextReader and revised my little code ... and now everything works like a charm ... thx again
Public Sub ReadXML(ByVal strFile As String)
Dim xmlrdr As New XmlTextReader(strFile)
Do While xmlrdr.Read
Select Case xmlrdr.NodeType
Case Xml.XmlNodeType.Element
Case Xml.XmlNodeType.Text
MsgBox(xmlrdr.Value)
Case Xml.XmlNodeType.EndElement
MsgBox(xmlrdr.Name)
End Select
Loop
End Sub
Gratefully,
Matt
 Originally Posted by HanneSThEGreaT
Please post [CODE] tags when posting code please. It is explained here :
http://www.codeguru.com/forum/showthread.php?t=403073
As to your issue, I'm curious to know why your'e not using the XMLReader / Writer objects??
Have a look at the attachments, it should help. Just copy the necessary XML files to the C:\
You may also have a problem with the format of your XML document. For example, one of my XML files look like :
Code:
<?xml version="1.0" encoding="utf-8"?>
<!--information about this book-->
<book isbn="0-672-32549-7">
<title>Start</title>
<authors>
<author>D</author>
<author>A</author>
<author>E</author>
<author>J</author>
</authors>
<chapters>
<chapter id="1" topic="A" />
<chapter id="2" topic="B" />
<chapter id="3" topic="C" />
<chapter id="4" topic="D" />
<chapter id="5" topic="E" />
<chapter id="6" topic="F" />
<chapter id="7" topic="G" />
<chapter id="8" topic="H" />
<chapter id="9" topic="I" />
<chapter id="10" topic="J" />
<chapter id="K" topic="L" />
</chapters>
</book>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|