* xmlParseAttributeListDecl: * @ctxt: an XML parser context * * DEPRECATED: Internal function, don't use. * * Parse an attribute list declaration for an element. Always consumes '<!'. * * [52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>' * * [53] AttDef ::= S Name S AttType S DefaultDecl * */
| 6246 | * |
| 6247 | */ |
| 6248 | void |
| 6249 | xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) { |
| 6250 | const xmlChar *elemName; |
| 6251 | const xmlChar *attrName; |
| 6252 | xmlEnumerationPtr tree; |
| 6253 | |
| 6254 | if ((CUR != '<') || (NXT(1) != '!')) |
| 6255 | return; |
| 6256 | SKIP(2); |
| 6257 | |
| 6258 | if (CMP7(CUR_PTR, 'A', 'T', 'T', 'L', 'I', 'S', 'T')) { |
| 6259 | int inputid = ctxt->input->id; |
| 6260 | |
| 6261 | SKIP(7); |
| 6262 | if (SKIP_BLANKS_PE == 0) { |
| 6263 | xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, |
| 6264 | "Space required after '<!ATTLIST'\n"); |
| 6265 | } |
| 6266 | elemName = xmlParseName(ctxt); |
| 6267 | if (elemName == NULL) { |
| 6268 | xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, |
| 6269 | "ATTLIST: no name for Element\n"); |
| 6270 | return; |
| 6271 | } |
| 6272 | SKIP_BLANKS_PE; |
| 6273 | GROW; |
| 6274 | while ((RAW != '>') && (PARSER_STOPPED(ctxt) == 0)) { |
| 6275 | int type; |
| 6276 | int def; |
| 6277 | xmlChar *defaultValue = NULL; |
| 6278 | |
| 6279 | GROW; |
| 6280 | tree = NULL; |
| 6281 | attrName = xmlParseName(ctxt); |
| 6282 | if (attrName == NULL) { |
| 6283 | xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, |
| 6284 | "ATTLIST: no name for Attribute\n"); |
| 6285 | break; |
| 6286 | } |
| 6287 | GROW; |
| 6288 | if (SKIP_BLANKS_PE == 0) { |
| 6289 | xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, |
| 6290 | "Space required after the attribute name\n"); |
| 6291 | break; |
| 6292 | } |
| 6293 | |
| 6294 | type = xmlParseAttributeType(ctxt, &tree); |
| 6295 | if (type <= 0) { |
| 6296 | break; |
| 6297 | } |
| 6298 | |
| 6299 | GROW; |
| 6300 | if (SKIP_BLANKS_PE == 0) { |
| 6301 | xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, |
| 6302 | "Space required after the attribute type\n"); |
| 6303 | if (tree != NULL) |
| 6304 | xmlFreeEnumeration(tree); |
| 6305 | break; |
no test coverage detected