Diff for /XML/HTMLparser.c between versions 1.25 and 1.26

version 1.25, 1999/12/01 18:58:39 version 1.26, 1999/12/10 18:18:57
Line 120  PUSH_AND_POP(xmlChar*, name) Line 120  PUSH_AND_POP(xmlChar*, name)
   
 #define CUR (*ctxt->input->cur)  #define CUR (*ctxt->input->cur)
 #define UPPER (toupper(*ctxt->input->cur))  #define UPPER (toupper(*ctxt->input->cur))
 #define SKIP(val) ctxt->input->cur += (val)  #define SKIP(val) ctxt->nbChars += (val),ctxt->input->cur += (val)
 #define NXT(val) ctxt->input->cur[(val)]  #define NXT(val) ctxt->input->cur[(val)]
 #define UPP(val) (toupper(ctxt->input->cur[(val)]))  #define UPP(val) (toupper(ctxt->input->cur[(val)]))
 #define CUR_PTR ctxt->input->cur  #define CUR_PTR ctxt->input->cur
Line 141  PUSH_AND_POP(xmlChar*, name) Line 141  PUSH_AND_POP(xmlChar*, name)
             ctxt->input->line++; ctxt->input->col = 1;                  \              ctxt->input->line++; ctxt->input->col = 1;                  \
         } else ctxt->input->col++;                                      \          } else ctxt->input->col++;                                      \
         ctxt->input->cur++;                                             \          ctxt->input->cur++;                                             \
           ctxt->nbChars++;                                                \
         if (*ctxt->input->cur == 0)                                     \          if (*ctxt->input->cur == 0)                                     \
             xmlParserInputGrow(ctxt->input, INPUT_CHUNK);               \              xmlParserInputGrow(ctxt->input, INPUT_CHUNK);               \
     }}      }}
