DOM Issue

  • Thread starter Thread starter Guest
  • Start date Start date
How can you load a Web Response coming from a URL into a DOM for
parsing (in VB)?

There are many ways to do that. One way is to use an XmlReader that
wraps the response stream. Then create an XmlDocument object and call
XmlDocument.Load(), passing that reader.

If you don't have any special requirements regarding how the XmlReader
processes the input (think validation etc.), you can pass the response
stream directly to XmlDocument.Load(), in which case it will use a
internally constructed XmlReader. See MSDN for more details.

Cheers,
 
Thank you Joerg.

I have tried XMLDocument's DOM.

But the problem is that this an HTML Stream/String; I need an HTML DOM.

Because the string it is not a well formed XML, it complains at line #N of
the string.
Some people say, mshtml's DOM is designed for this....but could not find a
single "working" sample code in VB (or C#). Looks like the syntax has
changed (weird)....the sample codes that I have found (bad params) are not
working with .NET 2.0
 
IIRC, the only way to do this is to stream the response down to a file and
then load it into a MSHTML DOM. I wouldn't know how to do this *without* a
web control, though.

But you're right, the HTML parser is not strict, so it won't complain like
the XML one does.


--
Klaus H. Probst, MVP
http://www.simulplex.net/


"(e-mail address removed)"
 
Back
Top