You should always declare variable types:
Don't:
Dim x
x = 5
Dim xr = New Xml.XmlTextReader(fs)
Do:
Dim x As Int32
x = 5
Dim xr As New Xml.XmlTextReader(fs)
The rule is: Every 'Dim' needs 'As'.
Make sure option 'strict' is turned on for all new projects (in project
properties).
That might be very annoying at first (especially if you just moved from
VB6), but allows to avoid numerous nasty problems VB6 is plagued with.
You'll quickly get used to using CType() to cast objects to whatever type
they supposed to be.
As to using ReadXml(), make sure you have SP3 installed and you have schema
in the DataSet or XML itself.
If you don't have a schema, ReadXml() would have no choice but to use very
slow inference process.
Which is just as bad as not declaring types in VB.
XmlTextReader is a good option and it is faster than even ReadXml() with
schema, but require a lot of work on your part.
It's not going to create an in memory representation of XML.
It works more like VB6 Recordset. But instead of records you're getting XML
elements one by one.
Best regards,
Ilya
Kenneth Windish said:
Hi,
I was looking at the code you used:
fs = New FileStream("\Program Files\demo.xml", FileMode.Open,
FileAccess.Read)
xr = New XmlTextReader(fs)
ds.ReadXml(xr)
what version of netcf are you using? This does not work for me. This is
the
code that is accepted by the editor:
Dim fs = New FileStream("\Program Files\demo.xml", FileMode.Open,
FileAccess.Read)
Dim xr = New Xml.XmlTextReader(fs)
then I get an error about the fs part not being an object and connot
convert
object to string or something.
I have written an app. that uses readxml and the results are very slow.
Would like to figure out how to use the xmltextreader, as that it is
reported to be faster.
Thanks in advance for any help.