Line 181  PUSH_AND_POP(xmlChar*, name) Line 182  PUSH_AND_POP(xmlChar*, name)
  * Name,Start Tag,End Tag,  Empty,  Depr.,    DTD, Description   * Name,Start Tag,End Tag,  Empty,  Depr.,    DTD, Description
  */   */
 htmlElemDesc  html40ElementTable[] = {  htmlElemDesc  html40ElementTable[] = {
 { "A",          0,      0,      0,      0,      0, "anchor " },  { "a",          0,      0,      0,      0,      0, "anchor " },
 { "ABBR",       0,      0,      0,      0,      0, "abbreviated form" },  { "abbr",       0,      0,      0,      0,      0, "abbreviated form" },
 { "ACRONYM",    0,      0,      0,      0,      0, "" },  { "acronym",    0,      0,      0,      0,      0, "" },
 { "ADDRESS",    0,      0,      0,      0,      0, "information on author " },  { "address",    0,      0,      0,      0,      0, "information on author " },
 { "APPLET",     0,      0,      0,      1,      1, "Java applet " },  { "applet",     0,      0,      0,      1,      1, "java applet " },
 { "AREA",       0,      2,      1,      0,      0, "client-side image map area " },  { "area",       0,      2,      1,      0,      0, "client-side image map area " },
 { "B",          0,      0,      0,      0,      0, "bold text style" },  { "b",          0,      0,      0,      0,      0, "bold text style" },
 { "BASE",       0,      2,      1,      0,      0, "document base URI " },  { "base",       0,      2,      1,      0,      0, "document base uri " },
 { "BASEFONT",   0,      2,      1,      1,      1, "base font size " },  { "basefont",   0,      2,      1,      1,      1, "base font size " },
 { "BDO",        0,      0,      0,      0,      0, "I18N BiDi over-ride " },  { "bdo",        0,      0,      0,      0,      0, "i18n bidi over-ride " },
 { "BIG",        0,      0,      0,      0,      0, "large text style" },  { "big",        0,      0,      0,      0,      0, "large text style" },
 { "BLOCKQUOTE", 0,      0,      0,      0,      0, "long quotation " },  { "blockquote", 0,      0,      0,      0,      0, "long quotation " },
 { "BODY",       1,      1,      0,      0,      0, "document body " },  { "body",       1,      1,      0,      0,      0, "document body " },
 { "BR",         0,      2,      1,      0,      0, "forced line break " },  { "br",         0,      2,      1,      0,      0, "forced line break " },
 { "BUTTON",     0,      0,      0,      0,      0, "push button " },  { "button",     0,      0,      0,      0,      0, "push button " },
 { "CAPTION",    0,      0,      0,      0,      0, "table caption " },  { "caption",    0,      0,      0,      0,      0, "table caption " },
 { "CENTER",     0,      0,      0,      1,      1, "shorthand for DIV align=center " },  { "center",     0,      0,      0,      1,      1, "shorthand for div align=center " },
 { "CITE",       0,      0,      0,      0,      0, "citation" },  { "cite",       0,      0,      0,      0,      0, "citation" },
 { "CODE",       0,      0,      0,      0,      0, "computer code fragment" },  { "code",       0,      0,      0,      0,      0, "computer code fragment" },
 { "COL",        0,      2,      1,      0,      0, "table column " },  { "col",        0,      2,      1,      0,      0, "table column " },
 { "COLGROUP",   0,      1,      0,      0,      0, "table column group " },  { "colgroup",   0,      1,      0,      0,      0, "table column group " },
 { "DD",         0,      1,      0,      0,      0, "definition description " },  { "dd",         0,      1,      0,      0,      0, "definition description " },
 { "DEL",        0,      0,      0,      0,      0, "deleted text " },  { "del",        0,      0,      0,      0,      0, "deleted text " },
 { "DFN",        0,      0,      0,      0,      0, "instance definition" },  { "dfn",        0,      0,      0,      0,      0, "instance definition" },
 { "DIR",        0,      0,      0,      1,      1, "directory list" },  { "dir",        0,      0,      0,      1,      1, "directory list" },
 { "DIV",        0,      0,      0,      0,      0, "generic language/style container"},  { "div",        0,      0,      0,      0,      0, "generic language/style container"},
 { "DL",         0,      0,      0,      0,      0, "definition list " },  { "dl",         0,      0,      0,      0,      0, "definition list " },
 { "DT",         0,      1,      0,      0,      0, "definition term " },  { "dt",         0,      1,      0,      0,      0, "definition term " },
 { "EM",         0,      0,      0,      0,      0, "emphasis" },  { "em",         0,      0,      0,      0,      0, "emphasis" },
 { "FIELDSET",   0,      0,      0,      0,      0, "form control group " },  { "fieldset",   0,      0,      0,      0,      0, "form control group " },
 { "FONT",       0,      0,      0,      1,      1, "local change to font " },  { "font",       0,      0,      0,      1,      1, "local change to font " },
 { "FORM",       0,      0,      0,      0,      0, "interactive form " },  { "form",       0,      0,      0,      0,      0, "interactive form " },
 { "FRAME",      0,      2,      1,      0,      2, "subwindow " },  { "frame",      0,      2,      1,      0,      2, "subwindow " },
 { "FRAMESET",   0,      0,      0,      0,      2, "window subdivision" },  { "frameset",   0,      0,      0,      0,      2, "window subdivision" },
 { "H1",         0,      0,      0,      0,      0, "heading " },  { "h1",         0,      0,      0,      0,      0, "heading " },
 { "H2",         0,      0,      0,      0,      0, "heading " },  { "h2",         0,      0,      0,      0,      0, "heading " },
 { "H3",         0,      0,      0,      0,      0, "heading " },  { "h3",         0,      0,      0,      0,      0, "heading " },
 { "H4",         0,      0,      0,      0,      0, "heading " },  { "h4",         0,      0,      0,      0,      0, "heading " },
 { "H5",         0,      0,      0,      0,      0, "heading " },  { "h5",         0,      0,      0,      0,      0, "heading " },
 { "H6",         0,      0,      0,      0,      0, "heading " },  { "h6",         0,      0,      0,      0,      0, "heading " },
 { "HEAD",       1,      1,      0,      0,      0, "document head " },  { "head",       1,      1,      0,      0,      0, "document head " },
 { "HR",         0,      2,      1,      0,      0, "horizontal rule " },  { "hr",         0,      2,      1,      0,      0, "horizontal rule " },
 { "HTML",       1,      1,      0,      0,      0, "document root element " },  { "html",       1,      1,      0,      0,      0, "document root element " },
 { "I",          0,      0,      0,      0,      0, "italic text style" },  { "i",          0,      0,      0,      0,      0, "italic text style" },
 { "IFRAME",     0,      0,      0,      0,      1, "inline subwindow " },  { "iframe",     0,      0,      0,      0,      1, "inline subwindow " },
 { "IMG",        0,      2,      1,      0,      0, "Embedded image " },  { "img",        0,      2,      1,      0,      0, "embedded image " },
 { "INPUT",      0,      2,      1,      0,      0, "form control " },  { "input",      0,      2,      1,      0,      0, "form control " },
 { "INS",        0,      0,      0,      0,      0, "inserted text" },  { "ins",        0,      0,      0,      0,      0, "inserted text" },
 { "ISINDEX",    0,      2,      1,      1,      1, "single line prompt " },  { "isindex",    0,      2,      1,      1,      1, "single line prompt " },
 { "KBD",        0,      0,      0,      0,      0, "text to be entered by the user" },  { "kbd",        0,      0,      0,      0,      0, "text to be entered by the user" },
 { "LABEL",      0,      0,      0,      0,      0, "form field label text " },  { "label",      0,      0,      0,      0,      0, "form field label text " },
 { "LEGEND",     0,      0,      0,      0,      0, "fieldset legend " },  { "legend",     0,      0,      0,      0,      0, "fieldset legend " },
 { "LI",         0,      1,      0,      0,      0, "list item " },  { "li",         0,      1,      0,      0,      0, "list item " },
 { "LINK",       0,      2,      1,      0,      0, "a media-independent link " },  { "link",       0,      2,      1,      0,      0, "a media-independent link " },
 { "MAP",        0,      0,      0,      0,      0, "client-side image map " },  { "map",        0,      0,      0,      0,      0, "client-side image map " },
 { "MENU",       0,      0,      0,      1,      1, "menu list " },  { "menu",       0,      0,      0,      1,      1, "menu list " },
 { "META",       0,      2,      1,      0,      0, "generic metainformation " },  { "meta",       0,      2,      1,      0,      0, "generic metainformation " },
 { "NOFRAMES",   0,      0,      0,      0,      2, "alternate content container for non frame-based rendering " },  { "noframes",   0,      0,      0,      0,      2, "alternate content container for non frame-based rendering " },
 { "NOSCRIPT",   0,      0,      0,      0,      0, "alternate content container for non script-based rendering " },  { "noscript",   0,      0,      0,      0,      0, "alternate content container for non script-based rendering " },
 { "OBJECT",     0,      0,      0,      0,      0, "generic embedded object " },  { "object",     0,      0,      0,      0,      0, "generic embedded object " },
 { "OL",         0,      0,      0,      0,      0, "ordered list " },  { "ol",         0,      0,      0,      0,      0, "ordered list " },
 { "OPTGROUP",   0,      0,      0,      0,      0, "option group " },  { "optgroup",   0,      0,      0,      0,      0, "option group " },
 { "OPTION",     0,      1,      0,      0,      0, "selectable choice " },  { "option",     0,      1,      0,      0,      0, "selectable choice " },
 { "P",          0,      1,      0,      0,      0, "paragraph " },  { "p",          0,      1,      0,      0,      0, "paragraph " },
 { "PARAM",      0,      2,      1,      0,      0, "named property value " },  { "param",      0,      2,      1,      0,      0, "named property value " },
 { "PRE",        0,      0,      0,      0,      0, "preformatted text " },  { "pre",        0,      0,      0,      0,      0, "preformatted text " },
 { "Q",          0,      0,      0,      0,      0, "short inline quotation " },  { "q",          0,      0,      0,      0,      0, "short inline quotation " },
 { "S",          0,      0,      0,      1,      1, "strike-through text style" },  { "s",          0,      0,      0,      1,      1, "strike-through text style" },
 { "SAMP",       0,      0,      0,      0,      0, "sample program output, scripts, etc." },  { "samp",       0,      0,      0,      0,      0, "sample program output, scripts, etc." },
 { "SCRIPT",     0,      0,      0,      0,      0, "script statements " },  { "script",     0,      0,      0,      0,      0, "script statements " },
 { "SELECT",     0,      0,      0,      0,      0, "option selector " },  { "select",     0,      0,      0,      0,      0, "option selector " },
 { "SMALL",      0,      0,      0,      0,      0, "small text style" },  { "small",      0,      0,      0,      0,      0, "small text style" },
 { "SPAN",       0,      0,      0,      0,      0, "generic language/style container " },  { "span",       0,      0,      0,      0,      0, "generic language/style container " },
 { "STRIKE",     0,      0,      0,      1,      1, "strike-through text" },  { "strike",     0,      0,      0,      1,      1, "strike-through text" },
 { "STRONG",     0,      0,      0,      0,      0, "strong emphasis" },  { "strong",     0,      0,      0,      0,      0, "strong emphasis" },
 { "STYLE",      0,      0,      0,      0,      0, "style info " },  { "style",      0,      0,      0,      0,      0, "style info " },
 { "SUB",        0,      0,      0,      0,      0, "subscript" },  { "sub",        0,      0,      0,      0,      0, "subscript" },
 { "SUP",        0,      0,      0,      0,      0, "superscript " },  { "sup",        0,      0,      0,      0,      0, "superscript " },
 { "TABLE",      0,      0,      0,      0,      0, " " },  { "table",      0,      0,      0,      0,      0, " " },
 { "TBODY",      1,      1,      0,      0,      0, "table body " },  { "tbody",      1,      1,      0,      0,      0, "table body " },
 { "TD",         0,      1,      0,      0,      0, "table data cell" },  { "td",         0,      1,      0,      0,      0, "table data cell" },
 { "TEXTAREA",   0,      0,      0,      0,      0, "multi-line text field " },  { "textarea",   0,      0,      0,      0,      0, "multi-line text field " },
 { "TFOOT",      0,      1,      0,      0,      0, "table footer " },  { "tfoot",      0,      1,      0,      0,      0, "table footer " },
 { "TH",         0,      1,      0,      0,      0, "table header cell" },  { "th",         0,      1,      0,      0,      0, "table header cell" },
 { "THEAD",      0,      1,      0,      0,      0, "table header " },  { "thead",      0,      1,      0,      0,      0, "table header " },
 { "TITLE",      0,      0,      0,      0,      0, "document title " },  { "title",      0,      0,      0,      0,      0, "document title " },
 { "TR",         0,      1,      0,      0,      0, "table row " },  { "tr",         0,      1,      0,      0,      0, "table row " },
 { "TT",         0,      0,      0,      0,      0, "teletype or monospaced text style" },  { "tt",         0,      0,      0,      0,      0, "teletype or monospaced text style" },
 { "U",          0,      0,      0,      1,      1, "underlined text style" },  { "u",          0,      0,      0,      1,      1, "underlined text style" },
 { "UL",         0,      0,      0,      0,      0, "unordered list " },  { "ul",         0,      0,      0,      0,      0, "unordered list " },
 { "VAR",        0,      0,      0,      0,      0, "instance of a variable or program argument" },  { "var",        0,      0,      0,      0,      0, "instance of a variable or program argument" },
 };  };
   
 /*  /*
Line 280  htmlElemDesc  html40ElementTable[] = { Line 281  htmlElemDesc  html40ElementTable[] = {
  * that element is in the same line   * that element is in the same line
  */   */
 char *htmlEquEnd[] = {  char *htmlEquEnd[] = {
 "DT", "DD", "LI", "OPTION", NULL,  "dt", "dd", "li", "option", NULL,
 "H1", "H2", "H3", "H4", "H5", "H6", NULL,  "h1", "h2", "h3", "h4", "h5", "h6", NULL,
 "OL", "MENU", "DIR", "ADDRESS", "PRE", "LISTING", "XMP", NULL,  "ol", "menu", "dir", "address", "pre", "listing", "xmp", NULL,
 NULL  NULL
 };  };
 /*  /*
Line 295  NULL Line 296  NULL
  * start tags that imply the end of current element   * start tags that imply the end of current element
  */   */
 char *htmlStartClose[] = {  char *htmlStartClose[] = {
 "FORM",         "FORM", "P", "HR", "H1", "H2", "H3", "H4", "H5", "H6",  "form",         "form", "p", "hr", "h1", "h2", "h3", "h4", "h5", "h6",
                 "DL", "UL", "OL", "MENU", "DIR", "ADDRESS", "PRE",                  "dl", "ul", "ol", "menu", "dir", "address", "pre",
                 "LISTING", "XMP", "HEAD", NULL,                  "listing", "xmp", "head", NULL,
 "HEAD",         "P", NULL,  "head",         "p", NULL,
 "TITLE",        "P", NULL,  "title",        "p", NULL,
 "BODY",         "HEAD", "STYLE", "LINK", "TITLE", "P", NULL,  "body",         "head", "style", "link", "title", "p", NULL,
 "LI",           "P", "H1", "H2", "H3", "H4", "H5", "H6", "DL", "ADDRESS",  "li",           "p", "h1", "h2", "h3", "h4", "h5", "h6", "dl", "address",
                 "PRE", "LISTING", "XMP", "HEAD", "LI", NULL,                  "pre", "listing", "xmp", "head", "li", NULL,
 "HR",           "P", "HEAD", NULL,  "hr",           "p", "head", NULL,
 "H1",           "P", "HEAD", NULL,  "h1",           "p", "head", NULL,
 "H2",           "P", "HEAD", NULL,  "h2",           "p", "head", NULL,
 "H3",           "P", "HEAD", NULL,  "h3",           "p", "head", NULL,
 "H4",           "P", "HEAD", NULL,  "h4",           "p", "head", NULL,
 "H5",           "P", "HEAD", NULL,  "h5",           "p", "head", NULL,
 "H6",           "P", "HEAD", NULL,  "h6",           "p", "head", NULL,
 "DIR",          "P", "HEAD", NULL,  "dir",          "p", "head", NULL,
 "ADDRESS",      "P", "HEAD", "UL", NULL,  "address",      "p", "head", "ul", NULL,
 "PRE",          "P", "HEAD", "UL", NULL,  "pre",          "p", "head", "ul", NULL,
 "LISTING",      "P", "HEAD", NULL,  "listing",      "p", "head", NULL,
 "XMP",          "P", "HEAD", NULL,  "xmp",          "p", "head", NULL,
 "BLOCKQUOTE",   "P", "HEAD", NULL,  "blockquote",   "p", "head", NULL,
 "DL",           "P", "DT", "MENU", "DIR", "ADDRESS", "PRE", "LISTING",  "dl",           "p", "dt", "menu", "dir", "address", "pre", "listing",
                 "XMP", "HEAD", NULL,                  "xmp", "head", NULL,
 "DT",           "P", "MENU", "DIR", "ADDRESS", "PRE", "LISTING", "XMP",  "dt",           "p", "menu", "dir", "address", "pre", "listing", "xmp",
                 "HEAD", "DD", NULL,                  "head", "dd", NULL,
 "DD",           "P", "MENU", "DIR", "ADDRESS", "PRE", "LISTING", "XMP",  "dd",           "p", "menu", "dir", "address", "pre", "listing", "xmp",
                 "HEAD", "DT", NULL,                  "head", "dt", NULL,
 "UL",           "P", "HEAD", "OL", "MENU", "DIR", "ADDRESS", "PRE",  "ul",           "p", "head", "ol", "menu", "dir", "address", "pre",
                 "LISTING", "XMP", NULL,                  "listing", "xmp", NULL,
 "OL",           "P", "HEAD", "UL", NULL,  "ol",           "p", "head", "ul", NULL,
 "MENU",         "P", "HEAD", "UL", NULL,  "menu",         "p", "head", "ul", NULL,
 "P",            "P", "HEAD", "H1", "H2", "H3", "H4", "H5", "H6", NULL,  "p",            "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", NULL,
 "DIV",          "P", "HEAD", NULL,  "div",          "p", "head", NULL,
 "NOSCRIPT",     "P", "HEAD", NULL,  "noscript",     "p", "head", NULL,
 "CENTER",       "FONT", "B", "I", "P", "HEAD", NULL,  "center",       "font", "b", "i", "p", "head", NULL,
 "A",            "A", NULL,  "a",            "a", NULL,
 "CAPTION",      "P", NULL,  "caption",      "p", NULL,
 "COLGROUP",     "CAPTION", "COLGROUP", "COL", "P", NULL,  "colgroup",     "caption", "colgroup", "col", "p", NULL,
 "COL",          "CAPTION", "COL", "P", NULL,  "col",          "caption", "col", "p", NULL,
 "TABLE",        "P", "HEAD", "H1", "H2", "H3", "H4", "H5", "H6", "PRE",  "table",        "p", "head", "h1", "h2", "h3", "h4", "h5", "h6", "pre",
                 "LISTING", "XMP", "A", NULL,                  "listing", "xmp", "a", NULL,
 "TH",           "TH", "TD", NULL,  "th",           "th", "td", NULL,
 "TD",           "TH", "TD", "P", NULL,  "td",           "th", "td", "p", NULL,
 "TR",           "TH", "TD", "TR", "CAPTION", "COL", "COLGROUP", "P", NULL,  "tr",           "th", "td", "tr", "caption", "col", "colgroup", "p", NULL,
 "THEAD",        "CAPTION", "COL", "COLGROUP", NULL,  "thead",        "caption", "col", "colgroup", NULL,
 "TFOOT",        "TH", "TD", "TR", "CAPTION", "COL", "COLGROUP", "THEAD",  "tfoot",        "th", "td", "tr", "caption", "col", "colgroup", "thead",
                 "TBODY", "P", NULL,                  "tbody", "p", NULL,
 "TBODY",        "TH", "TD", "TR", "CAPTION", "COL", "COLGROUP", "THEAD",  "tbody",        "th", "td", "tr", "caption", "col", "colgroup", "thead",
                 "TFOOT", "TBODY", "P", NULL,                  "tfoot", "tbody", "p", NULL,
 "OPTGROUP",     "OPTION", NULL,  "optgroup",     "option", NULL,
 "FIELDSET",     "LEGEND", "P", "HEAD", "H1", "H2", "H3", "H4", "H5", "H6",  "fieldset",     "legend", "p", "head", "h1", "h2", "h3", "h4", "h5", "h6",
                 "PRE", "LISTING", "XMP", "A", NULL,                  "pre", "listing", "xmp", "a", NULL,
 NULL  NULL
 };  };
   
