Re: HTML DOM
- From: paresh.sayani@xxxxxxxxx
- Date: 13 Sep 2005 07:30:06 -0700
Hi,
I am also facing some similar problem with using PIE. Have your
resolved your issue?
Thanks & Regards,
Paresh
Ed Harstronder wrote:
> Hello,
>
> This is all under Windows Mobile 2003 4.21
>
> My question is in regards of HTML DOM access. From the IPIEHTMLDocument
> interface, I am able to get, for example, a list of links in the HTML page.
> The code looks like this:
>
> if ( iBrowser3->get_document ( (IDispatch **)&pDocument ) == S_OK ) {
> IPIEHTMLDocument *pHTMLDocument = NULL;
> if ( pDocument->QueryInterface ( __uuidof(IPIEHTMLDocument), (void
> **)&pHTMLDocument ) == S_OK ) {
> IPIEHTMLElementCollection *pElementCollection = NULL;
> if ( pHTMLDocument->get_links ( &pElementCollection ) == S_OK )
> {
> pElementCollection->get_length ( (long *)&items );
> for ( int i = 0; i < items; i++ )
> {
> VARIANT vtIndex;
> vtIndex.vt = VT_UINT;
> vtIndex.lVal = i;
> VARIANT var2;
> VariantInit( &var2 );
>
> IDispatch* pItem = NULL;
> if( pElementCollection->item( vtIndex, var2,
> (IDispatch**)&pItem ) == S_OK ) {
> IPIEHTMLAnchorElement* pAnchor = NULL;
> if( pItem->QueryInterface(
> __uuidof(IPIEHTMLAnchorElement), (void **)&pAnchor ) == S_OK ) {
> BSTR bstrName;
>
> if( pAnchor->get_href( &bstrName ) == S_OK ) {
> LOG( L"(((((( href --> %s", bstrName );
> SysFreeString( bstrName );
> }
>
> pAnchor->Release();
> }
> ...
>
> This works just fine and I am able to retrieve the href of every link.
> However, what we want to do is to get the inner HTML code from every link
> (so that we can extract other useful information about the anchor element.
> The only interface that we see can do this is IPIEHTMLElement, but we unable
> to get the interface from the link, so this will fail:
>
> IPIEHTMLElement* pElem = NULL;
> if( pItem->QueryInterface( __uuidof(IPIEHTMLElement), (void**)&pElem ) ==
> S_OK ) {
> LOG(L"ELEMENT CREATED");
> } else LOG(L"FAILED!");
>
> I have tried replacing pItem by pAnchor, but doesn't work in either case.
>
> Also, I would like to ask another question related to this: how can we get
> the text from an HTML page? Say a page displays some text plus 2 links. We
> know how to get the links (using the get_links of the IPIEHTMLDocument
> interface) but how can we access other elements? IPIEHTMLDocument only
> provides ways to get forms, frames, links, etc. But it is not clear to us
> how to retrieve the HTML page text. We guess they are enclosed into other
> elements, but we can't see how.
>
> Also, the messages DTM_DOCUMENTDISPATCH and DTM_BROWSERDISPATCH don't seem
> to return valid interfaces... is there any workaround to this?
>
> Any help in this matter will be greatly appreciated.
>
> Best wishes,
>
> Ed
.
- Prev by Date: Re: How many COM Ports available?
- Next by Date: Re: FOLLOWUP Win CE onboard flash
- Previous by thread: Re: How many COM Ports available?
- Next by thread: USB Host Controllers
- Index(es):
Relevant Pages
|