Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Thu, 23 Feb 2006 02:23:29 -0800,    group: microsoft.public.inetsdk.programming.html_objmodel        back       


META tag   
Hi,
  
   How do I get directly META tag from IHTMLDocument2 interface?
   I am getting through get_all() function. Is it right way?

   Is there any other good technique?

Thanks in advance.

Regards,
siri.
date: Thu, 23 Feb 2006 02:23:29 -0800   author:   Siri

Re: META tag   
"Siri"  wrote in message
news:C678A626-8D00-4D8B-8D9F-3539DA7915C7@microsoft.com
>   How do I get directly META tag from IHTMLDocument2 interface?

document.all.tags("meta")

-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Thu, 23 Feb 2006 07:54:43 -0500   author:   Igor Tandetnik

Re: META tag   
Hi Igor,

   I am always getting "failed at tags" from the below function.

   Please correct me.
 
Code:

HRESULT CMyCls::HrGetMATATag(IHTMLDocument2 **pMSGHTML,BSTR &bstrMATA)
{
	IHTMLElementCollection* pListOfElements = NULL;
	HRESULT hr = NOERROR;
	hr = (*pMSGHTML)->get_all(&pListOfElements);

	FILE* FP = fopen("C:\\Tracefile.txt","a+");

	if (SUCCEEDED(hr))
	{
		CComVariant varMATA("MATA");

		IDispatch* pDispMATA = NULL;
		hr = pListOfElements->tags(varMATA,&pDispMATA);
		if (SUCCEEDED(hr))
		{
			IHTMLElement* pCONTENT = NULL;

			hr = pDispMATA->QueryInterface(IID_IHTMLElement,(void**)&pCONTENT);
			if (SUCCEEDED(hr))
			{
				BSTR bstrCHARSET;
				hr = pCONTENT->get_innerText(&bstrCHARSET);
				FILE* fp = fopen("C:\\chaset.txt","a+");
				USES_CONVERSION;
				fprintf(fp,"%s\n",W2A(bstrCHARSET));
				fclose(fp);
				if (FAILED(hr))	hr = E_FAIL;

				SysFreeString(bstrCHARSET);
				pCONTENT->Release();
			}
			else
				fprintf(FP,"%s\n","failed at tags");
			pDispMATA->Release();

		}
		else
			fprintf(FP,"%s\n","failed at tags");

		varMATA.Clear();
		pListOfElements->Release();
	}
	else 
		fprintf(FP,"%s\n","failed at get_all");

	fclose(FP);

	return hr;

}


Thanks in advance.

Regards,
Durga.


"Igor Tandetnik" wrote:

> "Siri"  wrote in message
> news:C678A626-8D00-4D8B-8D9F-3539DA7915C7@microsoft.com
> >   How do I get directly META tag from IHTMLDocument2 interface?
> 
> document.all.tags("meta")
> 
> -- 
> With best wishes,
>     Igor Tandetnik
> 
> With sufficient thrust, pigs fly just fine. However, this is not 
> necessarily a good idea. It is hard to be sure where they are going to 
> land, and it could be dangerous sitting under them as they fly 
> overhead. -- RFC 1925 
> 
> 
>
date: Thu, 23 Feb 2006 05:53:30 -0800   author:   Siri

Re: META tag   
Siri  wrote:
> CComVariant varMATA("MATA");
>
> IDispatch* pDispMATA = NULL;
> hr = pListOfElements->tags(varMATA,&pDispMATA);

The tag name is META, not MATA.

> IHTMLElement* pCONTENT = NULL;
> hr = pDispMATA->QueryInterface(IID_IHTMLElement,(void**)&pCONTENT);

tags() method returns a collection, not a single tag - there may be 
multiple meta tags. You should query for IHTMLElementCollection.
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Thu, 23 Feb 2006 10:47:14 -0500   author:   Igor Tandetnik

Re: META tag   
Thank you Igor.

"Igor Tandetnik" wrote:

> Siri  wrote:
> > CComVariant varMATA("MATA");
> >
> > IDispatch* pDispMATA = NULL;
> > hr = pListOfElements->tags(varMATA,&pDispMATA);
> 
> The tag name is META, not MATA.
> 
> > IHTMLElement* pCONTENT = NULL;
> > hr = pDispMATA->QueryInterface(IID_IHTMLElement,(void**)&pCONTENT);
> 
> tags() method returns a collection, not a single tag - there may be 
> multiple meta tags. You should query for IHTMLElementCollection.
> -- 
> With best wishes,
>     Igor Tandetnik
> 
> With sufficient thrust, pigs fly just fine. However, this is not 
> necessarily a good idea. It is hard to be sure where they are going to 
> land, and it could be dangerous sitting under them as they fly 
> overhead. -- RFC 1925
> 
> 
>
date: Thu, 23 Feb 2006 08:04:33 -0800   author:   Siri

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us