Line 1200  htmlNewDoc(const xmlChar *URI, const xml Line 1201  htmlNewDoc(const xmlChar *URI, const xml
  * htmlParseHTMLName:   * htmlParseHTMLName:
  * @ctxt:  an HTML parser context   * @ctxt:  an HTML parser context
  *   *
  * parse an HTML tag or attribute name, note that we convert it to uppercase   * parse an HTML tag or attribute name, note that we convert it to lowercase
  * since HTML names are not case-sensitive.   * since HTML names are not case-sensitive.
  *   *
  * Returns the Tag Name parsed or NULL   * Returns the Tag Name parsed or NULL
Line 1216  htmlParseHTMLName(htmlParserCtxtPtr ctxt Line 1217  htmlParseHTMLName(htmlParserCtxtPtr ctxt
         (CUR != ':')) return(NULL);          (CUR != ':')) return(NULL);
   
     while ((i < 100) && ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)))) {      while ((i < 100) && ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)))) {
         if ((CUR >= 0x61) && (CUR <= 0x7a)) loc[i] = CUR - 0x20;          if ((CUR >= 'A') && (CUR <= 'Z')) loc[i] = CUR + 0x20;
         else loc[i] = CUR;          else loc[i] = CUR;
         i++;          i++;
                   
Line 1997  htmlParseStartTag(htmlParserCtxtPtr ctxt Line 1998  htmlParseStartTag(htmlParserCtxtPtr ctxt
     while ((IS_CHAR(CUR)) &&      while ((IS_CHAR(CUR)) &&
            (CUR != '>') &&              (CUR != '>') && 
            ((CUR != '/') || (NXT(1) != '>'))) {             ((CUR != '/') || (NXT(1) != '>'))) {
         const xmlChar *q = CUR_PTR;          long cons = ctxt->nbChars;
         int cons = ctxt->input->consumed;  
   
         GROW;          GROW;
         attname = htmlParseAttribute(ctxt, &attvalue);          attname = htmlParseAttribute(ctxt, &attvalue);
Line 2049  htmlParseStartTag(htmlParserCtxtPtr ctxt Line 2049  htmlParseStartTag(htmlParserCtxtPtr ctxt
   
 failed:  failed:
         SKIP_BLANKS;          SKIP_BLANKS;
         if ((cons == ctxt->input->consumed) && (q == CUR_PTR)) {          if (cons == ctxt->nbChars) {
             if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))              if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
                 ctxt->sax->error(ctxt->userData,                   ctxt->sax->error(ctxt->userData, 
                  "htmlParseStartTag: problem parsing attributes\n");                   "htmlParseStartTag: problem parsing attributes\n");
Line 2242  htmlParseContent(htmlParserCtxtPtr ctxt) Line 2242  htmlParseContent(htmlParserCtxtPtr ctxt)
     xmlChar *currentNode;      xmlChar *currentNode;
     int depth;      int depth;
   
     currentNode = ctxt->name;      currentNode = xmlStrdup(ctxt->name);
     depth = ctxt->nameNr;      depth = ctxt->nameNr;
     while (1) {      while (1) {
         const xmlChar *test = CUR_PTR;          long cons = ctxt->nbChars;
   
         GROW;          GROW;
         /*          /*
Line 2253  htmlParseContent(htmlParserCtxtPtr ctxt) Line 2253  htmlParseContent(htmlParserCtxtPtr ctxt)
          */           */
         if ((CUR == '<') && (NXT(1) == '/')) {          if ((CUR == '<') && (NXT(1) == '/')) {
             htmlParseEndTag(ctxt);              htmlParseEndTag(ctxt);
               if (currentNode != NULL) xmlFree(currentNode);
             return;              return;
         }          }
   
Line 2260  htmlParseContent(htmlParserCtxtPtr ctxt) Line 2261  htmlParseContent(htmlParserCtxtPtr ctxt)
          * Has this node been popped out during parsing of           * Has this node been popped out during parsing of
          * the next element           * the next element
          */           */
         if ((currentNode != ctxt->name) &&          if ((xmlStrcmp(currentNode, ctxt->name)) &&
             (depth >= ctxt->nameNr)) return;              (depth >= ctxt->nameNr)) {
               if (currentNode != NULL) xmlFree(currentNode);
               return;
           }
   
         /*          /*
          * First case :  a comment           * First case :  a comment
Line 2293  htmlParseContent(htmlParserCtxtPtr ctxt) Line 2297  htmlParseContent(htmlParserCtxtPtr ctxt)
             htmlParseCharData(ctxt, 0);              htmlParseCharData(ctxt, 0);
         }          }
   
         if (test == CUR_PTR) {          if (cons == ctxt->nbChars) {
             if (ctxt->node != NULL) {              if (ctxt->node != NULL) {
                 if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))                  if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
                     ctxt->sax->error(ctxt->userData,                      ctxt->sax->error(ctxt->userData,
Line 2305  htmlParseContent(htmlParserCtxtPtr ctxt) Line 2309  htmlParseContent(htmlParserCtxtPtr ctxt)
   
         GROW;          GROW;
     }      }
       if (currentNode != NULL) xmlFree(currentNode);
 }  }
   
 /**  /**
Line 2335  htmlParseElement(htmlParserCtxtPtr ctxt) Line 2340  htmlParseElement(htmlParserCtxtPtr ctxt)
         node_info.begin_line = ctxt->input->line;          node_info.begin_line = ctxt->input->line;
     }      }
   
     oldname = ctxt->name;      oldname = xmlStrdup(ctxt->name);
     htmlParseStartTag(ctxt);      htmlParseStartTag(ctxt);
     name = ctxt->name;      name = ctxt->name;
 #ifdef DEBUG  #ifdef DEBUG
Line 2346  htmlParseElement(htmlParserCtxtPtr ctxt) Line 2351  htmlParseElement(htmlParserCtxtPtr ctxt)
     else              else        
         fprintf(stderr, "Start of element %s, was %s\n", name, oldname);          fprintf(stderr, "Start of element %s, was %s\n", name, oldname);
 #endif  #endif
     if (((depth == ctxt->nameNr) && (oldname == ctxt->name)) ||      if (((depth == ctxt->nameNr) && (!xmlStrcmp(oldname, ctxt->name))) ||
         (name == NULL)) {          (name == NULL)) {
         if (CUR == '>')          if (CUR == '>')
             NEXT;              NEXT;
           if (oldname != NULL)
               xmlFree(oldname);
         return;          return;
     }      }
       if (oldname != NULL)
           xmlFree(oldname);
   
     /*      /*
      * Lookup the info for that element.       * Lookup the info for that element.
Line 2438  htmlParseElement(htmlParserCtxtPtr ctxt) Line 2447  htmlParseElement(htmlParserCtxtPtr ctxt)
     /*      /*
      * Parse the content of the element:       * Parse the content of the element:
      */       */
     currentNode = ctxt->name;      currentNode = xmlStrdup(ctxt->name);
     depth = ctxt->nameNr;      depth = ctxt->nameNr;
     while (IS_CHAR(CUR)) {      while (IS_CHAR(CUR)) {
         htmlParseContent(ctxt);          htmlParseContent(ctxt);
Line 2461  htmlParseElement(htmlParserCtxtPtr ctxt) Line 2470  htmlParseElement(htmlParserCtxtPtr ctxt)
 #endif  #endif
         if (oldname != NULL)          if (oldname != NULL)
             xmlFree(oldname);              xmlFree(oldname);
           if (currentNode != NULL)
               xmlFree(currentNode);
         return;          return;
     }      }
   
Line 2474  htmlParseElement(htmlParserCtxtPtr ctxt) Line 2485  htmlParseElement(htmlParserCtxtPtr ctxt)
        node_info.node = ctxt->node;         node_info.node = ctxt->node;
        xmlParserAddNodeInfo(ctxt, &node_info);         xmlParserAddNodeInfo(ctxt, &node_info);
     }      }
       if (currentNode != NULL)
           xmlFree(currentNode);
 }  }
   
 /**  /**
Line 2619  htmlInitParserCtxt(htmlParserCtxtPtr ctx Line 2632  htmlInitParserCtxt(htmlParserCtxtPtr ctx
     ctxt->html = 1;      ctxt->html = 1;
     ctxt->record_info = 0;      ctxt->record_info = 0;
     ctxt->validate = 0;      ctxt->validate = 0;
       ctxt->nbChars = 0;
     xmlInitNodeInfoSeq(&ctxt->node_seq);      xmlInitNodeInfoSeq(&ctxt->node_seq);
 }  }
   

Removed from v.1.25  
changed lines
  Added in v.1.26


Webmaster