Reading XML

G

Guest

Hi all,

I have an XML file that I wish to load and use with VB.NET. It is in the
structure:

<?xml version="1.0" encoding="UTF-16"?>
<sql xmlns:ss="urn:schemas-microsoft-com:blush:ffice:spreadsheet">
<insert>INSERT INTO ClientCarriers VALUES ('AC',5)</insert>
<insert>INSERT INTO ClientCarriers VALUES ('AC',6)</insert>
</sql>

I am trying to read through the nodes in the sql element with VB.NET. At
the moment I am using...

Dim doc As System.Xml.XmlDocument
Dim reader As System.Xml.XmlTextReader
Dim nodes As System.Xml.XmlNodeList
Dim node As System.Xml.XmlNode
Dim root As XmlElement

Try
doc = New XmlDocument
Dim str As String
str = MapPath(".") & "\basic2.xml"
reader = New XmlTextReader(str)
doc.PreserveWhitespace = True
doc.Load(reader)
Catch ex As Exception
'output message
End Try

An exception is thrown on the line doc.Load(reader):
"There is no Unicode byte order mark. Cannot switch to Unicode."

What do i have to do to get this working?

Any help would be appreciated,
Jesse
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top