ʹÓÃTWebBrowser×é¼þ±£´æÍøҳΪhtmlºÍmhtÎļþ ÊÕ²Ø
Ò»¡¢±£´æΪHTMLÎļþ
uses ActiveX;
...
procedure WB_SaveAs_HTML(WB : TWebBrowser; const FileName : string) ;
var
PersistStream: IPersistStreamInit;
Stream: IStream;
FileStream: TFileStream;
begin
if not Assigned(WB.Document) then
begin
ShowMessage('Document not loaded!') ;
Exit;
end;
PersistStream := WB.Document as IPersistStreamInit;
FileStream := TFileStream.Create(FileName, fmCreate) ;
try
Stream := TStreamAdapter.Create(FileStream, soReference) as IStream;
if Failed(PersistStream.Save(Stream, True)) then ShowMessage('SaveAs HTML fail!') ;
finally
FileStream.Free;
end;
end; (* WB_SaveAs_HTML *)
ʹÓ÷½·¨£º
WebBrowser1.Navigate('http://www.uufax.com') ;
//then save
WB_SaveAs_HTML(WebBrowser1,'c:\WebBrowser1.html') ;
¶þ¡¢Áí´æΪMHTµ¥Ò»Îļþ
us ......
ʹÓÃObjective-C½âÎöHTML»òÕßXML£¬ÏµÍ³×Ô´øÓÐÁ½ÖÖ·½Ê½Ò»¸öÊÇͨ¹ýlibxml£¬Ò»¸öÊÇͨ¹ýNSXMLParser¡£²»¹ýÕâÁ½ÖÖ·½Ê½¶¼ÐèÒª×Ô¼ºÐ´ºÜ¶à±àÂëÀ´´¦ÀíץȡÏÂÀ´µÄÄÚÈÝ£¬¶øÇÒ²»ÊǺÜÖ±¹Û¡£
ÓÐÒ»¸ö±È½ÏºÃµÄÀà¿âhpple£¬ËüÊÇÒ»¸öÇáÁ¿¼¶µÄ°ü×°¿ò¼Ü£¬¿ÉÒԺܺõĽâ¾öÕâ¸öÎÊÌâ¡£ËüÊÇÓÃXPathÀ´¶¨Î»ºÍ½âÎöHTML»òÕßXML¡£
°²×°²½Ö裺
-¼ÓÈë libxml2 µ½ÄãµÄÏîÄ¿ÖÐ
Menu Project->Edit Project Settings
ËÑË÷ “Header Search Paths”
Ìí¼ÓÐ嵀 search path “${SDKROOT}/usr/include/libxml2″
Enable recursive option
-¼ÓÈë libxml2 library µ½ÄãµÄÏîÄ¿
Menu Project->Edit Project Settings
ËÑË÷ “Other Linker Flags”
Ìí¼ÓÐ嵀 search flag “-lxml2″
-½«ÏÂÃæhppleµÄÔ´´úÂë¼ÓÈëµ½ÄãµÄÏîÄ¿ÖÐ:
HTFpple.h
HTFpple.m
HTFppleElement.h
HTFppleElement.m
XPathQuery.h
XPathQuery.m
-XPathѧϰµØÖ·http://www.w3schools.com/XPath/default.asp
ʾÀý´úÂ룺
#import "TFHpple.h"
NSData *data = [[NSData alloc] initWithContentsOfFile:@"example.html"];
// Create parser
xpathParser = [[TFHpple alloc] initWit ......
ʹÓÃObjective-C½âÎöHTML»òÕßXML£¬ÏµÍ³×Ô´øÓÐÁ½ÖÖ·½Ê½Ò»¸öÊÇͨ¹ýlibxml£¬Ò»¸öÊÇͨ¹ýNSXMLParser¡£²»¹ýÕâÁ½ÖÖ·½Ê½¶¼ÐèÒª×Ô¼ºÐ´ºÜ¶à±àÂëÀ´´¦ÀíץȡÏÂÀ´µÄÄÚÈÝ£¬¶øÇÒ²»ÊǺÜÖ±¹Û¡£
ÓÐÒ»¸ö±È½ÏºÃµÄÀà¿âhpple£¬ËüÊÇÒ»¸öÇáÁ¿¼¶µÄ°ü×°¿ò¼Ü£¬¿ÉÒԺܺõĽâ¾öÕâ¸öÎÊÌâ¡£ËüÊÇÓÃXPathÀ´¶¨Î»ºÍ½âÎöHTML»òÕßXML¡£
°²×°²½Ö裺
-¼ÓÈë libxml2 µ½ÄãµÄÏîÄ¿ÖÐ
Menu Project->Edit Project Settings
ËÑË÷ “Header Search Paths”
Ìí¼ÓÐ嵀 search path “${SDKROOT}/usr/include/libxml2″
Enable recursive option
-¼ÓÈë libxml2 library µ½ÄãµÄÏîÄ¿
Menu Project->Edit Project Settings
ËÑË÷ “Other Linker Flags”
Ìí¼ÓÐ嵀 search flag “-lxml2″
-½«ÏÂÃæhppleµÄÔ´´úÂë¼ÓÈëµ½ÄãµÄÏîÄ¿ÖÐ:
HTFpple.h
HTFpple.m
HTFppleElement.h
HTFppleElement.m
XPathQuery.h
XPathQuery.m
-XPathѧϰµØÖ·http://www.w3schools.com/XPath/default.asp
ʾÀý´úÂ룺
#import "TFHpple.h"
NSData *data = [[NSData alloc] initWithContentsOfFile:@"example.html"];
// Create parser
xpathParser = [[TFHpple alloc] initWit ......
System.Net.WebClient wc = new System.Net.WebClient();
Byte[] pageData = wc.DownloadData("httP://www");
string s = System.Text.Encoding.Default.GetString(pageData); ......
Ç°¼¸Ìì×öÏîÄ¿¡£ÐèÒªÓõ½Ò»¸öWinFormµÄHTMLµÄ±à¼ºÍÏÔʾ¿Ø¼þ¡£.NET×Ô¼º²¢Ã»ÓÐÌṩÕâ·½ÃæµÄ¿Ø¼þ¡£È¥Googel°Ù¶ÈÁËһϡ£Ã»ÓÐÕÒµ½ºÏÊʵÄ.NET¿Ø¼þ¡£ÎÞÄÎÈ¥Ó¢ÎÄGoogelÁËһϡ£¹ûÈ»·¢ÏÖÁËÒ»¿îÃûΪ£º.NET Win HTML Editor Control 3.2µÄ¿Ø¼þ¡£ÏÂÔØÅäÖû·¾³ÊÔÓ᣷¢ÏÖÃâ·Ñ°æÌṩȫ¹¦ÄÜÊÔÓá£Î¨Ò»²»ºÃµÄµØ·½¾ÍÊÇÔÚ±à¼ÇøÓÐÒ»¸ö×¢²áµÄÁ´½Ó¡£ÔÝʱ»¹Ã»·¢ÏÖÓÐÆäËûµÄÏÞÖÆ¡£
ÕûÀíÒ»ÏÂÆƽâ˼·ÈçÏ£º
1. Ê×ÏÈʹÓÃReflector·´±àÒ빤¾ß³¢ÊÔ·´±àÒë³ÌÐò¡£
2. ²éÕÒ³ÌÐòÅжÏÊÇ·ñ×¢²á»òÕßÏÔʾ·Ç×¢²á°æÏÞÖƵĴúÂë¡£
3. ʹÓÃilDasm·´±àÒëDLLΪILÎļþ¡£
4. È¥µô“ÅжÏÊÇ·ñ×¢²á”µÄ´úÂë»òÕß“ÏÔʾ·Ç×¢²á°æÏÞÖÆ”µÄ´úÂë¡£
5. ʹÓÃILasm±àÒëILÎļþΪDLL¡£
6. ʹÓÃVisualStudio±àдÀý×Ó³ÌÐò²âÊÔ¡£
±ê×¼µÄÆƽâÁ÷³Ì¡£»¹ºÃÆƽ ......
HTML ÊÇ Web ͳһÓïÑÔ£¬ÕâЩÈÝÄÉÔÚ¼âÀ¨ºÅÀïµÄ¼òµ¥±êÇ©£¬¹¹³ÉÁËÈç½ñµÄ Web¡£1991 Ä꣬Tim Berners-Lee ±àдÁËÒ»·Ý½Ð×ö “HTML ±êÇ©”µÄÎĵµ£¬ÀïÃæ°üº¬ÁË´óÔ¼20¸öÓÃÀ´±ê¼ÇÍøÒ³µÄ HTML ±êÇ©¡£ËûÖ±½Ó½èÓà SGML µÄ±ê¼Ç¸ñʽ£¬Ò²¾ÍÊǺóÀ´ÎÒÃÇ¿´µ½µÄ HTML ±ê¼ÇµÄ¸ñʽ¡£±¾ÎĽ²ÊöÁË HTML ÕâÃÅ Web ±ê¼ÇÓïÑԵķ¢Õ¹¼òÊ·¡£
´Ó IETF µ½ W3C: HTML 4 ֮·
HTML 1 ²¢²»Ôø´æÔÚ£¬HTML µÄµÚÒ»¸ö¹Ù·½°æ±¾¾ÍÊÇÓÉ IETF £¨»¥ÁªÍø¹¤³ÌÈÎÎñ×飩 ÍƳöµÄ HTML 2.0¡£ÎÊÊÀ֮ǰ£¬Õâ¸ö°æ±¾ÖеĺܶàϸÔòÒѾ±»ÊµÏÖ£¬±ÈÈ磬1994ÄêµÄ Mosaic ä¯ÀÀÆ÷ÒѾʵÏÖÁËÔÚÎĵµÖÐǶÈëͼƬµÄ·½·¨£¬ºóÀ´ HTML 2.0 ±ãÎüÄÉÁË img Õâ¸ö±êÇ©¡£
ºóÀ´£¬W3C È¡´ú IETF µÄ½ÇÉ«£¬³ÉΪ HTML µÄ±ê×¼×éÖ¯£¬1990Äê´úµÄºó°ëÒ³£¬HTML µÄ°æ±¾±»Æµ·±Ð޸ģ¬Ö±µ½1999ÄêµÄ HTML 4.01£¬ÖÁ´Ë£¬HTML µ½´ïÁËËüµÄµÚÒ»¸ö¹Õµã¡£
XHTML 1: XML ·ç¸ñµÄ HTML
HTML ÔÚ HTML 4.01 Ö®ºóµÄµÚÒ»¸öÐÞ¶©°æ±¾¾ÍÊÇ XHTML 1.0£¬ÆäÖÐ X ´ú±í “eXtensible” £¬À©Õ¹£¬µ±È»Ò²ÓÐÈ˽«Ö®½â¶ÁΪ “eXtreme”£¬¼«¶Ë¡£XHTML 1.0 ÊÇ»ùÓÚ HTML 4.01 µÄ£¬²¢Ã»ÓÐÒýÈëÈκÎбêÇ©»òÊôÐÔ£¬Î¨Ò»µÄÇø±ðÊÇÓï·¨£¬HTML ¶ÔÓï·¨±È½ÏËæ±ã£¬¶ø XHTML ÔòÒªÇó ......
ÈçºÎÓÐÒ»¸ö×Ö·û´®ÊÇÕâÑùµÄÐÎʽstr = "&bbbLAA";
ÏëµÃµ½"L"µÄ»°¿ÉÒÔÕâÑùȥʵÏÖ£º
//sDataStr = "&bbbLAA";
//sLeftQuote = ""&bbb";
//sRightQuote = "&AA";
µ÷ÓÃÕâ¸ö·½·¨½«µÃµ½L×ֶΡ£
function abCutString( sDataStr, sLeftQuote, sRightQuote)
{
var sReturnVal = '';
var nStartPos = sDataStr.indexOf(sLeftQuote) ;
if (nStartPos < 0) return sReturnVal;
nStartPos += sLeftQuote.length ;
if (nStartPos >=0 ) {
var sWorkStr = sDataStr.substring( nStartPos , sDataStr.length );
var nEndPos = sWorkStr.indexOf(sRightQuote) //- sRightQuote.length + 1;
if ( nEndPos >= 1 ) {
sReturnVal = sWorkStr.substring( 0 , nEndPos );
}
}
return sReturnVal ;
}
......