home *** CD-ROM | disk | FTP | other *** search
- { =============================================================================
- Copyright 1995 by Potomac Software, Inc. Use of this material is subject to
- the terms and conditions of the software license agreement.
-
- HTMLPADP.PAS: Contains Delphi declarations for WebLib (TM).
- ============================================================================== }
-
- unit Htmlpars;
-
- { ========== INTERFACE ========== }
-
- interface
- uses WinTypes;
-
- { ========== Numeric identifiers for each HTML tag (tool developer note: these must
- remain in sync with internal lists stored in the DLL). ========== }
-
- const
- HTML_INVALID = $0;
- HTML_COMMENT = $1000;
-
- { ========== Text style bits, returned by GetTextAttr ========== }
-
- const
- HTML_BOLD = $0000001; { <B> (HTML 2.0) }
- HTML_ITALIC = $0000002; { <I> }
- HTML_UNDERLINE = $0000004; { <U> }
- HTML_EMPHASIS = $0000008; { <EM> }
- HTML_STRONG = $0000010; { <STRONG> }
- HTML_CITE = $0000020; { <CITE> }
- HTML_CODE = $0000040; { <CODE> }
- HTML_KEYBOARD = $0000080; { <KBD> }
- HTML_SAMPLE = $0000100; { <SAMP> }
- HTML_STRIKE = $0000200; { <STRIKE> }
- HTML_VARIABLE = $0000400; { <VAR> }
- HTML_TYPEWRITER = $0000800; { <TT> }
- HTML_LISTING = $0001000; { <LISTING> }
- HTML_EXAMPLE = $0002000; { <XMP> }
- HTML_PLAINTEXT = $0004000; { <PLAINTEXT> }
- HTML_ARGUMENT = $0008000; { <ARG> (HTML+) }
- HTML_DEFINE = $0010000; { <DFN> }
- HTML_ABBREV = $0020000; { <ABBREV> }
- HTML_COMMAND = $0040000; { <CMD> }
- HTML_ACRONYM = $0080000; { <ACRONYM> }
- HTML_PERSON = $0100000; { <PERSON> }
- HTML_QUOTATION = $0200000; { <Q> }
- HTML_STRIKETHRU = $0400000; { <S> }
- HTML_SUBSCRIPT = $0800000; { <SUB> }
- HTML_SUPERSCRIPT = $1000000; { <SUP> }
- HTML_BLINK = $2000000; { <BLINK> (Netscape) }
-
- { ========== Empty tags, returned by GetTagType ========== }
-
- const
- HTML_BASE = 1; { <BASE> (HTML 2.0) }
- HTML_ISINDEX = 2; { <ISINDEX> }
- HTML_LINK = 3; { <LINK> }
- HTML_NEXTID = 4; { <NEXTID> }
- HTML_META = 5; { <META> }
- HTML_BR = 6; { <BR> }
- HTML_DD = 7; { <DD> }
- HTML_DT = 8; { <DT> }
- HTML_HR = 9; { <HR> }
- HTML_IMG = 10; { <IMG> }
- HTML_LI = 11; { <LI> }
- HTML_P = 12; { <P> }
- HTML_SELECT = 13; { <SELECT> }
- HTML_INPUT = 14; { <INPUT> }
- HTML_TEXTAREA = 15; { <TEXTAREA> }
- HTML_OPTION = 16; { <OPTION> }
- HTML_TD = 17; { <TD> (HTML+) }
- HTML_TH = 18; { <TH> }
- HTML_TR = 19; { <TR> }
- HTML_RENDER = 20; { <RENDER> }
- HTML_NOBR = 21; { <NOBR> (Netscape) }
- HTML_WBR = 22; { <WBR> }
- HTML_BASEFONT = 23; { <BASEFONT> }
-
- { ========== Container Tags, returned by GetTagType ========== }
-
- const
- HTML_HTML = 257; { <HTML> (HTML 2.0) }
- HTML_HEAD = 258; { <HEAD> }
- HTML_TITLE = 259; { <TITLE> }
- HTML_A = 260; { <A> }
- HTML_ADDRESS = 261; { <ADDRESS> }
- HTML_BLOCKQUOTE = 262; { <BLOCKQUOTE> }
- HTML_BODY = 263; { <BODY> }
- HTML_DIR = 264; { <DIR> }
- HTML_DL = 265; { <DL> }
- HTML_H1 = 266; { <H1> }
- HTML_H2 = 267; { <H2> }
- HTML_H3 = 268; { <H3> }
- HTML_H4 = 269; { <H4> }
- HTML_H5 = 270; { <H5> }
- HTML_H6 = 271; { <H6> }
- HTML_MENU = 272; { <MENU> }
- HTML_OL = 273; { <OL> }
- HTML_PRE = 274; { <PRE> }
- HTML_UL = 275; { <UL> }
- HTML_FORM = 276; { <FORM> }
- HTML_TABLE = 277; { <TABLE> (HTML+) }
- HTML_CAPTION = 278; { <CAPTION> }
- HTML_ABSTRACT = 279; { <ABSTRACT> }
- HTML_FIG = 280; { <FIG> }
- HTML_FOOTNOTE = 281; { <FOOTNOTE> }
- HTML_LIT = 282; { <LIT> }
- HTML_MARGIN = 283; { <MARGIN> }
- HTML_MATH = 284; { <MATH> }
- HTML_ONLINE = 285; { <ONLINE> }
- HTML_PRINTED = 286; { <PRINTED> }
- HTML_NOTE = 287; { <NOTE> }
- HTML_FONT = 288; { <FONT> (Netscape) }
- HTML_CENTER = 289; { <CENTER> }
-
- { ========== Flags for ParseFile and ParseBuf ========== }
-
- const
- WL_KEEPATTRIBUTETAG = $1;
- WL_KEEPCLOSINGTAG = $2;
-
- { ========== Flags for GetSibling ========== }
-
- const
- WL_FIRSTELEM = $1;
- WL_NEXTELEM = $2;
- WL_PREVELEM = $3;
- WL_LASTELEM = $4;
-
- { ========== Flag for GetChild, Find and FindEnum to obtain root of parse tree ========== }
-
- const
- WL_ROOTELEMENT = 0;
-
- { ========== Flags for GetElementType ========== }
-
- const
- WL_ROOT = $0;
- WL_TAG = $1;
- WL_SPECIALCHAR = $2;
- WL_COMMENT = $3;
- WL_TEXT = $4;
-
- { ========== Flags for GetTagAttrInfo ========== }
-
- const
- WL_WORD = $1;
- WL_QUOTEDSTRING = $2;
- WL_NUMBER = $3;
- WL_STANDALONE = $4;
-
- { ========== Flags for EnumFindText, EnumFindSpecial, EnumFindComment & EnumFindTagName === }
-
- const
- WL_ENUMERATEALL = 0;
-
- { ========== Pre-defined enumeration notification messages included for convenience ===== }
-
- const
- WM_WEBLIB_ENUMPARSETREE = 2001;
- WM_WEBLIB_ENUMFINDTEXT = 2002;
- WM_WEBLIB_ENUMFINDSPEC = 2003;
- WM_WEBLIB_ENUMFINDCOMM = 2004;
- WM_WEBLIB_ENUMFINDTAGTYPE = 2005;
- WM_WEBLIB_ENUMFINDTAGNAME = 2006;
- WM_WEBLIB_ENUMFINDTAGATTR = 2007;
-
- { ========== Handles ========== }
-
- type
- HPARSE = THandle;
- HELEMENT = LongInt;
- HTAGATTR = LongInt;
-
- { ========== HTML API ========== }
-
- function WLHtmlParseFile(lpszFilename: PChar;
- wOptions: Word) : HPARSE; far;
-
- function WLHtmlParseBuf(lpszBuf: PChar;
- cbBuf: LongInt;
- wOptions: Word) : HPARSE; far;
-
- function WLHtmlEndParse(hParse: HPARSE) : Bool; far;
-
- function WLHtmlEnumParseTree(hParse: HPARSE;
- hwndNotify: HWnd;
- nMsg: Word) : Bool; far;
-
- function WLHtmlGetChild(hParse: HPARSE;
- hElement: HELEMENT) : HELEMENT; far;
-
- function WLHtmlGetParent(hParse: HPARSE;
- hElement: HELEMENT) : HELEMENT; far;
-
- function WLHtmlGetSibling(hParse: HPARSE;
- hElement: HELEMENT;
- wRel: Word) : HELEMENT; far;
-
- function WLHtmlGetElementType(hParse: HPARSE;
- hElement: HELEMENT) : Word; far;
-
- function WLHtmlGetElementText(hParse: HPARSE;
- hElement: HELEMENT) : pChar; far;
-
- function WLHtmlGetTextAttr(hParse: HPARSE;
- hElement: HELEMENT) : LongInt; far;
-
- function WLHtmlGetTagName(hParse: HPARSE;
- hElement: HELEMENT) : PChar; far;
-
- function WLHtmlGetTagType(hParse: HPARSE;
- hElement: HELEMENT) : Word; far;
-
- function WLHtmlGetTagAttr(hParse: HPARSE;
- hElement: HELEMENT;
- hTagAttr: HTAGATTR;
- var wType: Word;
- lpszAttr: PChar;
- cbAttr: Word;
- lpszValue: PChar;
- cbValue: Word) : HTAGATTR; far;
-
- function WLHtmlExtractTagAttr(hParse: HPARSE;
- hElement: HELEMENT;
- lpszAttr: pChar) : pChar; far;
-
- function WLHtmlFindText(hParse: HPARSE;
- hElement: HELEMENT;
- lpszText: PChar) : HELEMENT; far;
-
- function WLHtmlFindSpecial(hParse: HPARSE;
- hElement: HELEMENT;
- lpszSpecial: PChar) : HELEMENT; far;
-
- function WLHtmlFindComment(hParse: HPARSE;
- hElement: HELEMENT;
- lpszCommentText: PChar) : HELEMENT; far;
-
- function WLHtmlFindTagType(hParse: HPARSE;
- hElement: HELEMENT;
- nType: Word) : HELEMENT; far;
-
- function WLHtmlFindTagName(hParse: HPARSE;
- hElement: HELEMENT;
- lpszTag: PChar) : HELEMENT; far;
-
- function WLHtmlFindTagAttr(hParse: HPARSE;
- hElement: HELEMENT;
- nType: Word;
- lpszAttr: PChar;
- lpszValue: PChar) : HELEMENT; far;
-
- function WLHtmlEnumFindText(hParse: HPARSE;
- hElement: HELEMENT;
- lpszText: PChar;
- hwndNotify: HWnd;
- nMsg: Word) : Bool; far;
-
- function WLHtmlEnumFindSpecial(hParse: HPARSE;
- hElement: HELEMENT;
- lpszSpecial: PChar;
- hwndNotify: HWnd;
- nMsg: Word) : Bool; far;
-
- function WLHtmlEnumFindComment(hParse: HPARSE;
- hElement: HELEMENT;
- lpszCommentText: PChar;
- hwndNotify: HWnd;
- nMsg: Word) : Bool; far;
-
- function WLHtmlEnumFindTagType(hParse: HPARSE;
- hElement: HELEMENT;
- nType: Word;
- hwndNotify: HWnd;
- nMsg: Word) : Bool; far;
-
- function WLHtmlEnumFindTagName(hParse: HPARSE;
- hElement: HELEMENT;
- lpszTag: PChar;
- hwndNotify: HWnd;
- nMsg: Word) : Bool; far;
-
- function WLHtmlEnumFindTagAttr(hParse: HPARSE;
- hElement: HELEMENT;
- nType: Word;
- lpszAttr: PChar;
- lpszValueText: PChar;
- hwndNotify: HWnd;
- nMsg: Word) : Bool; far;
-
- { ========== Utility function to parse URL ========== }
-
- function WLParseAbsoluteURL(lpszURL: PChar;
- lpszProtocol: PChar;
- cbProtocol: Word;
- lpszHost: PChar;
- cbHost: Word;
- var nPort: Word;
- lpszPath: PChar;
- cbPath: Word) : Bool; far;
-
- { ========== IMPLEMENTATION ========== }
-
- implementation
-
- function WLHtmlParseFile; external 'HTMLPARS';
- function WLHtmlParseBuf; external 'HTMLPARS';
- function WLHtmlEndParse; external 'HTMLPARS';
- function WLHtmlEnumParseTree; external 'HTMLPARS';
- function WLHtmlGetChild; external 'HTMLPARS';
- function WLHtmlGetParent; external 'HTMLPARS';
- function WLHtmlGetSibling; external 'HTMLPARS';
- function WLHtmlGetElementType; external 'HTMLPARS';
- function WLHtmlGetElementText; external 'HTMLPARS';
- function WLHtmlGetTextAttr; external 'HTMLPARS';
- function WLHtmlGetTagName; external 'HTMLPARS';
- function WLHtmlGetTagType; external 'HTMLPARS';
- function WLHtmlGetTagAttr; external 'HTMLPARS';
- function WLHtmlExtractTagAttr; external 'HTMLPARS';
- function WLHtmlFindText; external 'HTMLPARS';
- function WLHtmlFindSpecial; external 'HTMLPARS';
- function WLHtmlFindComment; external 'HTMLPARS';
- function WLHtmlFindTagType; external 'HTMLPARS';
- function WLHtmlFindTagName; external 'HTMLPARS';
- function WLHtmlFindTagAttr; external 'HTMLPARS';
- function WLHtmlEnumFindText; external 'HTMLPARS';
- function WLHtmlEnumFindSpecial; external 'HTMLPARS';
- function WLHtmlEnumFindComment; external 'HTMLPARS';
- function WLHtmlEnumFindTagType; external 'HTMLPARS';
- function WLHtmlEnumFindTagName; external 'HTMLPARS';
- function WLHtmlEnumFindTagAttr; external 'HTMLPARS';
- function WLParseAbsoluteURL; external 'HTMLPARS';
-
- end.
-