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