VB6中的MSHTML和MSXML [英] MSHTML and MSXML in VB6

查看:131
本文介绍了VB6中的MSHTML和MSXML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要解析我从Inet获得的html数据vb6中的对象。

现在我想要删除html数据。在这里我有两个选择。一个是MSXML

,另一个是MSHTML。我尝试了他们两个,但我没有得到任何东西

他们。 MSXML不适用于某些关键字,并将一些

字母视为运算符,因此我无法使用MSXML。我尝试过MSHTML,但它没有提供任何解析你从其他

来源获得的HTML数据的方法。 MSHTML中有一种方法(fectory方法),可用于获取HTMLDocument的
。但它有一个问题。如果你试图通过代码获取页面,有脚本将焦点设置为控件,并且

MSHTML对象会抛出错误。这里的问题是来自

MSHTML的错误,并且不能被编码。因为它没有收到数据

抛出错误。

如果有人有任何想法或建议如何解决这个问题b / b
问题与我分享。这个VB6真的很糟糕。

谢谢,

幸运

解决方案

" ;幸运" <涂************ @ gmail.com> schrieb:

我需要解析我从Inet得到的html数据。 vb6中的对象。




这是一个VB.NET组。我建议将问题发布到microsoft.public.vb。*中的其中一组


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps。 org />

VB< URL:http://classicvb.org/petition/>


Lucky,


首先,MSXML无法工作的原因是因为HTML不是XML,所以

你几乎总会得到一个解析错误。 />

至于MSHTML,它真的不能直接从VB中暴露出来,它更多的是

a COM接口(而不是自动化,这是什么VB要求)。


要将页面加载到MSHTML中,您必须以某种方式提供对从调用返回的IMoniker接口的访问权限。 API CreateMoniker

(传递您要下载的源的URL)。一旦你这样做,你就可以将
传递给MSHTML上的IPersistMoniker :: Load实现。这个

将导致MSHTML触发加载并解析文档。


然而,从VB执行任何操作都非常困难,而且你

应该使用C ++来访问这些接口并执行这项工作,

以你想要的方式将它暴露给VB6。


希望这会有所帮助。

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


幸运 <涂************ @ gmail.com>在消息中写道

news:11 ********************** @ g47g2000cwa.googlegr oups.com ...

嗨伙计们,我需要解析我从Inet获得的html数据。 vb6中的对象。
现在我想要删除html数据。在这里我有两个选择。一个是MSXML
,另一个是MSHTML。我尝试了他们两个,但我没有得到任何东西
他们。 MSXML不适用于某些关键字,并将一些
字母视为运算符,因此我无法使用MSXML。我尝试过MSHTML,但它没有提供任何方法来解析从其他来源获得的HTML数据。 MSHTML中有一种方法(fectory方法)可用于获取HTMLDocument。但它有一个问题。如果你试图通过代码获取页面,则有脚本将焦点设置为控件,并且
MSHTML对象会抛出错误。这里的问题是来自
MSHTML的错误,并且不能被编码。因为在抛出错误后它没有收到数据。
如果有人对如何解决这个问题有任何想法或建议,请与我分享。这个VB6真的很糟糕。

谢谢,
幸运



>对于MSHTML,它实际上不能直接暴露于VB,它更多的是

一个COM接口(而不是VB,这是VB要求的)。
<要将页面加载到MSHTML中,您必须以某种方式提供对从调用API返回的IMoniker接口的访问权限
CreateMoniker(传递要下载的源的URL) )。一旦你这样做,就可以将它传递给MSHTML上的IPersistMoniker :: Load实现。这将导致MSHTML触发加载并解析
文档。
然而,从VB执行任何操作都非常困难,而且您应该使用C ++来实现访问这些接口并执行此工作,以您希望的方式将其公开给VB6。




在VB 2002/2005中使用MSHTML非常简单* 。

http://www.vb-tips.com/default.aspx?...f-56dbb63fdf1c


当然对于C#


但是这当然没有VB6


:-)


Cor


hi guys,
i need to parse html data that i''ve got from "Inet" object in vb6.
now i want to prase the html data. here i got 2 options. one is MSXML
and other is MSHTML. i tried both of them but i didnt get anything out
of them. MSXML doesnt works with some keywords and consider some
letters as operator so i cant go with MSXML. i tried MSHTML but it
doesnt provide any way to parse the HTML data you got from other
source. there is a method(fectory method) in MSHTML which can be use to
get HTMLDocument. but it has a problem. if the page you are trying to
get through code, has script to set the focus to the control and the
MSHTML object throws an error. here the problem is error comes from the
MSHTML and which can not be hadled. as it doesnt receive data after
throwing the error.
if anyone has any idea or suggestion on how can i solve this
problem, plese do share with me. this VB6 really sucks.
Thanks,
Lucky

解决方案

"Lucky" <tu************@gmail.com> schrieb:

i need to parse html data that i''ve got from "Inet" object in vb6.



This is a VB.NET group. I suggest to post the question to one of the groups
in the "microsoft.public.vb.*" hierarchy.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Lucky,

First, the reason that MSXML doesn''t work is because HTML is not XML, so
you will almost always get a parse error.

As for MSHTML, it really isn''t directly exposable from VB, it''s more of
a COM interface (as opposed to Automation, which is what VB demands).

To load a page into MSHTML, you would have to somehow provide access to
the IMoniker interface that is returned from a call to the API CreateMoniker
(passing the URL of the source you want to download). Once you do this, you
can pass it to the IPersistMoniker::Load implementation on MSHTML. This
will cause MSHTML to trigger the load and parse the document.

However, doing any of this from VB is *extremely* difficult, and you
should probably use C++ to access these interfaces and perform this work,
exposing it to VB6 in the manner you desire.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Lucky" <tu************@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...

hi guys,
i need to parse html data that i''ve got from "Inet" object in vb6.
now i want to prase the html data. here i got 2 options. one is MSXML
and other is MSHTML. i tried both of them but i didnt get anything out
of them. MSXML doesnt works with some keywords and consider some
letters as operator so i cant go with MSXML. i tried MSHTML but it
doesnt provide any way to parse the HTML data you got from other
source. there is a method(fectory method) in MSHTML which can be use to
get HTMLDocument. but it has a problem. if the page you are trying to
get through code, has script to set the focus to the control and the
MSHTML object throws an error. here the problem is error comes from the
MSHTML and which can not be hadled. as it doesnt receive data after
throwing the error.
if anyone has any idea or suggestion on how can i solve this
problem, plese do share with me. this VB6 really sucks.
Thanks,
Lucky



> As for MSHTML, it really isn''t directly exposable from VB, it''s more of

a COM interface (as opposed to Automation, which is what VB demands).

To load a page into MSHTML, you would have to somehow provide access to
the IMoniker interface that is returned from a call to the API
CreateMoniker (passing the URL of the source you want to download). Once
you do this, you can pass it to the IPersistMoniker::Load implementation
on MSHTML. This will cause MSHTML to trigger the load and parse the
document.

However, doing any of this from VB is *extremely* difficult, and you
should probably use C++ to access these interfaces and perform this work,
exposing it to VB6 in the manner you desire.



Using MSHTML in VB 2002/2005 is *extremely* simple.

http://www.vb-tips.com/default.aspx?...f-56dbb63fdf1c

The same of course for C#

However this is of course no VB6

:-)

Cor


这篇关于VB6中的MSHTML和MSXML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