1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-26 10:03:34 +03:00

schemas: Stop using xmlValidateNotationUse

Simplify symbol availability logic.
This commit is contained in:
Nick Wellnhofer 2024-06-16 00:39:39 +02:00
parent fa01278dcd
commit 1b6403583b
5 changed files with 14 additions and 14 deletions

View File

@ -16791,7 +16791,7 @@ Could we use @subtypes for this?'/>
<arg name='nota' type='xmlNotationPtr' info='a notation definition'/>
</function>
<function name='xmlValidateNotationUse' file='valid' module='valid'>
<cond>defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)</cond>
<cond>defined(LIBXML_VALID_ENABLED)</cond>
<info>DEPRECATED: Internal function, don&apos;t use. Validate that the given name match a notation declaration. - [ VC: Notation Declared ]</info>
<return type='int' info='1 if valid or 0 otherwise'/>
<arg name='ctxt' type='xmlValidCtxtPtr' info='the validation context'/>

View File

@ -378,15 +378,12 @@ XML_DEPRECATED
XMLPUBFUN int
xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
#endif /* LIBXML_VALID_ENABLED */
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XML_DEPRECATED
XMLPUBFUN int
xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *notationName);
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
#endif /* LIBXML_VALID_ENABLED */
XMLPUBFUN int
xmlIsMixedElement (xmlDocPtr doc,

View File

@ -27445,7 +27445,7 @@ static int
test_xmlValidateNotationUse(void) {
int test_ret = 0;
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
#if defined(LIBXML_VALID_ENABLED)
int mem_base;
int ret_val;
xmlValidCtxtPtr ctxt; /* the validation context */

10
valid.c
View File

@ -119,7 +119,7 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error,
NULL, NULL, 0, msg, extra);
}
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
#ifdef LIBXML_VALID_ENABLED
/**
* xmlErrValidNode:
* @ctxt: an XML validation parser context
@ -140,9 +140,7 @@ xmlErrValidNode(xmlValidCtxtPtr ctxt,
xmlDoErrValid(ctxt, node, error, XML_ERR_ERROR, str1, str2, str3, 0,
msg, str1, str2, str3);
}
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
#ifdef LIBXML_VALID_ENABLED
/**
* xmlErrValidNodeNr:
* @ctxt: an XML validation parser context
@ -3149,7 +3147,7 @@ xmlGetDtdNotationDesc(xmlDtdPtr dtd, const xmlChar *name) {
return(xmlHashLookup(table, name));
}
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
#ifdef LIBXML_VALID_ENABLED
/**
* xmlValidateNotationUse:
* @ctxt: the validation context
@ -3175,7 +3173,7 @@ xmlValidateNotationUse(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
if ((notaDecl == NULL) && (doc->extSubset != NULL))
notaDecl = xmlGetDtdNotationDesc(doc->extSubset, notationName);
if ((notaDecl == NULL) && (ctxt != NULL)) {
if (notaDecl == NULL) {
xmlErrValidNode(ctxt, (xmlNodePtr) doc, XML_DTD_UNKNOWN_NOTATION,
"NOTATION %s is not declared\n",
notationName, NULL, NULL);
@ -3183,7 +3181,7 @@ xmlValidateNotationUse(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
}
return(1);
}
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
#endif /* LIBXML_VALID_ENABLED */
/**
* xmlIsMixedElement:

View File

@ -3196,8 +3196,13 @@ xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xmlChar * value,
if ((node == NULL) || (node->doc == NULL))
ret = 3;
if (ret == 0) {
ret = xmlValidateNotationUse(NULL, node->doc, value);
if (ret == 1)
xmlNotationPtr nota;
nota = xmlGetDtdNotationDesc(node->doc->intSubset, value);
if ((nota == NULL) && (node->doc->extSubset != NULL))
nota = xmlGetDtdNotationDesc(node->doc->extSubset,
value);
if (nota != NULL)
ret = 0;
else
ret = 1;