| 565 | } |
| 566 | |
| 567 | static void |
| 568 | xmlCtxtDumpElemDecl(xmlDebugCtxtPtr ctxt, xmlElementPtr elem) |
| 569 | { |
| 570 | xmlCtxtDumpSpaces(ctxt); |
| 571 | |
| 572 | if (elem == NULL) { |
| 573 | if (!ctxt->check) |
| 574 | fprintf(ctxt->output, "Element declaration is NULL\n"); |
| 575 | return; |
| 576 | } |
| 577 | if (elem->type != XML_ELEMENT_DECL) { |
| 578 | xmlDebugErr(ctxt, XML_CHECK_NOT_ELEM_DECL, |
| 579 | "Node is not an element declaration"); |
| 580 | return; |
| 581 | } |
| 582 | if (elem->name != NULL) { |
| 583 | if (!ctxt->check) { |
| 584 | fprintf(ctxt->output, "ELEMDECL("); |
| 585 | xmlCtxtDumpString(ctxt, elem->name); |
| 586 | fprintf(ctxt->output, ")"); |
| 587 | } |
| 588 | } else |
| 589 | xmlDebugErr(ctxt, XML_CHECK_NO_NAME, |
| 590 | "Element declaration has no name"); |
| 591 | if (!ctxt->check) { |
| 592 | switch (elem->etype) { |
| 593 | case XML_ELEMENT_TYPE_UNDEFINED: |
| 594 | fprintf(ctxt->output, ", UNDEFINED"); |
| 595 | break; |
| 596 | case XML_ELEMENT_TYPE_EMPTY: |
| 597 | fprintf(ctxt->output, ", EMPTY"); |
| 598 | break; |
| 599 | case XML_ELEMENT_TYPE_ANY: |
| 600 | fprintf(ctxt->output, ", ANY"); |
| 601 | break; |
| 602 | case XML_ELEMENT_TYPE_MIXED: |
| 603 | fprintf(ctxt->output, ", MIXED "); |
| 604 | break; |
| 605 | case XML_ELEMENT_TYPE_ELEMENT: |
| 606 | fprintf(ctxt->output, ", MIXED "); |
| 607 | break; |
| 608 | } |
| 609 | if ((elem->type != XML_ELEMENT_NODE) && (elem->content != NULL)) { |
| 610 | char buf[5001]; |
| 611 | |
| 612 | buf[0] = 0; |
| 613 | xmlSnprintfElementContent(buf, 5000, elem->content, 1); |
| 614 | buf[5000] = 0; |
| 615 | fprintf(ctxt->output, "%s", buf); |
| 616 | } |
| 617 | fprintf(ctxt->output, "\n"); |
| 618 | } |
| 619 | |
| 620 | /* |
| 621 | * Do a bit of checking |
| 622 | */ |
| 623 | xmlCtxtGenericNodeCheck(ctxt, (xmlNodePtr) elem); |
| 624 | } |
no test coverage detected