* xmlSAX2ElementDecl: * @ctx: the user data (XML parser context) * @name: the element name * @type: the element type * @content: the element value tree * * An element definition has been parsed */
| 689 | * An element definition has been parsed |
| 690 | */ |
| 691 | void |
| 692 | xmlSAX2ElementDecl(void *ctx, const xmlChar * name, int type, |
| 693 | xmlElementContentPtr content) |
| 694 | { |
| 695 | xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; |
| 696 | xmlElementPtr elem = NULL; |
| 697 | |
| 698 | /* Avoid unused variable warning if features are disabled. */ |
| 699 | (void) elem; |
| 700 | |
| 701 | if ((ctxt == NULL) || (ctxt->myDoc == NULL)) |
| 702 | return; |
| 703 | |
| 704 | if (ctxt->inSubset == 1) |
| 705 | elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, |
| 706 | name, (xmlElementTypeVal) type, content); |
| 707 | else if (ctxt->inSubset == 2) |
| 708 | elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, |
| 709 | name, (xmlElementTypeVal) type, content); |
| 710 | else { |
| 711 | xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, |
| 712 | "SAX.xmlSAX2ElementDecl(%s) called while not in subset\n", |
| 713 | name, NULL); |
| 714 | return; |
| 715 | } |
| 716 | #ifdef LIBXML_VALID_ENABLED |
| 717 | if (elem == NULL) |
| 718 | ctxt->valid = 0; |
| 719 | if (ctxt->validate && ctxt->wellFormed && |
| 720 | ctxt->myDoc && ctxt->myDoc->intSubset) |
| 721 | ctxt->valid &= |
| 722 | xmlValidateElementDecl(&ctxt->vctxt, ctxt->myDoc, elem); |
| 723 | #endif /* LIBXML_VALID_ENABLED */ |
| 724 | } |
| 725 | |
| 726 | /** |
| 727 | * xmlSAX2NotationDecl: |
no test coverage detected