Skip to content

Commit

Permalink
* Fixed handling of plain <!DOCTYPE type>
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Wielemaker committed Mar 15, 2001
1 parent 953c2a6 commit 3ead495
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* FIXED: Proper handling of plain <!DOCTYPE doc>

* FIXED: Various issues in attribute handling with new routines supplied
by Richard O'Keefe. Added shorttag(Bool) to options you can set.

Expand Down
26 changes: 14 additions & 12 deletions parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -3230,32 +3230,34 @@ process_doctype(dtd_parser *p, const ichar *decl, const ichar *decl0)
{ dtd *dtd = p->dtd;
dtd_symbol *id;
const ichar *s;
dtd_entity *et = sgml_calloc(1, sizeof(*et));
dtd_entity *et = NULL;

if ( !(s=itake_name(dtd, decl, &id)) )
return gripe(ERC_SYNTAX_ERROR, "Name expected", decl);
decl = s;
et->name = id;

if ( (s=isee_identifier(dtd, decl, "system")) )
{ et = sgml_calloc(1, sizeof(*et));
et->type = ET_SYSTEM;
else if ( (s=isee_identifier(dtd, decl, "public")) )
} else if ( (s=isee_identifier(dtd, decl, "public")) )
{ et = sgml_calloc(1, sizeof(*et));
et->type = ET_PUBLIC;
else
goto local;
decl = s;
}

if ( !(s=process_entity_value_declaration(p, decl, et)) )
return FALSE;
decl = s;
if ( et )
{ et->name = id;
if ( !(s=process_entity_value_declaration(p, s, et)) )
return FALSE;
decl = s;
}

if ( !dtd->doctype ) /* i.e. anonymous DTD */
{ const char *file;
dtd_parser *clone;

dtd->doctype = istrdup(id->name); /* Fill it */
if ( !(file=find_in_catalog("DOCTYPE", dtd->doctype)) &&
!(file=entity_file(dtd, et)) )
!(et && (file=entity_file(dtd, et))) )
{ gripe(ERC_EXISTENCE, "DTD", dtd->doctype);
} else
{ clone = clone_dtd_parser(p);
Expand All @@ -3265,9 +3267,9 @@ process_doctype(dtd_parser *p, const ichar *decl, const ichar *decl0)
}
}

free_entity_list(et);
if ( et )
free_entity_list(et);

local:
if ( (s=isee_func(dtd, decl, CF_DSO)) ) /* [...] */
{ int grouplevel = 1;
data_mode oldmode = p->dmode;
Expand Down

0 comments on commit 3ead495

Please sign in to comment.