Re: SGML comments need a fix?

>Don't know if this is an old issue...

It is.


>I just noticed LineMode and Arena (old copy though) do not support
>the <!-- this is an sgml comment with <tags> inside --> type of comments.
>
>Shouldn't they? Will they?

Of course they should support SGML markup declarations! The bug is
in the so-called "SGML-Parser" (which isn't really one) in the
libwww. I once hacked together a fix for some former version of the
library (see below). I don't if it still works on the current one
but it may be worth a try.

Best regards
Rainer Klute

  Dipl.-Inform. Rainer Klute        NADS - Advertising on nets
  NADS GmbH
  Emil-Figge-Str. 80                Tel.: +49 231 9742570
D-44227 Dortmund                    Fax:  +49 231 9742571

            <http://www.nads.de/~klute/>



--- 1.1	1994/09/14 07:58:49
+++ HTML.c	1994/09/14 08:03:36
@@ -699,6 +699,17 @@
 }
 
 
+/*		Handling markup declarations
+**		----------------------------
+*/
+
+PRIVATE void HTML_put_declaration ARGS2(HTStructured *, me,
+					char *, declaration)
+{
+    /* Just ignore markup declarations */
+}
+
+
 /*	Free an HTML object
 **	-------------------
 **
@@ -779,7 +790,8 @@
 	HTML_abort,
 	HTML_put_character, 	HTML_put_string,  HTML_write,
 	HTML_start_element, 	HTML_end_element,
-	HTML_put_entity
+	HTML_put_entity,
+	HTML_put_declaration
 }; 
 
 
--- 1.1	1994/09/13 20:49:06
+++ HTMLGen.c	1994/09/13 20:52:45
@@ -340,6 +340,21 @@
 }
 
 
+/*      SGML markup declaration
+**	-----------------------
+**
+*/
+
+PRIVATE void HTMLGen_put_declaration ARGS2(HTStructured *, me,
+					   char *, declaration)
+{
+    HTMLGen_output_character (me, '<');
+    HTMLGen_output_character (me, '!');
+    HTMLGen_output_string (me, declaration);
+    HTMLGen_output_character(me, '>');
+}
+
+
 
 /*	Free an object
 **	--------------
@@ -387,7 +402,8 @@
 	HTMLGen_abort,
 	HTMLGen_put_character, 	HTMLGen_put_string, HTMLGen_write,
 	HTMLGen_start_element,	HTMLGen_end_element,
-	HTMLGen_put_entity
+	HTMLGen_put_entity,
+	HTMLGen_put_declaration
 }; 
 
 
--- 1.1	1994/07/26 12:46:45
+++ HTTeXGen.c	1994/09/14 08:11:58
@@ -410,6 +410,17 @@
 }
 
 
+/*		Handling markup declarations
+**		----------------------------
+*/
+
+PRIVATE void HTTeXGen_put_declaration ARGS2(HTStructured *, me,
+					char *, declaration)
+{
+    /* Just ignore markup declarations */
+}
+
+
 
 /*	Free an HTML object
 **	-------------------
@@ -441,7 +452,8 @@
 	HTTeXGen_abort,
 	HTTeXGen_put_character,        	HTTeXGen_put_string,	HTTeXGen_write,
 	HTTeXGen_start_element, 	HTTeXGen_end_element,
-	HTTeXGen_put_entity
+	HTTeXGen_put_entity,
+	HTTeXGen_put_declaration
 }; 
 
 
--- 1.1	1994/09/13 18:54:41
+++ SGML.c	1994/09/13 21:17:05
@@ -58,6 +58,7 @@
 		S_attr, S_attr_gap, S_equals, S_value, S_after_open,
 		S_nl, S_nl_tago,
 		S_ero, S_cro,
+		S_mdo, S_mdecl,
 #ifdef ISO_2022_JP
  		S_esc, S_dollar, S_paren, S_nonascii_text,
 #endif
@@ -538,14 +539,20 @@
 
 	if (isalnum(c))
 	    HTChunkPutc(string, c);
-	else {				/* End of tag name */
+	else {				
 	    HTTag * t;
-	    if (c=='/') {
+	    if (c=='/') {               /* End of tag name */
 		if (TRACE) if (string->size!=0)
 		    fprintf(stderr,"SGML:  `<%s/' found!\n", string->data);
 		context->state = S_end;
 		break;
 	    }
+	    if (c=='!') {               /* Declaration */
+		if (TRACE)
+		    fprintf (stderr,"SGML:  `<!' found!\n");
+		context->state = S_mdo;
+		break;
+	    }
 	    HTChunkTerminate(string) ;
 
 	    t = SGMLFindTag(dtd, string->data);
@@ -577,7 +584,27 @@
 	}
 	break;
 
-		
+
+/*      Markup declaration
+*/
+    case S_mdo:
+        string->size = 0;
+	context->state = S_mdecl;
+
+    case S_mdecl:               /* Expecting declaration text or > */
+	if (c == '>')   /* End of markup declaration */
+	{
+	    HTChunkTerminate (string);
+	    (*context->actions->put_declarations) (context->target,
+						   string->data);
+	    context->state = S_text;
+	    break;
+	};
+	HTChunkPutc(string, c);
+	break;
+
+	
+   				/* accumulating value */
     case S_tag_gap:		/* Expecting attribute or > */
 	if (WHITE(c)) break;	/* Gap between attributes */
 	if (c=='>') {		/* End of tag */
--- 1.1	1994/09/13 21:05:04
+++ SGML.h	1994/09/13 21:05:37
@@ -149,6 +149,10 @@
                 HTStructured*   me,
                 int             entity_number));
                 
+        void (*put_declarations) PARAMS((
+                HTStructured*   me,
+                char *          declaration));
+                
 }HTStructuredClass;
 
 /*

Received on Tuesday, 9 May 1995 03:08:10 UTC