Dim Page As String = WebBrowser1.Document.Body.OuterText
            If System.IO.File.Exists("C:\temp.txt") = True Then
                System.IO.File.Delete("C:\temp.txt")
            End If
            Dim fs As New System.IO.FileStream("C:\temp.txt",
IO.FileMode.CreateNew)
            Dim w As New System.IO.StreamWriter(fs)
            Page = Page.Replace("-", "")
            Page = Page.Replace("UTF8", "ASCII")
            Page = Page.Replace("UTF-8", "ASCII")
            Page = Page.Replace("&", " ")
            Page = Page.TrimStart(" ")
            w.Write(Page)

            w.Close()
            fs.Close()

-----------------------------------------------------------------------

This is a code snippet I took from my test program. It uses OAuth to
authenticate. But this snippet is not about OAuth! These are the
things you are required to do before you can issue an XML.DOC.LOAD()
call.

So, you have dimmed xml as a new system.xml.document

Now, you want to call xml.load(WebBrowser1.DocumentText)

Forget it!

You are required to format the Twitter XML Web Page BEFORE loading it
into an XML Document in VB.NET.

Firstly, there is white space at the beginning of the document that
needs removing.

Secondly, you have to replace every - and & otherwise it will fail to
load! (Definitely the & not so much the - )

Thirdly, you are required to reformat the document from UTF8 to ASCII.
The XML.Load() call in VB.NET DOES NOT SUPPORT UTF8 ENCODING!!!!! I
cannot stress this enough :)

No, I am not shouting - I am using caps as a replacement for italics!
Haha.

So, after all this, the document C:\temp.txt can be used to load in
your XML.load("C:\temp.txt") document. But, there are other issues -
such as deleting the file before updating (re-writing the new document
with updates) then re-loading the new file into the XML parser in
VB.NET. These are all issues I hope you can solve yourself. This post
is specific to formatting the Twitter XML to adhere to VB.NET
standards.

Obrzut

Reply via email to