--- embedaddon/libxml2/valid.c 2013/07/22 01:22:18 1.1.1.2 +++ embedaddon/libxml2/valid.c 2014/06/15 19:53:31 1.1.1.3 @@ -31,7 +31,7 @@ static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr d /* #define DEBUG_VALID_ALGO */ /* #define DEBUG_REGEXP_ALGO */ -#define TODO \ +#define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ __FILE__, __LINE__); @@ -301,7 +301,7 @@ vstateVPush(xmlValidCtxtPtr ctxt, xmlElementPtr elemDe if (elemDecl->contModel == NULL) xmlValidBuildContentModel(ctxt, elemDecl); if (elemDecl->contModel != NULL) { - ctxt->vstateTab[ctxt->vstateNr].exec = + ctxt->vstateTab[ctxt->vstateNr].exec = xmlRegNewExecCtxt(elemDecl->contModel, NULL, NULL); } else { ctxt->vstateTab[ctxt->vstateNr].exec = NULL; @@ -623,7 +623,7 @@ xmlValidStateDebug(xmlValidCtxtPtr ctxt) { #define DEBUG_VALID_STATE(n,c) xmlValidStateDebug(ctxt); #define DEBUG_VALID_MSG(m) \ xmlGenericError(xmlGenericErrorContext, "%s\n", m); - + #else #define DEBUG_VALID_STATE(n,c) #define DEBUG_VALID_MSG(m) @@ -676,7 +676,7 @@ xmlValidBuildAContentModel(xmlElementContentPtr conten xmlAutomataStatePtr oldstate = ctxt->state; xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(content->name, content->prefix, fn, 50); if (fullname == NULL) { xmlVErrMemory(ctxt, "Building content model"); @@ -701,9 +701,9 @@ xmlValidBuildAContentModel(xmlElementContentPtr conten break; case XML_ELEMENT_CONTENT_MULT: ctxt->state = xmlAutomataNewEpsilon(ctxt->am, - ctxt->state, NULL); + ctxt->state, NULL); xmlAutomataNewTransition(ctxt->am, - ctxt->state, ctxt->state, fullname, NULL); + ctxt->state, ctxt->state, fullname, NULL); break; } if ((fullname != fn) && (fullname != content->name)) @@ -752,7 +752,7 @@ xmlValidBuildAContentModel(xmlElementContentPtr conten xmlElementContentOccur ocur; ocur = content->ocur; - if ((ocur == XML_ELEMENT_CONTENT_PLUS) || + if ((ocur == XML_ELEMENT_CONTENT_PLUS) || (ocur == XML_ELEMENT_CONTENT_MULT)) { ctxt->state = xmlAutomataNewEpsilon(ctxt->am, ctxt->state, NULL); @@ -944,7 +944,7 @@ xmlNewDocElementContent(xmlDocPtr doc, const xmlChar * } break; default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "Internal: ELEMENT content corrupted invalid type\n", NULL); return(NULL); @@ -1001,7 +1001,7 @@ xmlNewElementContent(const xmlChar *name, xmlElementCo * @cur: An element content pointer. * * Build a copy of an element content description. - * + * * Returns the new xmlElementContentPtr or NULL in case of error. */ xmlElementContentPtr @@ -1028,7 +1028,7 @@ xmlCopyDocElementContent(xmlDocPtr doc, xmlElementCont else ret->name = xmlStrdup(cur->name); } - + if (cur->prefix != NULL) { if (dict) ret->prefix = xmlDictLookup(dict, cur->prefix, -1); @@ -1058,7 +1058,7 @@ xmlCopyDocElementContent(xmlDocPtr doc, xmlElementCont else tmp->name = xmlStrdup(cur->name); } - + if (cur->prefix != NULL) { if (dict) tmp->prefix = xmlDictLookup(dict, cur->prefix, -1); @@ -1082,7 +1082,7 @@ xmlCopyDocElementContent(xmlDocPtr doc, xmlElementCont * * Build a copy of an element content description. * Deprecated, use xmlCopyDocElementContent instead - * + * * Returns the new xmlElementContentPtr or NULL in case of error. */ xmlElementContentPtr @@ -1114,7 +1114,7 @@ xmlFreeDocElementContent(xmlDocPtr doc, xmlElementCont case XML_ELEMENT_CONTENT_OR: break; default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "Internal: ELEMENT content corrupted invalid type\n", NULL); return; @@ -1200,7 +1200,7 @@ xmlDumpElementContent(xmlBufferPtr buf, xmlElementCont xmlDumpElementContent(buf, content->c2, 0); break; default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "Internal: ELEMENT content corrupted invalid type\n", NULL); } @@ -1397,7 +1397,7 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, switch (type) { case XML_ELEMENT_TYPE_EMPTY: if (content != NULL) { - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, + xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, "xmlAddElementDecl: content != NULL for EMPTY\n", NULL); return(NULL); @@ -1405,7 +1405,7 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, break; case XML_ELEMENT_TYPE_ANY: if (content != NULL) { - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, + xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, "xmlAddElementDecl: content != NULL for ANY\n", NULL); return(NULL); @@ -1413,7 +1413,7 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, break; case XML_ELEMENT_TYPE_MIXED: if (content == NULL) { - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, + xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, "xmlAddElementDecl: content == NULL for MIXED\n", NULL); return(NULL); @@ -1421,14 +1421,14 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, break; case XML_ELEMENT_TYPE_ELEMENT: if (content == NULL) { - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, + xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, "xmlAddElementDecl: content == NULL for ELEMENT\n", NULL); return(NULL); } break; default: - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, + xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, "Internal: ELEMENT decl corrupted invalid type\n", NULL); return(NULL); @@ -1608,7 +1608,7 @@ xmlFreeElementTable(xmlElementTablePtr table) { * @elem: An element * * Build a copy of an element. - * + * * Returns the new xmlElementPtr or NULL in case of error. */ static xmlElementPtr @@ -1642,7 +1642,7 @@ xmlCopyElement(xmlElementPtr elem) { * @table: An element table * * Build a copy of an element table. - * + * * Returns the new xmlElementTablePtr or NULL in case of error. */ xmlElementTablePtr @@ -1707,7 +1707,7 @@ xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr ele xmlBufferWriteChar(buf, ">\n"); break; default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "Internal: ELEMENT struct corrupted invalid type\n", NULL); } @@ -1818,7 +1818,7 @@ static void xmlDumpEnumeration(xmlBufferPtr buf, xmlEnumerationPtr cur) { if ((buf == NULL) || (cur == NULL)) return; - + xmlBufferWriteCHAR(buf, cur->name); if (cur->next == NULL) xmlBufferWriteChar(buf, ")"); @@ -1973,13 +1973,13 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, case XML_ATTRIBUTE_NOTATION: break; default: - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, + xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, "Internal: ATTRIBUTE struct corrupted invalid type\n", NULL); xmlFreeEnumeration(tree); return(NULL); } - if ((defaultValue != NULL) && + if ((defaultValue != NULL) && (!xmlValidateAttributeValueInternal(dtd->doc, type, defaultValue))) { xmlErrValidNode(ctxt, (xmlNodePtr) dtd, XML_DTD_ATTRIBUTE_DEFAULT, "Attribute %s of %s: invalid default value\n", @@ -2153,7 +2153,7 @@ xmlFreeAttributeTable(xmlAttributeTablePtr table) { * @attr: An attribute * * Build a copy of an attribute. - * + * * Returns the new xmlAttributePtr or NULL in case of error. */ static xmlAttributePtr @@ -2186,7 +2186,7 @@ xmlCopyAttribute(xmlAttributePtr attr) { * @table: An attribute table * * Build a copy of an attribute table. - * + * * Returns the new xmlAttributeTablePtr or NULL in case of error. */ xmlAttributeTablePtr @@ -2251,7 +2251,7 @@ xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr xmlDumpEnumeration(buf, attr->tree); break; default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "Internal: ATTRIBUTE struct corrupted invalid type\n", NULL); } @@ -2268,7 +2268,7 @@ xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr xmlBufferWriteChar(buf, " #FIXED"); break; default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, + xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, "Internal: ATTRIBUTE struct corrupted invalid def\n", NULL); } @@ -2398,7 +2398,7 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd */ if (xmlHashAddEntry(table, name, ret)) { #ifdef LIBXML_VALID_ENABLED - xmlErrValid(NULL, XML_DTD_NOTATION_REDEFINED, + xmlErrValid(NULL, XML_DTD_NOTATION_REDEFINED, "xmlAddNotationDecl: %s already defined\n", (const char *) name); #endif /* LIBXML_VALID_ENABLED */ @@ -2425,7 +2425,7 @@ xmlFreeNotationTable(xmlNotationTablePtr table) { * @nota: A notation * * Build a copy of a notation. - * + * * Returns the new xmlNotationPtr or NULL in case of error. */ static xmlNotationPtr @@ -2457,7 +2457,7 @@ xmlCopyNotation(xmlNotationPtr nota) { * @table: A notation table * * Build a copy of a notation table. - * + * * Returns the new xmlNotationTablePtr or NULL in case of error. */ xmlNotationTablePtr @@ -2535,7 +2535,7 @@ xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTabl * current scope */ #define DICT_FREE(str) \ - if ((str) && ((!dict) || \ + if ((str) && ((!dict) || \ (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \ xmlFree((char *)(str)); @@ -2573,7 +2573,7 @@ xmlFreeID(xmlIDPtr id) { * * Returns NULL if not, otherwise the new xmlIDPtr */ -xmlIDPtr +xmlIDPtr xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr) { xmlIDPtr ret; @@ -2687,7 +2687,7 @@ xmlIsID(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr att ((xmlStrEqual(BAD_CAST "name", attr->name)) && ((elem == NULL) || (xmlStrEqual(elem->name, BAD_CAST "a"))))) return(1); - return(0); + return(0); } else if (elem == NULL) { return(0); } else { @@ -2741,7 +2741,7 @@ xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) { if (doc == NULL) return(-1); if (attr == NULL) return(-1); table = (xmlIDTablePtr) doc->ids; - if (table == NULL) + if (table == NULL) return(-1); if (attr == NULL) @@ -2769,7 +2769,7 @@ xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) { * * Returns NULL if not found, otherwise the xmlAttrPtr defining the ID */ -xmlAttrPtr +xmlAttrPtr xmlGetID(xmlDocPtr doc, const xmlChar *ID) { xmlIDTablePtr table; xmlIDPtr id; @@ -2783,7 +2783,7 @@ xmlGetID(xmlDocPtr doc, const xmlChar *ID) { } table = (xmlIDTablePtr) doc->ids; - if (table == NULL) + if (table == NULL) return(NULL); id = xmlHashLookup(table, ID); @@ -2804,7 +2804,7 @@ xmlGetID(xmlDocPtr doc, const xmlChar *ID) { * Refs * * * ************************************************************************/ -typedef struct xmlRemoveMemo_t +typedef struct xmlRemoveMemo_t { xmlListPtr l; xmlAttrPtr ap; @@ -2812,7 +2812,7 @@ typedef struct xmlRemoveMemo_t typedef xmlRemoveMemo *xmlRemoveMemoPtr; -typedef struct xmlValidateMemo_t +typedef struct xmlValidateMemo_t { xmlValidCtxtPtr ctxt; const xmlChar *name; @@ -2895,7 +2895,7 @@ xmlDummyCompare(const void *data0 ATTRIBUTE_UNUSED, * * Returns NULL if not, otherwise the new xmlRefPtr */ -xmlRefPtr +xmlRefPtr xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr) { xmlRefPtr ret; @@ -3023,7 +3023,7 @@ xmlIsRef(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr at return(0); } else if (doc->type == XML_HTML_DOCUMENT_NODE) { /* TODO @@@ */ - return(0); + return(0); } else { xmlAttributePtr attrDecl; @@ -3060,7 +3060,7 @@ xmlRemoveRef(xmlDocPtr doc, xmlAttrPtr attr) { if (doc == NULL) return(-1); if (attr == NULL) return(-1); table = (xmlRefTablePtr) doc->refs; - if (table == NULL) + if (table == NULL) return(-1); if (attr == NULL) @@ -3086,7 +3086,7 @@ xmlRemoveRef(xmlDocPtr doc, xmlAttrPtr attr) { */ target.l = ref_list; target.ap = attr; - + /* Remove the supplied attr from our list */ xmlListWalk(ref_list, xmlWalkRemoveRef, &target); @@ -3103,11 +3103,11 @@ xmlRemoveRef(xmlDocPtr doc, xmlAttrPtr attr) { * @doc: pointer to the document * @ID: the ID value * - * Find the set of references for the supplied ID. + * Find the set of references for the supplied ID. * * Returns NULL if not found, otherwise node set for the ID. */ -xmlListPtr +xmlListPtr xmlGetRefs(xmlDocPtr doc, const xmlChar *ID) { xmlRefTablePtr table; @@ -3120,7 +3120,7 @@ xmlGetRefs(xmlDocPtr doc, const xmlChar *ID) { } table = (xmlRefTablePtr) doc->refs; - if (table == NULL) + if (table == NULL) return(NULL); return (xmlHashLookup(table, ID)); @@ -3185,7 +3185,7 @@ xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *na if (dtd->doc != NULL) dict = dtd->doc->dict; - if (!create) + if (!create) return(NULL); /* * Create the Element table if needed. @@ -3798,7 +3798,7 @@ xmlValidateAttributeValueInternal(xmlDocPtr doc, xmlAt * * [ VC: Name Token ] * Values of type NMTOKEN must match the Nmtoken production; values - * of type NMTOKENS must match Nmtokens. + * of type NMTOKENS must match Nmtokens. * * returns 1 if valid or 0 otherwise */ @@ -3857,7 +3857,7 @@ xmlValidateAttributeValue2(xmlValidCtxtPtr ctxt, xmlDo if ((ent == NULL) && (doc->standalone == 1)) { doc->standalone = 0; ent = xmlGetDocEntity(doc, value); - } + } if (ent == NULL) { xmlErrValidNode(ctxt, (xmlNodePtr) doc, XML_DTD_UNKNOWN_ENTITY, @@ -3968,7 +3968,7 @@ xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ct if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(elem->name, elem->ns->prefix, fn, 50); if (fullname == NULL) return(NULL); @@ -4167,7 +4167,7 @@ xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, xmlDocP } } if (nbId > 1) { - + xmlErrValidNodeNr(ctxt, (xmlNodePtr) attr, XML_DTD_ID_SUBSET, "Element %s has %d ID attribute defined in the internal subset : %s\n", attr->elem, nbId, attr->name); @@ -4230,7 +4230,7 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr xmlElementPtr tst; CHECK_DTD; - + if (elem == NULL) return(1); #if 0 @@ -4347,7 +4347,7 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr int xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPtr doc, - xmlNodePtr elem, xmlAttrPtr attr, const xmlChar *value) + xmlNodePtr elem, xmlAttrPtr attr, const xmlChar *value) { xmlAttributePtr attrDecl = NULL; int val; @@ -4360,7 +4360,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPt if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(elem->name, elem->ns->prefix, fn, 50); if (fullname == NULL) return(0); @@ -4444,7 +4444,7 @@ xmlValidateOneAttribute(xmlValidCtxtPtr ctxt, xmlDocPt nota = xmlGetDtdNotationDesc(doc->intSubset, value); if (nota == NULL) nota = xmlGetDtdNotationDesc(doc->extSubset, value); - + if (nota == NULL) { xmlErrValidNode(ctxt, elem, XML_DTD_UNKNOWN_NOTATION, "Value \"%s\" for attribute %s of %s is not a declared Notation\n", @@ -4537,7 +4537,7 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, c if (prefix != NULL) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(elem->name, prefix, fn, 50); if (fullname == NULL) { xmlVErrMemory(ctxt, "Validating namespace"); @@ -4641,7 +4641,7 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, c nota = xmlGetDtdNotationDesc(doc->intSubset, value); if (nota == NULL) nota = xmlGetDtdNotationDesc(doc->extSubset, value); - + if (nota == NULL) { if (ns->prefix != NULL) { xmlErrValidNode(ctxt, elem, XML_DTD_UNKNOWN_NOTATION, @@ -4777,7 +4777,7 @@ xmlValidateElementType(xmlValidCtxtPtr ctxt) { NODE = xmlValidateSkipIgnorable(NODE); if ((NODE == NULL) && (CONT == NULL)) return(1); - if ((NODE == NULL) && + if ((NODE == NULL) && ((CONT->ocur == XML_ELEMENT_CONTENT_MULT) || (CONT->ocur == XML_ELEMENT_CONTENT_OPT))) { return(1); @@ -5236,7 +5236,7 @@ xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNod xmlElementContentPtr cont; const xmlChar *name; - if (elemDecl == NULL) + if ((elemDecl == NULL) || (parent == NULL)) return(-1); cont = elemDecl->content; name = elemDecl->name; @@ -5286,7 +5286,7 @@ xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNod if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(cur->name, cur->ns->prefix, fn, 50); if (fullname == NULL) { @@ -5400,7 +5400,7 @@ fail: last = tmp; } if (cur->type == XML_CDATA_SECTION_NODE) { - /* + /* * E59 spaces in CDATA does not match the * nonterminal S */ @@ -5517,7 +5517,8 @@ xmlValidateOneCdataElement(xmlValidCtxtPtr ctxt, xmlDo int ret = 1; xmlNodePtr cur, child; - if ((ctxt == NULL) || (doc == NULL) || (elem == NULL)) + if ((ctxt == NULL) || (doc == NULL) || (elem == NULL) || + (elem->type != XML_ELEMENT_NODE)) return(0); child = elem->children; @@ -5598,7 +5599,7 @@ xmlValidateCheckMixed(xmlValidCtxtPtr ctxt, } else if ((cont->type != XML_ELEMENT_CONTENT_OR) || (cont->c1 == NULL) || (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){ - xmlErrValid(NULL, XML_DTD_MIXED_CORRUPT, + xmlErrValid(NULL, XML_DTD_MIXED_CORRUPT, "Internal: MIXED struct corrupted\n", NULL); break; @@ -5622,7 +5623,7 @@ xmlValidateCheckMixed(xmlValidCtxtPtr ctxt, } else if ((cont->type != XML_ELEMENT_CONTENT_OR) || (cont->c1 == NULL) || (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){ - xmlErrValid(ctxt, XML_DTD_MIXED_CORRUPT, + xmlErrValid(ctxt, XML_DTD_MIXED_CORRUPT, "Internal: MIXED struct corrupted\n", NULL); break; @@ -5651,7 +5652,7 @@ xmlValidGetElemDecl(xmlValidCtxtPtr ctxt, xmlDocPtr do xmlElementPtr elemDecl = NULL; const xmlChar *prefix = NULL; - if ((ctxt == NULL) || (doc == NULL) || + if ((ctxt == NULL) || (doc == NULL) || (elem == NULL) || (elem->name == NULL)) return(NULL); if (extsubset != NULL) @@ -5795,7 +5796,7 @@ xmlValidatePushElement(xmlValidCtxtPtr ctxt, xmlDocPtr * xmlValidatePushCData: * @ctxt: the validation context * @data: some character data read - * @len: the lenght of the data + * @len: the length of the data * * check the CData parsed for validation in the current stack * @@ -6017,7 +6018,7 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr return(0); /* - * If vstateNr is not zero that means continuous validation is + * If vstateNr is not zero that means continuous validation is * activated, do not try to check the content model at that level. */ if (ctxt->vstateNr == 0) { @@ -6060,7 +6061,7 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr if ((child->ns != NULL) && (child->ns->prefix != NULL)) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(child->name, child->ns->prefix, fn, 50); if (fullname == NULL) @@ -6078,7 +6079,7 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr } else if ((cont->type != XML_ELEMENT_CONTENT_OR) || (cont->c1 == NULL) || (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)){ - xmlErrValid(NULL, XML_DTD_MIXED_CORRUPT, + xmlErrValid(NULL, XML_DTD_MIXED_CORRUPT, "Internal: MIXED struct corrupted\n", NULL); break; @@ -6101,7 +6102,7 @@ xmlValidateOneElement(xmlValidCtxtPtr ctxt, xmlDocPtr } else if ((cont->type != XML_ELEMENT_CONTENT_OR) || (cont->c1 == NULL) || (cont->c1->type != XML_ELEMENT_CONTENT_PCDATA)) { - xmlErrValid(ctxt, XML_DTD_MIXED_CORRUPT, + xmlErrValid(ctxt, XML_DTD_MIXED_CORRUPT, "Internal: MIXED struct corrupted\n", NULL); break; @@ -6181,7 +6182,7 @@ child_ok: } } else { xmlAttrPtr attrib; - + attrib = elem->properties; while (attrib != NULL) { if (xmlStrEqual(attrib->name, attr->name)) { @@ -6196,18 +6197,18 @@ child_ok: * allow to define the URI instead of the prefix :-( */ if (nameSpace == NULL) { - if (qualified < 0) + if (qualified < 0) qualified = 0; } else if (!xmlStrEqual(nameSpace->prefix, attr->prefix)) { - if (qualified < 1) + if (qualified < 1) qualified = 1; } else goto found; } else { /* * We should allow applications to define namespaces - * for their application even if the DTD doesn't + * for their application even if the DTD doesn't * carry one, otherwise, basically we would always * break. */ @@ -6280,7 +6281,7 @@ child_ok: } } } -found: +found: attr = attr->nexth; } return(ret); @@ -6327,7 +6328,7 @@ xmlValidateRoot(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { if ((root->ns != NULL) && (root->ns->prefix != NULL)) { xmlChar fn[50]; xmlChar *fullname; - + fullname = xmlBuildQName(root->name, root->ns->prefix, fn, 50); if (fullname == NULL) { xmlVErrMemory(ctxt, NULL); @@ -6338,7 +6339,7 @@ xmlValidateRoot(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { xmlFree(fullname); if (ret == 1) goto name_ok; - } + } if ((xmlStrEqual(doc->intSubset->name, BAD_CAST "HTML")) && (xmlStrEqual(root->name, BAD_CAST "html"))) goto name_ok; @@ -6359,7 +6360,7 @@ name_ok: * @doc: a document instance * @elem: an element instance * - * Try to validate the subtree under an element + * Try to validate the subtree under an element * * returns 1 if valid or 0 otherwise */ @@ -6379,7 +6380,8 @@ xmlValidateElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc * they don't really mean anything validation wise. */ if ((elem->type == XML_XINCLUDE_START) || - (elem->type == XML_XINCLUDE_END)) + (elem->type == XML_XINCLUDE_END) || + (elem->type == XML_NAMESPACE_DECL)) return(1); CHECK_DTD; @@ -6538,7 +6540,7 @@ xmlValidateCheckRefCallback(xmlListPtr ref_list, xmlVa memo.name = name; xmlListWalk(ref_list, xmlWalkValidateList, &memo); - + } /** @@ -6550,7 +6552,7 @@ xmlValidateCheckRefCallback(xmlListPtr ref_list, xmlVa * incremental validation steps have been completed * * basically it does the following checks described by the XML Rec - * + * * Check all the IDREF/IDREFS attributes definition for validity * * returns 1 if valid or 0 otherwise @@ -6564,7 +6566,7 @@ xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocP if (ctxt == NULL) return(0); if (doc == NULL) { - xmlErrValid(ctxt, XML_DTD_NO_DOC, + xmlErrValid(ctxt, XML_DTD_NO_DOC, "xmlValidateDocumentFinal: doc == NULL\n", NULL); return(0); } @@ -6682,7 +6684,7 @@ xmlValidateAttributeCallback(xmlAttributePtr cur, xmlV case XML_ATTRIBUTE_ENTITIES: case XML_ATTRIBUTE_NOTATION: if (cur->defaultValue != NULL) { - + ret = xmlValidateAttributeValue2(ctxt, ctxt->doc, cur->name, cur->atype, cur->defaultValue); if ((ret == 0) && (ctxt->valid == 1)) @@ -6739,9 +6741,9 @@ xmlValidateAttributeCallback(xmlAttributePtr cur, xmlV * subsets have been parsed * * basically it does the following checks described by the XML Rec - * - check that ENTITY and ENTITIES type attributes default or + * - check that ENTITY and ENTITIES type attributes default or * possible values matches one of the defined entities. - * - check that NOTATION type attributes default or + * - check that NOTATION type attributes default or * possible values matches one of the defined notations. * * returns 1 if valid or 0 if invalid and -1 if not well-formed @@ -6812,7 +6814,7 @@ xmlValidateDocument(xmlValidCtxtPtr ctxt, xmlDocPtr do xmlChar *sysID; if (doc->intSubset->SystemID != NULL) { sysID = xmlBuildURI(doc->intSubset->SystemID, - doc->URL); + doc->URL); if (sysID == NULL) { xmlErrValid(ctxt, XML_DTD_LOAD_ERROR, "Could not build URI for external subset \"%s\"\n", @@ -6885,17 +6887,17 @@ xmlValidGetPotentialChildren(xmlElementContent *ctree, if (*len >= max) return(*len); switch (ctree->type) { - case XML_ELEMENT_CONTENT_PCDATA: + case XML_ELEMENT_CONTENT_PCDATA: for (i = 0; i < *len;i++) if (xmlStrEqual(BAD_CAST "#PCDATA", names[i])) return(*len); names[(*len)++] = BAD_CAST "#PCDATA"; break; - case XML_ELEMENT_CONTENT_ELEMENT: + case XML_ELEMENT_CONTENT_ELEMENT: for (i = 0; i < *len;i++) if (xmlStrEqual(ctree->name, names[i])) return(*len); names[(*len)++] = ctree->name; break; - case XML_ELEMENT_CONTENT_SEQ: + case XML_ELEMENT_CONTENT_SEQ: xmlValidGetPotentialChildren(ctree->c1, names, len, max); xmlValidGetPotentialChildren(ctree->c2, names, len, max); break; @@ -6904,7 +6906,7 @@ xmlValidGetPotentialChildren(xmlElementContent *ctree, xmlValidGetPotentialChildren(ctree->c2, names, len, max); break; } - + return(*len); } @@ -6949,16 +6951,16 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar *elements[256]; int nb_elements = 0, i; const xmlChar *name; - + xmlNode *ref_node; xmlNode *parent; xmlNode *test_node; - + xmlNode *prev_next; xmlNode *next_prev; xmlNode *parent_childs; xmlNode *parent_last; - + xmlElement *element_desc; if (prev == NULL && next == NULL) @@ -6983,7 +6985,7 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, element_desc = xmlGetDtdElementDesc(parent->doc->extSubset, parent->name); if (element_desc == NULL) return(-1); - + /* * Do a backup of the current tree structure */ @@ -6994,16 +6996,16 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, /* * Creates a dummy node and insert it into the tree - */ + */ test_node = xmlNewDocNode (ref_node->doc, NULL, BAD_CAST "", NULL); test_node->parent = parent; test_node->prev = prev; test_node->next = next; name = test_node->name; - + if (prev) prev->next = test_node; else parent->children = test_node; - + if (next) next->prev = test_node; else parent->last = test_node; @@ -7013,7 +7015,7 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, */ nb_elements = xmlValidGetPotentialChildren(element_desc->content, elements, &nb_elements, 256); - + for (i = 0;i < nb_elements;i++) { test_node->name = elements[i]; if (xmlValidateOneElement(&vctxt, parent->doc, parent)) {