| 4141 | */ |
| 4142 | |
| 4143 | static void |
| 4144 | htmlParseContent(htmlParserCtxtPtr ctxt) { |
| 4145 | xmlChar *currentNode; |
| 4146 | int depth; |
| 4147 | const xmlChar *name; |
| 4148 | |
| 4149 | currentNode = xmlStrdup(ctxt->name); |
| 4150 | depth = ctxt->nameNr; |
| 4151 | while (!PARSER_STOPPED(ctxt)) { |
| 4152 | GROW; |
| 4153 | |
| 4154 | /* |
| 4155 | * Our tag or one of it's parent or children is ending. |
| 4156 | */ |
| 4157 | if ((CUR == '<') && (NXT(1) == '/')) { |
| 4158 | if (htmlParseEndTag(ctxt) && |
| 4159 | ((currentNode != NULL) || (ctxt->nameNr == 0))) { |
| 4160 | if (currentNode != NULL) |
| 4161 | xmlFree(currentNode); |
| 4162 | return; |
| 4163 | } |
| 4164 | continue; /* while */ |
| 4165 | } |
| 4166 | |
| 4167 | else if ((CUR == '<') && |
| 4168 | ((IS_ASCII_LETTER(NXT(1))) || |
| 4169 | (NXT(1) == '_') || (NXT(1) == ':'))) { |
| 4170 | name = htmlParseHTMLName_nonInvasive(ctxt); |
| 4171 | if (name == NULL) { |
| 4172 | htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED, |
| 4173 | "htmlParseStartTag: invalid element name\n", |
| 4174 | NULL, NULL); |
| 4175 | /* Dump the bogus tag like browsers do */ |
| 4176 | while ((CUR != 0) && (CUR != '>')) |
| 4177 | NEXT; |
| 4178 | |
| 4179 | if (currentNode != NULL) |
| 4180 | xmlFree(currentNode); |
| 4181 | return; |
| 4182 | } |
| 4183 | |
| 4184 | if (ctxt->name != NULL) { |
| 4185 | if (htmlCheckAutoClose(name, ctxt->name) == 1) { |
| 4186 | htmlAutoClose(ctxt, name); |
| 4187 | continue; |
| 4188 | } |
| 4189 | } |
| 4190 | } |
| 4191 | |
| 4192 | /* |
| 4193 | * Has this node been popped out during parsing of |
| 4194 | * the next element |
| 4195 | */ |
| 4196 | if ((ctxt->nameNr > 0) && (depth >= ctxt->nameNr) && |
| 4197 | (!xmlStrEqual(currentNode, ctxt->name))) |
| 4198 | { |
| 4199 | if (currentNode != NULL) xmlFree(currentNode); |
| 4200 | return; |
no test coverage detected