|
@@ -12,36 +12,39 @@
|
|
|
|
|
|
{$IFDEF LIBXML_HTML_ENABLED}
|
|
|
|
|
|
-{$IFDEF TYPE_}
|
|
|
+{$IFDEF POINTER}
|
|
|
+ htmlElemDescPtr = ^htmlElemDesc;
|
|
|
+ htmlEntityDescPtr = ^htmlEntityDesc;
|
|
|
+{$ENDIF}
|
|
|
+
|
|
|
+{$IFDEF TYPE}
|
|
|
(*
|
|
|
* Most of the back-end structures from XML and HTML are shared.
|
|
|
*)
|
|
|
-typedef xmlParserCtxt htmlParserCtxt;
|
|
|
-typedef xmlParserCtxtPtr htmlParserCtxtPtr;
|
|
|
-typedef xmlParserNodeInfo htmlParserNodeInfo;
|
|
|
-typedef xmlSAXHandler htmlSAXHandler;
|
|
|
-typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;
|
|
|
-typedef xmlParserInput htmlParserInput;
|
|
|
-typedef xmlParserInputPtr htmlParserInputPtr;
|
|
|
-typedef xmlDocPtr htmlDocPtr;
|
|
|
-typedef xmlNodePtr htmlNodePtr;
|
|
|
+ htmlParserCtxt = xmlParserCtxt;
|
|
|
+ htmlParserCtxtPtr = xmlParserCtxtPtr;
|
|
|
+ htmlParserNodeInfo = xmlParserNodeInfo;
|
|
|
+ htmlSAXHandler = xmlSAXHandler;
|
|
|
+ htmlSAXHandlerPtr = xmlSAXHandlerPtr;
|
|
|
+ htmlParserInput = xmlParserInput;
|
|
|
+ htmlParserInputPtr = xmlParserInputPtr;
|
|
|
+ htmlDocPtr = xmlDocPtr;
|
|
|
+ htmlNodePtr = xmlNodePtr;
|
|
|
|
|
|
(*
|
|
|
* Internal description of an HTML element, representing HTML 4.01
|
|
|
* and XHTML 1.0 (which share the same structure).
|
|
|
*)
|
|
|
-typedef struct _htmlElemDesc htmlElemDesc;
|
|
|
-typedef htmlElemDesc *htmlElemDescPtr;
|
|
|
-struct _htmlElemDesc {
|
|
|
- char *name; (* The tag name *)
|
|
|
- char startTag; (* Whether the start tag can be implied *)
|
|
|
- char endTag; (* Whether the end tag can be implied *)
|
|
|
- char saveEndTag; (* Whether the end tag should be saved *)
|
|
|
- char empty; (* Is this an empty element ? *)
|
|
|
- char depr; (* Is this a deprecated element ? *)
|
|
|
- char dtd; (* 1: only in Loose DTD, 2: only Frameset one *)
|
|
|
- char isinline; (* is this a block 0 or inline 1 element *)
|
|
|
- char *desc; (* the description *)
|
|
|
+ htmlElemDesc = record
|
|
|
+ name : pchar; (* The tag name *)
|
|
|
+ startTag : char; (* Whether the start tag can be implied *)
|
|
|
+ endTag : char; (* Whether the end tag can be implied *)
|
|
|
+ saveEndTag : char; (* Whether the end tag should be saved *)
|
|
|
+ empty : char; (* Is this an empty element ? *)
|
|
|
+ depr : char; (* Is this a deprecated element ? *)
|
|
|
+ dtd : char; (* 1: only in Loose DTD, 2: only Frameset one *)
|
|
|
+ isinline : char; (* is this a block 0 or inline 1 element *)
|
|
|
+ desc : pchar; (* the description *)
|
|
|
|
|
|
(* NRK Jan.2003
|
|
|
* New fields encapsulating HTML structure
|
|
@@ -53,24 +56,22 @@ struct _htmlElemDesc {
|
|
|
* are allowed. Some element relationships are not fully represented:
|
|
|
* these are flagged with the word MODIFIER
|
|
|
*)
|
|
|
- char** subelts; (* allowed sub-elements of this element *)
|
|
|
- char* defaultsubelt; (* subelement for suggested auto-repair
|
|
|
+ subelts : ppchar; (* allowed sub-elements of this element *)
|
|
|
+ defaultsubelt : pchar; (* subelement for suggested auto-repair
|
|
|
if necessary or NULL *)
|
|
|
- char** attrs_opt; (* Optional Attributes *)
|
|
|
- char** attrs_depr; (* Additional deprecated attributes *)
|
|
|
- char** attrs_req; (* Required attributes *)
|
|
|
-};
|
|
|
+ attrs_opt : ppchar; (* Optional Attributes *)
|
|
|
+ attrs_depr : ppchar; (* Additional deprecated attributes *)
|
|
|
+ attrs_req : ppchar; (* Required attributes *)
|
|
|
+ end;
|
|
|
|
|
|
(*
|
|
|
* Internal description of an HTML entity.
|
|
|
*)
|
|
|
-typedef struct _htmlEntityDesc htmlEntityDesc;
|
|
|
-typedef htmlEntityDesc *htmlEntityDescPtr;
|
|
|
-struct _htmlEntityDesc {
|
|
|
- unsigned int value; (* the UNICODE value for the character *)
|
|
|
- char *name; (* The entity name *)
|
|
|
- char *desc; (* the description *)
|
|
|
-};
|
|
|
+ htmlEntityDesc = record
|
|
|
+ value : cuint; (* the UNICODE value for the character *)
|
|
|
+ name : pchar; (* The entity name *)
|
|
|
+ desc : pchar; (* the description *)
|
|
|
+ end;
|
|
|
{$ENDIF}
|
|
|
|
|
|
{$IFDEF FUNCTION_}
|
|
@@ -159,7 +160,12 @@ XMLPUBFUN int XMLCALL
|
|
|
|
|
|
XMLPUBFUN void XMLCALL
|
|
|
htmlFreeParserCtxt (htmlParserCtxtPtr ctxt);
|
|
|
+{$ENDIF}
|
|
|
|
|
|
+{$IFDEF TYPE}
|
|
|
+ htmlParserOption = type cint;
|
|
|
+{$ENDIF}
|
|
|
+{$IFDEF CONST}
|
|
|
(*
|
|
|
* New set of simpler/more flexible APIs
|
|
|
*)
|
|
@@ -169,16 +175,16 @@ XMLPUBFUN void XMLCALL
|
|
|
* This is the set of XML parser options that can be passed down
|
|
|
* to the xmlReadDoc() and similar calls.
|
|
|
*)
|
|
|
-typedef enum {
|
|
|
- HTML_PARSE_RECOVER = 1<<0, (* Relaxed parsing *)
|
|
|
- HTML_PARSE_NOERROR = 1<<5, (* suppress error reports *)
|
|
|
- HTML_PARSE_NOWARNING= 1<<6, (* suppress warning reports *)
|
|
|
- HTML_PARSE_PEDANTIC = 1<<7, (* pedantic error reporting *)
|
|
|
- HTML_PARSE_NOBLANKS = 1<<8, (* remove blank nodes *)
|
|
|
- HTML_PARSE_NONET = 1<<11,(* Forbid network access *)
|
|
|
- HTML_PARSE_COMPACT = 1<<16 (* compact small text nodes *)
|
|
|
-} htmlParserOption;
|
|
|
+ HTML_PARSE_RECOVER = 1 shl 0; (* Relaxed parsing *)
|
|
|
+ HTML_PARSE_NOERROR = 1 shl 5; (* suppress error reports *)
|
|
|
+ HTML_PARSE_NOWARNING= 1 shl 6; (* suppress warning reports *)
|
|
|
+ HTML_PARSE_PEDANTIC = 1 shl 7; (* pedantic error reporting *)
|
|
|
+ HTML_PARSE_NOBLANKS = 1 shl 8; (* remove blank nodes *)
|
|
|
+ HTML_PARSE_NONET = 1 shl 11;(* Forbid network access *)
|
|
|
+ HTML_PARSE_COMPACT = 1 shl 16; (* compact small text nodes *)
|
|
|
+{$ENDIF}
|
|
|
|
|
|
+{$IFDEF FUNCTION_}
|
|
|
XMLPUBFUN void XMLCALL
|
|
|
htmlCtxtReset (htmlParserCtxtPtr ctxt);
|
|
|
XMLPUBFUN int XMLCALL
|
|
@@ -243,31 +249,38 @@ XMLPUBFUN htmlDocPtr XMLCALL
|
|
|
char *URL,
|
|
|
char *encoding,
|
|
|
int options);
|
|
|
+{$ENDIF}
|
|
|
|
|
|
+{$IFDEF TYPE}
|
|
|
+ htmlStatus = type cint;
|
|
|
+{$ENDIF}
|
|
|
+{$IFDEF CONST}
|
|
|
(* NRK/Jan2003: further knowledge of HTML structure
|
|
|
*)
|
|
|
-typedef enum {
|
|
|
- HTML_NA = 0 , (* something we don't check at all *)
|
|
|
- HTML_INVALID = 0x1 ,
|
|
|
- HTML_DEPRECATED = 0x2 ,
|
|
|
- HTML_VALID = 0x4 ,
|
|
|
- HTML_REQUIRED = 0xc (* VALID bit set so ( & HTML_VALID ) is TRUE *)
|
|
|
-} htmlStatus ;
|
|
|
+ HTML_NA = $0; (* something we don't check at all *)
|
|
|
+ HTML_INVALID = $1;
|
|
|
+ HTML_DEPRECATED = $2;
|
|
|
+ HTML_VALID = $4;
|
|
|
+ HTML_REQUIRED = $c; (* VALID bit set so ( & HTML_VALID ) is TRUE *)
|
|
|
+{$ENDIF}
|
|
|
|
|
|
+{$IFDEF FUNCTION}
|
|
|
(* Using htmlElemDesc rather than name here, to emphasise the fact
|
|
|
that otherwise there's a lookup overhead
|
|
|
*)
|
|
|
-XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(htmlElemDesc*, xmlChar*, int) ;
|
|
|
-XMLPUBFUN int XMLCALL htmlElementAllowedHere(htmlElemDesc*, xmlChar*) ;
|
|
|
-XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(htmlElemDesc*, htmlElemDesc*) ;
|
|
|
-XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(htmlNodePtr, int) ;
|
|
|
+function htmlAttrAllowed(desc: htmlElemDescPtr; str: xmlCharPtr; val: cint): htmlStatus; XMLCALL; XMLPUBFUN;
|
|
|
+function htmlElementAllowedHere(desc: htmlElemDescPtr; str: xmlCharPtr): cint; XMLCALL; XMLPUBFUN;
|
|
|
+function htmlAttrAllowed(desc1, desc2: htmlElemDescPtr): htmlStatus; XMLCALL; XMLPUBFUN;
|
|
|
+function htmlNodeStatus(node: htmlNodePtr; val: cint): htmlStatus; XMLCALL; XMLPUBFUN;
|
|
|
+
|
|
|
(**
|
|
|
* htmlDefaultSubelement:
|
|
|
* @elt: HTML element
|
|
|
*
|
|
|
* Returns the default subelement for this element
|
|
|
*)
|
|
|
-#define htmlDefaultSubelement(elt) elt->defaultsubelt
|
|
|
+//#define htmlDefaultSubelement(elt) elt->defaultsubelt
|
|
|
+
|
|
|
(**
|
|
|
* htmlElementAllowedHereDesc:
|
|
|
* @parent: HTML parent element
|
|
@@ -278,15 +291,16 @@ XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(htmlNodePtr, int) ;
|
|
|
*
|
|
|
* Returns 1 if allowed; 0 otherwise.
|
|
|
*)
|
|
|
-#define htmlElementAllowedHereDesc(parent,elt) \
|
|
|
- htmlElementAllowedHere((parent), (elt)->name)
|
|
|
+{#define htmlElementAllowedHereDesc(parent,elt) \
|
|
|
+ htmlElementAllowedHere((parent), (elt)->name)}
|
|
|
+
|
|
|
(**
|
|
|
* htmlRequiredAttrs:
|
|
|
* @elt: HTML element
|
|
|
*
|
|
|
* Returns the attributes required for the specified element.
|
|
|
*)
|
|
|
-#define htmlRequiredAttrs(elt) (elt)->attrs_req
|
|
|
+{#define htmlRequiredAttrs(elt) (elt)->attrs_req}
|
|
|
{$ENDIF}
|
|
|
|
|
|
{$ENDIF} (* LIBXML_HTML_ENABLED *)
|