Index: valid.c =================================================================== RCS file: /cvs/gnome/gnome-xml/valid.c,v retrieving revision 1.67 retrieving revision 1.70 diff -c -r1.67 -r1.70 *** valid.c 2001/04/22 10:35:56 1.67 --- valid.c 2001/04/24 15:52:00 1.70 *************** *** 3286,3292 **** return(1); } if (CONT == NULL) return(-1); ! if (NODE->type == XML_ENTITY_REF_NODE) return(-2); /* --- 3286,3292 ---- return(1); } if (CONT == NULL) return(-1); ! if ((NODE != NULL) && (NODE->type == XML_ENTITY_REF_NODE)) return(-2); /* *************** *** 3601,3608 **** break; case XML_ATTRIBUTE_NODE: case XML_DOCUMENT_NODE: ! #ifdef LIBXML_SGML_ENABLED ! case XML_SGML_DOCUMENT_NODE: #endif case XML_HTML_DOCUMENT_NODE: case XML_DOCUMENT_TYPE_NODE: --- 3601,3608 ---- break; case XML_ATTRIBUTE_NODE: case XML_DOCUMENT_NODE: ! #ifdef LIBXML_DOCB_ENABLED ! case XML_DOCB_DOCUMENT_NODE: #endif case XML_HTML_DOCUMENT_NODE: case XML_DOCUMENT_TYPE_NODE: *************** *** 3643,3649 **** static int xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child, ! xmlElementContentPtr cont, int warn) { int ret; xmlNodePtr repl = NULL, last = NULL, cur, tmp; --- 3643,3649 ---- static int xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child, ! xmlElementContentPtr cont, int warn, const xmlChar *name) { int ret; xmlNodePtr repl = NULL, last = NULL, cur, tmp; *************** *** 3661,3666 **** --- 3661,3667 ---- /* * The first entry in the stack is reserved to the current state */ + ctxt->nodeTab = NULL; ctxt->vstate = &ctxt->vstateTab[0]; ctxt->vstateNr = 1; CONT = cont; *************** *** 3756,3765 **** else xmlSprintfElements(list, child, 1); ! if ((child->parent != NULL) && (child->parent->name != NULL)) { VERROR(ctxt->userData, "Element %s content doesn't follow the Dtd\nExpecting %s, got %s\n", ! child->parent->name, expr, list); } else { VERROR(ctxt->userData, "Element content doesn't follow the Dtd\nExpecting %s, got %s\n", --- 3757,3766 ---- else xmlSprintfElements(list, child, 1); ! if (name != NULL) { VERROR(ctxt->userData, "Element %s content doesn't follow the Dtd\nExpecting %s, got %s\n", ! name, expr, list); } else { VERROR(ctxt->userData, "Element content doesn't follow the Dtd\nExpecting %s, got %s\n", *************** *** 3793,3861 **** } /** - * xmlSprintfElementChilds: - * @buf: an output buffer - * @content: An element - * @glob: 1 if one must print the englobing parenthesis, 0 otherwise - * - * This will dump the list of childs to the buffer - * Intended just for the debug routine - */ - static void - xmlSprintfElementChilds(char *buf, xmlNodePtr node, int glob) { - xmlNodePtr cur; - - if (node == NULL) return; - if (glob) strcat(buf, "("); - cur = node->children; - while (cur != NULL) { - switch (cur->type) { - case XML_ELEMENT_NODE: - strcat(buf, (char *) cur->name); - if (cur->next != NULL) - strcat(buf, " "); - break; - case XML_TEXT_NODE: - if (xmlIsBlankNode(cur)) - break; - case XML_CDATA_SECTION_NODE: - case XML_ENTITY_REF_NODE: - strcat(buf, "CDATA"); - if (cur->next != NULL) - strcat(buf, " "); - break; - case XML_ATTRIBUTE_NODE: - case XML_DOCUMENT_NODE: - #ifdef LIBXML_SGML_ENABLED - case XML_SGML_DOCUMENT_NODE: - #endif - case XML_HTML_DOCUMENT_NODE: - case XML_DOCUMENT_TYPE_NODE: - case XML_DOCUMENT_FRAG_NODE: - case XML_NOTATION_NODE: - case XML_NAMESPACE_DECL: - strcat(buf, "???"); - if (cur->next != NULL) - strcat(buf, " "); - break; - case XML_ENTITY_NODE: - case XML_PI_NODE: - case XML_DTD_NODE: - case XML_COMMENT_NODE: - case XML_ELEMENT_DECL: - case XML_ATTRIBUTE_DECL: - case XML_ENTITY_DECL: - case XML_XINCLUDE_START: - case XML_XINCLUDE_END: - break; - } - cur = cur->next; - } - if (glob) strcat(buf, ")"); - } - - - /** * xmlValidateOneElement: * @ctxt: the validation context * @doc: a document instance --- 3794,3799 ---- *************** *** 4058,4064 **** case XML_ELEMENT_TYPE_ELEMENT: child = elem->children; cont = elemDecl->content; ! ret = xmlValidateElementContent(ctxt, child, cont, 1); break; } --- 3996,4002 ---- case XML_ELEMENT_TYPE_ELEMENT: child = elem->children; cont = elemDecl->content; ! ret = xmlValidateElementContent(ctxt, child, cont, 1, elem->name); break; }