mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(libxml2) LIBXML_VALID_ENABLED removed
This commit is contained in:
parent
3a230c0aab
commit
f338529585
@ -744,14 +744,6 @@ xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
|
||||
xmlFreeEnumeration(tree);
|
||||
return;
|
||||
}
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if (ctxt->vctxt.valid == 0)
|
||||
ctxt->valid = 0;
|
||||
if ((attr != NULL) && (ctxt->validate) && (ctxt->wellFormed) &&
|
||||
(ctxt->myDoc->intSubset != NULL))
|
||||
ctxt->valid &= xmlValidateAttributeDecl(&ctxt->vctxt, ctxt->myDoc,
|
||||
attr);
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
if (prefix != NULL)
|
||||
xmlFree(prefix);
|
||||
if (name != NULL)
|
||||
@ -794,14 +786,6 @@ xmlSAX2ElementDecl(void *ctx, const xmlChar * name, int type,
|
||||
name, NULL);
|
||||
return;
|
||||
}
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if (elem == NULL)
|
||||
ctxt->valid = 0;
|
||||
if (ctxt->validate && ctxt->wellFormed &&
|
||||
ctxt->myDoc && ctxt->myDoc->intSubset)
|
||||
ctxt->valid &=
|
||||
xmlValidateElementDecl(&ctxt->vctxt, ctxt->myDoc, elem);
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -845,13 +829,6 @@ xmlSAX2NotationDecl(void *ctx, const xmlChar *name,
|
||||
name, NULL);
|
||||
return;
|
||||
}
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if (nota == NULL) ctxt->valid = 0;
|
||||
if ((ctxt->validate) && (ctxt->wellFormed) &&
|
||||
(ctxt->myDoc->intSubset != NULL))
|
||||
ctxt->valid &= xmlValidateNotationDecl(&ctxt->vctxt, ctxt->myDoc,
|
||||
nota);
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1011,11 +988,6 @@ xmlSAX2EndDocument(void *ctx)
|
||||
"SAX.xmlSAX2EndDocument()\n");
|
||||
#endif
|
||||
if (ctx == NULL) return;
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if (ctxt->validate && ctxt->wellFormed &&
|
||||
ctxt->myDoc && ctxt->myDoc->intSubset)
|
||||
ctxt->valid &= xmlValidateDocumentFinal(&ctxt->vctxt, ctxt->myDoc);
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
/*
|
||||
* Grab the encoding if it was added on-the-fly
|
||||
@ -1116,37 +1088,6 @@ skip:
|
||||
return(ret);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
/*
|
||||
* xmlSAX2DecodeAttrEntities:
|
||||
* @ctxt: the parser context
|
||||
* @str: the input string
|
||||
* @len: the string length
|
||||
*
|
||||
* Remove the entities from an attribute value
|
||||
*
|
||||
* Returns the newly allocated string or NULL if not needed or error
|
||||
*/
|
||||
static xmlChar *
|
||||
xmlSAX2DecodeAttrEntities(xmlParserCtxtPtr ctxt, const xmlChar *str,
|
||||
const xmlChar *end) {
|
||||
const xmlChar *in;
|
||||
xmlChar *ret;
|
||||
|
||||
in = str;
|
||||
while (in < end)
|
||||
if (*in++ == '&')
|
||||
goto decode;
|
||||
return(NULL);
|
||||
decode:
|
||||
ctxt->depth++;
|
||||
ret = xmlStringLenDecodeEntities(ctxt, str, end - str,
|
||||
XML_SUBSTITUTE_REF, 0,0,0);
|
||||
ctxt->depth--;
|
||||
return(ret);
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
/**
|
||||
* xmlSAX2AttributeNs:
|
||||
* @ctx: the user data (XML parser context)
|
||||
@ -1262,76 +1203,6 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
|
||||
ctxt->myDoc && ctxt->myDoc->intSubset) {
|
||||
/*
|
||||
* If we don't substitute entities, the validation should be
|
||||
* done on a value with replaced entities anyway.
|
||||
*/
|
||||
if (!ctxt->replaceEntities) {
|
||||
dup = xmlSAX2DecodeAttrEntities(ctxt, value, valueend);
|
||||
if (dup == NULL) {
|
||||
if (*valueend == 0) {
|
||||
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
||||
ctxt->myDoc, ctxt->node, ret, value);
|
||||
} else {
|
||||
/*
|
||||
* That should already be normalized.
|
||||
* cheaper to finally allocate here than duplicate
|
||||
* entry points in the full validation code
|
||||
*/
|
||||
dup = xmlStrndup(value, valueend - value);
|
||||
|
||||
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
||||
ctxt->myDoc, ctxt->node, ret, dup);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* dup now contains a string of the flattened attribute
|
||||
* content with entities substitued. Check if we need to
|
||||
* apply an extra layer of normalization.
|
||||
* It need to be done twice ... it's an extra burden related
|
||||
* to the ability to keep references in attributes
|
||||
*/
|
||||
if (ctxt->attsSpecial != NULL) {
|
||||
xmlChar *nvalnorm;
|
||||
xmlChar fn[50];
|
||||
xmlChar *fullname;
|
||||
|
||||
fullname = xmlBuildQName(localname, prefix, fn, 50);
|
||||
if (fullname != NULL) {
|
||||
ctxt->vctxt.valid = 1;
|
||||
nvalnorm = xmlValidCtxtNormalizeAttributeValue(
|
||||
&ctxt->vctxt, ctxt->myDoc,
|
||||
ctxt->node, fullname, dup);
|
||||
if (ctxt->vctxt.valid != 1)
|
||||
ctxt->valid = 0;
|
||||
|
||||
if ((fullname != fn) && (fullname != localname))
|
||||
xmlFree(fullname);
|
||||
if (nvalnorm != NULL) {
|
||||
xmlFree(dup);
|
||||
dup = nvalnorm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
||||
ctxt->myDoc, ctxt->node, ret, dup);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* if entities already have been substitued, then
|
||||
* the attribute as passed is already normalized
|
||||
*/
|
||||
dup = xmlStrndup(value, valueend - value);
|
||||
|
||||
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
|
||||
ctxt->myDoc, ctxt->node, ret, dup);
|
||||
}
|
||||
} else
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) &&
|
||||
(((ctxt->replaceEntities == 0) && (ctxt->external != 2)) ||
|
||||
((ctxt->replaceEntities != 0) && (ctxt->inSubset == 0)))) {
|
||||
@ -1349,13 +1220,6 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
|
||||
*/
|
||||
if (dup == NULL)
|
||||
dup = xmlStrndup(value, valueend - value);
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if (xmlValidateNCName(dup, 1) != 0) {
|
||||
xmlErrValid(ctxt, XML_DTD_XMLID_VALUE,
|
||||
"xml:id : attribute value %s is not an NCName\n",
|
||||
(const char *) dup, NULL);
|
||||
}
|
||||
#endif
|
||||
xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret);
|
||||
} else if (xmlIsID(ctxt->myDoc, ctxt->node, ret)) {
|
||||
/* might be worth duplicate entry points and not copy */
|
||||
@ -1512,13 +1376,6 @@ xmlSAX2StartElementNs(void *ctx,
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
|
||||
ctxt->myDoc && ctxt->myDoc->intSubset) {
|
||||
ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
|
||||
ret, prefix, ns, uri);
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
}
|
||||
ctxt->nodemem = -1;
|
||||
|
||||
@ -1607,23 +1464,6 @@ xmlSAX2StartElementNs(void *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
/*
|
||||
* If it's the Document root, finish the DTD validation and
|
||||
* check the document root element for validity
|
||||
*/
|
||||
if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) {
|
||||
int chk;
|
||||
|
||||
chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
|
||||
if (chk <= 0)
|
||||
ctxt->valid = 0;
|
||||
if (chk < 0)
|
||||
ctxt->wellFormed = 0;
|
||||
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
|
||||
ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1;
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1657,11 +1497,6 @@ xmlSAX2EndElementNs(void *ctx,
|
||||
}
|
||||
ctxt->nodemem = -1;
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if (ctxt->validate && ctxt->wellFormed &&
|
||||
ctxt->myDoc && ctxt->myDoc->intSubset)
|
||||
ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc, cur);
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
/*
|
||||
* end of parsing of this node.
|
||||
|
@ -1743,18 +1743,6 @@ extern __typeof (xmlFreeURI) xmlFreeURI__internal_alias __attribute((visibility(
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlFreeValidCtxt
|
||||
extern __typeof (xmlFreeValidCtxt) xmlFreeValidCtxt __attribute((alias("xmlFreeValidCtxt__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlFreeValidCtxt
|
||||
extern __typeof (xmlFreeValidCtxt) xmlFreeValidCtxt__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlFreeValidCtxt xmlFreeValidCtxt__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_xmlmemory
|
||||
#undef xmlGcMemGet
|
||||
extern __typeof (xmlGcMemGet) xmlGcMemGet __attribute((alias("xmlGcMemGet__internal_alias")));
|
||||
@ -2349,18 +2337,6 @@ extern __typeof (xmlHashUpdateEntry3) xmlHashUpdateEntry3__internal_alias __attr
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_parser
|
||||
#undef xmlIOParseDTD
|
||||
extern __typeof (xmlIOParseDTD) xmlIOParseDTD __attribute((alias("xmlIOParseDTD__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlIOParseDTD
|
||||
extern __typeof (xmlIOParseDTD) xmlIOParseDTD__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlIOParseDTD xmlIOParseDTD__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_encoding
|
||||
#undef xmlInitCharEncodingHandlers
|
||||
extern __typeof (xmlInitCharEncodingHandlers) xmlInitCharEncodingHandlers __attribute((alias("xmlInitCharEncodingHandlers__internal_alias")));
|
||||
@ -3488,18 +3464,6 @@ extern __typeof (xmlNewTextReaderFilename) xmlNewTextReaderFilename__internal_al
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlNewValidCtxt
|
||||
extern __typeof (xmlNewValidCtxt) xmlNewValidCtxt __attribute((alias("xmlNewValidCtxt__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlNewValidCtxt
|
||||
extern __typeof (xmlNewValidCtxt) xmlNewValidCtxt__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlNewValidCtxt xmlNewValidCtxt__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_parserInternals
|
||||
#undef xmlNextChar
|
||||
extern __typeof (xmlNextChar) xmlNextChar __attribute((alias("xmlNextChar__internal_alias")));
|
||||
@ -3847,18 +3811,6 @@ extern __typeof (xmlParseCtxtExternalEntity) xmlParseCtxtExternalEntity__interna
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_parser
|
||||
#undef xmlParseDTD
|
||||
extern __typeof (xmlParseDTD) xmlParseDTD __attribute((alias("xmlParseDTD__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlParseDTD
|
||||
extern __typeof (xmlParseDTD) xmlParseDTD__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlParseDTD xmlParseDTD__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_parser
|
||||
#undef xmlParseDefaultDecl
|
||||
extern __typeof (xmlParseDefaultDecl) xmlParseDefaultDecl __attribute((alias("xmlParseDefaultDecl__internal_alias")));
|
||||
@ -5189,18 +5141,6 @@ extern __typeof (xmlSAX2UnparsedEntityDecl) xmlSAX2UnparsedEntityDecl__internal_
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_parser
|
||||
#undef xmlSAXParseDTD
|
||||
extern __typeof (xmlSAXParseDTD) xmlSAXParseDTD __attribute((alias("xmlSAXParseDTD__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlSAXParseDTD
|
||||
extern __typeof (xmlSAXParseDTD) xmlSAXParseDTD__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlSAXParseDTD xmlSAXParseDTD__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_SAX2
|
||||
#undef xmlSAXVersion
|
||||
extern __typeof (xmlSAXVersion) xmlSAXVersion __attribute((alias("xmlSAXVersion__internal_alias")));
|
||||
@ -6794,150 +6734,6 @@ extern __typeof (xmlUnsetProp) xmlUnsetProp__internal_alias __attribute((visibil
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidCtxtNormalizeAttributeValue
|
||||
extern __typeof (xmlValidCtxtNormalizeAttributeValue) xmlValidCtxtNormalizeAttributeValue __attribute((alias("xmlValidCtxtNormalizeAttributeValue__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidCtxtNormalizeAttributeValue
|
||||
extern __typeof (xmlValidCtxtNormalizeAttributeValue) xmlValidCtxtNormalizeAttributeValue__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidCtxtNormalizeAttributeValue xmlValidCtxtNormalizeAttributeValue__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidGetPotentialChildren
|
||||
extern __typeof (xmlValidGetPotentialChildren) xmlValidGetPotentialChildren __attribute((alias("xmlValidGetPotentialChildren__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidGetPotentialChildren
|
||||
extern __typeof (xmlValidGetPotentialChildren) xmlValidGetPotentialChildren__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidGetPotentialChildren xmlValidGetPotentialChildren__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidGetValidElements
|
||||
extern __typeof (xmlValidGetValidElements) xmlValidGetValidElements __attribute((alias("xmlValidGetValidElements__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidGetValidElements
|
||||
extern __typeof (xmlValidGetValidElements) xmlValidGetValidElements__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidGetValidElements xmlValidGetValidElements__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidNormalizeAttributeValue
|
||||
extern __typeof (xmlValidNormalizeAttributeValue) xmlValidNormalizeAttributeValue __attribute((alias("xmlValidNormalizeAttributeValue__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidNormalizeAttributeValue
|
||||
extern __typeof (xmlValidNormalizeAttributeValue) xmlValidNormalizeAttributeValue__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidNormalizeAttributeValue xmlValidNormalizeAttributeValue__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateAttributeDecl
|
||||
extern __typeof (xmlValidateAttributeDecl) xmlValidateAttributeDecl __attribute((alias("xmlValidateAttributeDecl__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateAttributeDecl
|
||||
extern __typeof (xmlValidateAttributeDecl) xmlValidateAttributeDecl__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateAttributeDecl xmlValidateAttributeDecl__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateAttributeValue
|
||||
extern __typeof (xmlValidateAttributeValue) xmlValidateAttributeValue __attribute((alias("xmlValidateAttributeValue__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateAttributeValue
|
||||
extern __typeof (xmlValidateAttributeValue) xmlValidateAttributeValue__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateAttributeValue xmlValidateAttributeValue__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateDocument
|
||||
extern __typeof (xmlValidateDocument) xmlValidateDocument __attribute((alias("xmlValidateDocument__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateDocument
|
||||
extern __typeof (xmlValidateDocument) xmlValidateDocument__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateDocument xmlValidateDocument__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateDocumentFinal
|
||||
extern __typeof (xmlValidateDocumentFinal) xmlValidateDocumentFinal __attribute((alias("xmlValidateDocumentFinal__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateDocumentFinal
|
||||
extern __typeof (xmlValidateDocumentFinal) xmlValidateDocumentFinal__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateDocumentFinal xmlValidateDocumentFinal__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateDtd
|
||||
extern __typeof (xmlValidateDtd) xmlValidateDtd __attribute((alias("xmlValidateDtd__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateDtd
|
||||
extern __typeof (xmlValidateDtd) xmlValidateDtd__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateDtd xmlValidateDtd__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateDtdFinal
|
||||
extern __typeof (xmlValidateDtdFinal) xmlValidateDtdFinal __attribute((alias("xmlValidateDtdFinal__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateDtdFinal
|
||||
extern __typeof (xmlValidateDtdFinal) xmlValidateDtdFinal__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateDtdFinal xmlValidateDtdFinal__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateElement
|
||||
extern __typeof (xmlValidateElement) xmlValidateElement __attribute((alias("xmlValidateElement__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateElement
|
||||
extern __typeof (xmlValidateElement) xmlValidateElement__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateElement xmlValidateElement__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateElementDecl
|
||||
extern __typeof (xmlValidateElementDecl) xmlValidateElementDecl __attribute((alias("xmlValidateElementDecl__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateElementDecl
|
||||
extern __typeof (xmlValidateElementDecl) xmlValidateElementDecl__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateElementDecl xmlValidateElementDecl__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
#ifdef bottom_tree
|
||||
#undef xmlValidateNCName
|
||||
@ -6974,114 +6770,6 @@ extern __typeof (xmlValidateName) xmlValidateName__internal_alias __attribute((v
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateNameValue
|
||||
extern __typeof (xmlValidateNameValue) xmlValidateNameValue __attribute((alias("xmlValidateNameValue__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateNameValue
|
||||
extern __typeof (xmlValidateNameValue) xmlValidateNameValue__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateNameValue xmlValidateNameValue__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateNamesValue
|
||||
extern __typeof (xmlValidateNamesValue) xmlValidateNamesValue __attribute((alias("xmlValidateNamesValue__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateNamesValue
|
||||
extern __typeof (xmlValidateNamesValue) xmlValidateNamesValue__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateNamesValue xmlValidateNamesValue__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateNmtokenValue
|
||||
extern __typeof (xmlValidateNmtokenValue) xmlValidateNmtokenValue __attribute((alias("xmlValidateNmtokenValue__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateNmtokenValue
|
||||
extern __typeof (xmlValidateNmtokenValue) xmlValidateNmtokenValue__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateNmtokenValue xmlValidateNmtokenValue__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateNmtokensValue
|
||||
extern __typeof (xmlValidateNmtokensValue) xmlValidateNmtokensValue __attribute((alias("xmlValidateNmtokensValue__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateNmtokensValue
|
||||
extern __typeof (xmlValidateNmtokensValue) xmlValidateNmtokensValue__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateNmtokensValue xmlValidateNmtokensValue__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateNotationDecl
|
||||
extern __typeof (xmlValidateNotationDecl) xmlValidateNotationDecl __attribute((alias("xmlValidateNotationDecl__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateNotationDecl
|
||||
extern __typeof (xmlValidateNotationDecl) xmlValidateNotationDecl__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateNotationDecl xmlValidateNotationDecl__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateNotationUse
|
||||
extern __typeof (xmlValidateNotationUse) xmlValidateNotationUse __attribute((alias("xmlValidateNotationUse__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateNotationUse
|
||||
extern __typeof (xmlValidateNotationUse) xmlValidateNotationUse__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateNotationUse xmlValidateNotationUse__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateOneAttribute
|
||||
extern __typeof (xmlValidateOneAttribute) xmlValidateOneAttribute __attribute((alias("xmlValidateOneAttribute__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateOneAttribute
|
||||
extern __typeof (xmlValidateOneAttribute) xmlValidateOneAttribute__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateOneAttribute xmlValidateOneAttribute__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateOneElement
|
||||
extern __typeof (xmlValidateOneElement) xmlValidateOneElement __attribute((alias("xmlValidateOneElement__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateOneElement
|
||||
extern __typeof (xmlValidateOneElement) xmlValidateOneElement__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateOneElement xmlValidateOneElement__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateOneNamespace
|
||||
extern __typeof (xmlValidateOneNamespace) xmlValidateOneNamespace __attribute((alias("xmlValidateOneNamespace__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateOneNamespace
|
||||
extern __typeof (xmlValidateOneNamespace) xmlValidateOneNamespace__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateOneNamespace xmlValidateOneNamespace__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
#ifdef bottom_tree
|
||||
#undef xmlValidateQName
|
||||
@ -7094,18 +6782,6 @@ extern __typeof (xmlValidateQName) xmlValidateQName__internal_alias __attribute(
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
#ifdef bottom_valid
|
||||
#undef xmlValidateRoot
|
||||
extern __typeof (xmlValidateRoot) xmlValidateRoot __attribute((alias("xmlValidateRoot__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlValidateRoot
|
||||
extern __typeof (xmlValidateRoot) xmlValidateRoot__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlValidateRoot xmlValidateRoot__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
@ -854,19 +854,6 @@ XMLPUBFUN int XMLCALL
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
XMLPUBFUN xmlDtdPtr XMLCALL
|
||||
xmlSAXParseDTD (xmlSAXHandlerPtr sax,
|
||||
const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
XMLPUBFUN xmlDtdPtr XMLCALL
|
||||
xmlParseDTD (const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID);
|
||||
XMLPUBFUN xmlDtdPtr XMLCALL
|
||||
xmlIOParseDTD (xmlSAXHandlerPtr sax,
|
||||
xmlParserInputBufferPtr input,
|
||||
xmlCharEncoding enc);
|
||||
#endif /* LIBXML_VALID_ENABLE */
|
||||
XMLPUBFUN xmlParserErrors XMLCALL
|
||||
xmlParseInNodeContext (xmlNodePtr node,
|
||||
const char *data,
|
||||
|
@ -268,84 +268,6 @@ XMLPUBFUN xmlListPtr XMLCALL
|
||||
/**
|
||||
* The public function calls related to validity checking.
|
||||
*/
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
/* Allocate/Release Validation Contexts */
|
||||
XMLPUBFUN xmlValidCtxtPtr XMLCALL
|
||||
xmlNewValidCtxt(void);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlFreeValidCtxt(xmlValidCtxtPtr);
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateRoot (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlElementPtr elem);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlValidNormalizeAttributeValue(xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
const xmlChar *name,
|
||||
const xmlChar *value);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
const xmlChar *name,
|
||||
const xmlChar *value);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlAttributePtr attr);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateAttributeValue(xmlAttributeType type,
|
||||
const xmlChar *value);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNotationPtr nota);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateDtd (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlDtdPtr dtd);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateDocument (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateElement (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateOneElement (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
xmlAttrPtr attr,
|
||||
const xmlChar *value);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem,
|
||||
const xmlChar *prefix,
|
||||
xmlNsPtr ns,
|
||||
const xmlChar *value);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
const xmlChar *notationName);
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlIsMixedElement (xmlDocPtr doc,
|
||||
@ -370,29 +292,6 @@ XMLPUBFUN xmlElementPtr XMLCALL
|
||||
xmlGetDtdElementDesc (xmlDtdPtr dtd,
|
||||
const xmlChar *name);
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidGetPotentialChildren(xmlElementContent *ctree,
|
||||
const xmlChar **names,
|
||||
int *len,
|
||||
int max);
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidGetValidElements(xmlNode *prev,
|
||||
xmlNode *next,
|
||||
const xmlChar **names,
|
||||
int max);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateNameValue (const xmlChar *value);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateNamesValue (const xmlChar *value);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateNmtokenValue (const xmlChar *value);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateNmtokensValue(const xmlChar *value);
|
||||
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -112,15 +112,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
||||
#define LIBXML_READER_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_VALID_ENABLED:
|
||||
*
|
||||
* Whether the DTD validation support is configured in
|
||||
*/
|
||||
#if 0
|
||||
#define LIBXML_VALID_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_ICONV_ENABLED:
|
||||
*
|
||||
|
@ -793,11 +793,7 @@ xmlHasFeature(xmlFeature feature)
|
||||
case XML_WITH_HTTP:
|
||||
return(0);
|
||||
case XML_WITH_VALID:
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
return(1);
|
||||
#else
|
||||
return(0);
|
||||
#endif
|
||||
case XML_WITH_HTML:
|
||||
return(0);
|
||||
case XML_WITH_LEGACY:
|
||||
@ -9073,17 +9069,6 @@ xmlParseElement(xmlParserCtxtPtr ctxt) {
|
||||
namePush(ctxt, name);
|
||||
ret = ctxt->node;
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
/*
|
||||
* [ VC: Root Element Type ]
|
||||
* The Name in the document type declaration must match the element
|
||||
* type of the root element.
|
||||
*/
|
||||
if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc &&
|
||||
ctxt->node && (ctxt->node == ctxt->myDoc->children))
|
||||
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
/*
|
||||
* Check for an Empty Element.
|
||||
*/
|
||||
@ -10444,16 +10429,6 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
|
||||
ctxt->sax->endDocument(ctxt->userData);
|
||||
goto done;
|
||||
}
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
/*
|
||||
* [ VC: Root Element Type ]
|
||||
* The Name in the document type declaration must match
|
||||
* the element type of the root element.
|
||||
*/
|
||||
if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc &&
|
||||
ctxt->node && (ctxt->node == ctxt->myDoc->children))
|
||||
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
/*
|
||||
* Check for an Empty Element.
|
||||
@ -11450,287 +11425,6 @@ xmlCreateIOParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
|
||||
return(ctxt);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
/************************************************************************
|
||||
* *
|
||||
* Front ends when parsing a DTD *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
/**
|
||||
* xmlIOParseDTD:
|
||||
* @sax: the SAX handler block or NULL
|
||||
* @input: an Input Buffer
|
||||
* @enc: the charset encoding if known
|
||||
*
|
||||
* Load and parse a DTD
|
||||
*
|
||||
* Returns the resulting xmlDtdPtr or NULL in case of error.
|
||||
* @input will be freed by the function in any case.
|
||||
*/
|
||||
|
||||
xmlDtdPtr
|
||||
xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
|
||||
xmlCharEncoding enc) {
|
||||
xmlDtdPtr ret = NULL;
|
||||
xmlParserCtxtPtr ctxt;
|
||||
xmlParserInputPtr pinput = NULL;
|
||||
xmlChar start[4];
|
||||
|
||||
if (input == NULL)
|
||||
return(NULL);
|
||||
|
||||
ctxt = xmlNewParserCtxt();
|
||||
if (ctxt == NULL) {
|
||||
xmlFreeParserInputBuffer(input);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set-up the SAX context
|
||||
*/
|
||||
if (sax != NULL) {
|
||||
if (ctxt->sax != NULL)
|
||||
xmlFree(ctxt->sax);
|
||||
ctxt->sax = sax;
|
||||
ctxt->userData = ctxt;
|
||||
}
|
||||
xmlDetectSAX2(ctxt);
|
||||
|
||||
/*
|
||||
* generate a parser input from the I/O handler
|
||||
*/
|
||||
|
||||
pinput = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE);
|
||||
if (pinput == NULL) {
|
||||
if (sax != NULL) ctxt->sax = NULL;
|
||||
xmlFreeParserInputBuffer(input);
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* plug some encoding conversion routines here.
|
||||
*/
|
||||
if (xmlPushInput(ctxt, pinput) < 0) {
|
||||
if (sax != NULL) ctxt->sax = NULL;
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
if (enc != XML_CHAR_ENCODING_NONE) {
|
||||
xmlSwitchEncoding(ctxt, enc);
|
||||
}
|
||||
|
||||
pinput->filename = NULL;
|
||||
pinput->line = 1;
|
||||
pinput->col = 1;
|
||||
pinput->base = ctxt->input->cur;
|
||||
pinput->cur = ctxt->input->cur;
|
||||
pinput->free = NULL;
|
||||
|
||||
/*
|
||||
* let's parse that entity knowing it's an external subset.
|
||||
*/
|
||||
ctxt->inSubset = 2;
|
||||
ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0");
|
||||
if (ctxt->myDoc == NULL) {
|
||||
xmlErrMemory(ctxt, "New Doc failed");
|
||||
return(NULL);
|
||||
}
|
||||
ctxt->myDoc->properties = XML_DOC_INTERNAL;
|
||||
ctxt->myDoc->extSubset = xmlNewDtd(ctxt->myDoc, BAD_CAST "none",
|
||||
BAD_CAST "none", BAD_CAST "none");
|
||||
|
||||
if ((enc == XML_CHAR_ENCODING_NONE) &&
|
||||
((ctxt->input->end - ctxt->input->cur) >= 4)) {
|
||||
/*
|
||||
* Get the 4 first bytes and decode the charset
|
||||
* if enc != XML_CHAR_ENCODING_NONE
|
||||
* plug some encoding conversion routines.
|
||||
*/
|
||||
start[0] = RAW;
|
||||
start[1] = NXT(1);
|
||||
start[2] = NXT(2);
|
||||
start[3] = NXT(3);
|
||||
enc = xmlDetectCharEncoding(start, 4);
|
||||
if (enc != XML_CHAR_ENCODING_NONE) {
|
||||
xmlSwitchEncoding(ctxt, enc);
|
||||
}
|
||||
}
|
||||
|
||||
xmlParseExternalSubset(ctxt, BAD_CAST "none", BAD_CAST "none");
|
||||
|
||||
if (ctxt->myDoc != NULL) {
|
||||
if (ctxt->wellFormed) {
|
||||
ret = ctxt->myDoc->extSubset;
|
||||
ctxt->myDoc->extSubset = NULL;
|
||||
if (ret != NULL) {
|
||||
xmlNodePtr tmp;
|
||||
|
||||
ret->doc = NULL;
|
||||
tmp = ret->children;
|
||||
while (tmp != NULL) {
|
||||
tmp->doc = NULL;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = NULL;
|
||||
}
|
||||
xmlFreeDoc(ctxt->myDoc);
|
||||
ctxt->myDoc = NULL;
|
||||
}
|
||||
if (sax != NULL) ctxt->sax = NULL;
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlSAXParseDTD:
|
||||
* @sax: the SAX handler block
|
||||
* @ExternalID: a NAME* containing the External ID of the DTD
|
||||
* @SystemID: a NAME* containing the URL to the DTD
|
||||
*
|
||||
* Load and parse an external subset.
|
||||
*
|
||||
* Returns the resulting xmlDtdPtr or NULL in case of error.
|
||||
*/
|
||||
|
||||
xmlDtdPtr
|
||||
xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
|
||||
const xmlChar *SystemID) {
|
||||
xmlDtdPtr ret = NULL;
|
||||
xmlParserCtxtPtr ctxt;
|
||||
xmlParserInputPtr input = NULL;
|
||||
xmlCharEncoding enc;
|
||||
xmlChar* systemIdCanonic;
|
||||
|
||||
if ((ExternalID == NULL) && (SystemID == NULL)) return(NULL);
|
||||
|
||||
ctxt = xmlNewParserCtxt();
|
||||
if (ctxt == NULL) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set-up the SAX context
|
||||
*/
|
||||
if (sax != NULL) {
|
||||
if (ctxt->sax != NULL)
|
||||
xmlFree(ctxt->sax);
|
||||
ctxt->sax = sax;
|
||||
ctxt->userData = ctxt;
|
||||
}
|
||||
|
||||
/*
|
||||
* Canonicalise the system ID
|
||||
*/
|
||||
systemIdCanonic = xmlCanonicPath(SystemID);
|
||||
if ((SystemID != NULL) && (systemIdCanonic == NULL)) {
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Ask the Entity resolver to load the damn thing
|
||||
*/
|
||||
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL))
|
||||
input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID,
|
||||
systemIdCanonic);
|
||||
if (input == NULL) {
|
||||
if (sax != NULL) ctxt->sax = NULL;
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
if (systemIdCanonic != NULL)
|
||||
xmlFree(systemIdCanonic);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* plug some encoding conversion routines here.
|
||||
*/
|
||||
if (xmlPushInput(ctxt, input) < 0) {
|
||||
if (sax != NULL) ctxt->sax = NULL;
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
if (systemIdCanonic != NULL)
|
||||
xmlFree(systemIdCanonic);
|
||||
return(NULL);
|
||||
}
|
||||
if ((ctxt->input->end - ctxt->input->cur) >= 4) {
|
||||
enc = xmlDetectCharEncoding(ctxt->input->cur, 4);
|
||||
xmlSwitchEncoding(ctxt, enc);
|
||||
}
|
||||
|
||||
if (input->filename == NULL)
|
||||
input->filename = (char *) systemIdCanonic;
|
||||
else
|
||||
xmlFree(systemIdCanonic);
|
||||
input->line = 1;
|
||||
input->col = 1;
|
||||
input->base = ctxt->input->cur;
|
||||
input->cur = ctxt->input->cur;
|
||||
input->free = NULL;
|
||||
|
||||
/*
|
||||
* let's parse that entity knowing it's an external subset.
|
||||
*/
|
||||
ctxt->inSubset = 2;
|
||||
ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0");
|
||||
if (ctxt->myDoc == NULL) {
|
||||
xmlErrMemory(ctxt, "New Doc failed");
|
||||
if (sax != NULL) ctxt->sax = NULL;
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
ctxt->myDoc->properties = XML_DOC_INTERNAL;
|
||||
ctxt->myDoc->extSubset = xmlNewDtd(ctxt->myDoc, BAD_CAST "none",
|
||||
ExternalID, SystemID);
|
||||
xmlParseExternalSubset(ctxt, ExternalID, SystemID);
|
||||
|
||||
if (ctxt->myDoc != NULL) {
|
||||
if (ctxt->wellFormed) {
|
||||
ret = ctxt->myDoc->extSubset;
|
||||
ctxt->myDoc->extSubset = NULL;
|
||||
if (ret != NULL) {
|
||||
xmlNodePtr tmp;
|
||||
|
||||
ret->doc = NULL;
|
||||
tmp = ret->children;
|
||||
while (tmp != NULL) {
|
||||
tmp->doc = NULL;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = NULL;
|
||||
}
|
||||
xmlFreeDoc(ctxt->myDoc);
|
||||
ctxt->myDoc = NULL;
|
||||
}
|
||||
if (sax != NULL) ctxt->sax = NULL;
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlParseDTD:
|
||||
* @ExternalID: a NAME* containing the External ID of the DTD
|
||||
* @SystemID: a NAME* containing the URL to the DTD
|
||||
*
|
||||
* Load and parse an external subset.
|
||||
*
|
||||
* Returns the resulting xmlDtdPtr or NULL in case of error.
|
||||
*/
|
||||
|
||||
xmlDtdPtr
|
||||
xmlParseDTD(const xmlChar *ExternalID, const xmlChar *SystemID) {
|
||||
return(xmlSAXParseDTD(NULL, ExternalID, SystemID));
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Front ends when parsing an Entity *
|
||||
@ -12288,14 +11982,6 @@ xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt,
|
||||
cur = ctxt->myDoc->children->children;
|
||||
*lst = cur;
|
||||
while (cur != NULL) {
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if ((oldctxt->validate) && (oldctxt->wellFormed) &&
|
||||
(oldctxt->myDoc) && (oldctxt->myDoc->intSubset) &&
|
||||
(cur->type == XML_ELEMENT_NODE)) {
|
||||
oldctxt->valid &= xmlValidateElement(&oldctxt->vctxt,
|
||||
oldctxt->myDoc, cur);
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
cur->parent = NULL;
|
||||
cur = cur->next;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -108,12 +108,6 @@ static int noenc = 0;
|
||||
static int noblanks = 0;
|
||||
static int noout = 0;
|
||||
static int nowrap = 0;
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
static int valid = 0;
|
||||
static int postvalid = 0;
|
||||
static char * dtdvalid = NULL;
|
||||
static char * dtdvalidfpi = NULL;
|
||||
#endif
|
||||
static int repeat = 0;
|
||||
static int insert = 0;
|
||||
static int htmlout = 0;
|
||||
@ -1635,11 +1629,6 @@ static void streamFile(char *filename) {
|
||||
|
||||
|
||||
if (reader != NULL) {
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if (valid)
|
||||
xmlTextReaderSetParserProp(reader, XML_PARSER_VALIDATE, 1);
|
||||
else
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
xmlTextReaderSetParserProp(reader, XML_PARSER_LOADDTD, 1);
|
||||
|
||||
/*
|
||||
@ -1656,23 +1645,9 @@ static void streamFile(char *filename) {
|
||||
ret = xmlTextReaderRead(reader);
|
||||
}
|
||||
if ((timing) && (!repeat)) {
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if (valid)
|
||||
endTimer("Parsing and validating");
|
||||
else
|
||||
#endif
|
||||
endTimer("Parsing");
|
||||
}
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if (valid) {
|
||||
if (xmlTextReaderIsValid(reader) != 1) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Document %s does not validate\n", filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
}
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
/*
|
||||
* Done, cleanup and status
|
||||
*/
|
||||
@ -1866,25 +1841,6 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
||||
munmap((char *) base, info.st_size);
|
||||
close(fd);
|
||||
#endif
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
} else if (valid) {
|
||||
xmlParserCtxtPtr ctxt = NULL;
|
||||
|
||||
if (rectxt == NULL)
|
||||
ctxt = xmlNewParserCtxt();
|
||||
else
|
||||
ctxt = rectxt;
|
||||
if (ctxt == NULL) {
|
||||
doc = NULL;
|
||||
} else {
|
||||
doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
|
||||
|
||||
if (ctxt->valid == 0)
|
||||
progresult = XMLLINT_ERR_RDFILE;
|
||||
if (rectxt == NULL)
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
} else {
|
||||
if (rectxt != NULL)
|
||||
doc = xmlCtxtReadFile(rectxt, filename, NULL, options);
|
||||
@ -1943,121 +1899,12 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
||||
}
|
||||
#endif /* LIBXML_TREE_ENABLED */
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if ((insert) && (!html)) {
|
||||
const xmlChar* list[256];
|
||||
int nb, i;
|
||||
xmlNodePtr node;
|
||||
|
||||
if (doc->children != NULL) {
|
||||
node = doc->children;
|
||||
while ((node != NULL) && (node->last == NULL)) node = node->next;
|
||||
if (node != NULL) {
|
||||
nb = xmlValidGetValidElements(node->last, NULL, list, 256);
|
||||
if (nb < 0) {
|
||||
fprintf(stderr, "could not get valid list of elements\n");
|
||||
} else if (nb == 0) {
|
||||
fprintf(stderr, "No element can be inserted under root\n");
|
||||
} else {
|
||||
fprintf(stderr, "%d element types can be inserted under root:\n",
|
||||
nb);
|
||||
for (i = 0;i < nb;i++) {
|
||||
fprintf(stderr, "%s\n", (char *) list[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#ifdef LIBXML_READER_ENABLED
|
||||
if (walker) {
|
||||
walkDoc(doc);
|
||||
}
|
||||
#endif /* LIBXML_READER_ENABLED */
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
/*
|
||||
* A posteriori validation test
|
||||
*/
|
||||
if ((dtdvalid != NULL) || (dtdvalidfpi != NULL)) {
|
||||
xmlDtdPtr dtd;
|
||||
|
||||
if ((timing) && (!repeat)) {
|
||||
startTimer();
|
||||
}
|
||||
if (dtdvalid != NULL)
|
||||
dtd = xmlParseDTD(NULL, (const xmlChar *)dtdvalid);
|
||||
else
|
||||
dtd = xmlParseDTD((const xmlChar *)dtdvalidfpi, NULL);
|
||||
if ((timing) && (!repeat)) {
|
||||
endTimer("Parsing DTD");
|
||||
}
|
||||
if (dtd == NULL) {
|
||||
if (dtdvalid != NULL)
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Could not parse DTD %s\n", dtdvalid);
|
||||
else
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Could not parse DTD %s\n", dtdvalidfpi);
|
||||
progresult = XMLLINT_ERR_DTD;
|
||||
} else {
|
||||
xmlValidCtxtPtr cvp;
|
||||
|
||||
if ((cvp = xmlNewValidCtxt()) == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Couldn't allocate validation context\n");
|
||||
exit(-1);
|
||||
}
|
||||
cvp->userData = (void *) stderr;
|
||||
cvp->error = (xmlValidityErrorFunc) fprintf;
|
||||
cvp->warning = (xmlValidityWarningFunc) fprintf;
|
||||
|
||||
if ((timing) && (!repeat)) {
|
||||
startTimer();
|
||||
}
|
||||
if (!xmlValidateDtd(cvp, doc, dtd)) {
|
||||
if (dtdvalid != NULL)
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Document %s does not validate against %s\n",
|
||||
filename, dtdvalid);
|
||||
else
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Document %s does not validate against %s\n",
|
||||
filename, dtdvalidfpi);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
}
|
||||
if ((timing) && (!repeat)) {
|
||||
endTimer("Validating against DTD");
|
||||
}
|
||||
xmlFreeValidCtxt(cvp);
|
||||
xmlFreeDtd(dtd);
|
||||
}
|
||||
} else if (postvalid) {
|
||||
xmlValidCtxtPtr cvp;
|
||||
|
||||
if ((cvp = xmlNewValidCtxt()) == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Couldn't allocate validation context\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((timing) && (!repeat)) {
|
||||
startTimer();
|
||||
}
|
||||
cvp->userData = (void *) stderr;
|
||||
cvp->error = (xmlValidityErrorFunc) fprintf;
|
||||
cvp->warning = (xmlValidityWarningFunc) fprintf;
|
||||
if (!xmlValidateDocument(cvp, doc)) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Document %s does not validate\n", filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
}
|
||||
if ((timing) && (!repeat)) {
|
||||
endTimer("Validating");
|
||||
}
|
||||
xmlFreeValidCtxt(cvp);
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
/*
|
||||
* free it.
|
||||
@ -2137,12 +1984,6 @@ static void usage(const char *name) {
|
||||
printf("\t--nocompact : do not generate compact text nodes\n");
|
||||
printf("\t--htmlout : output results as HTML\n");
|
||||
printf("\t--nowrap : do not put HTML doc wrapper\n");
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
printf("\t--valid : validate the document in addition to std well-formed check\n");
|
||||
printf("\t--postvalid : do a posteriori validation, i.e after parsing\n");
|
||||
printf("\t--dtdvalid URL : do a posteriori validation against a given DTD\n");
|
||||
printf("\t--dtdvalidfpi FPI : same but name the DTD with a Public Identifier\n");
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
printf("\t--timing : print some timings\n");
|
||||
printf("\t--output file or -o file: save to a given file\n");
|
||||
printf("\t--repeat : repeat 100 times, for timing or profiling\n");
|
||||
@ -2265,30 +2106,6 @@ main(int argc, char **argv) {
|
||||
dtdattrs++;
|
||||
options |= XML_PARSE_DTDATTR;
|
||||
}
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
else if ((!strcmp(argv[i], "-valid")) ||
|
||||
(!strcmp(argv[i], "--valid"))) {
|
||||
valid++;
|
||||
options |= XML_PARSE_DTDVALID;
|
||||
} else if ((!strcmp(argv[i], "-postvalid")) ||
|
||||
(!strcmp(argv[i], "--postvalid"))) {
|
||||
postvalid++;
|
||||
loaddtd++;
|
||||
options |= XML_PARSE_DTDLOAD;
|
||||
} else if ((!strcmp(argv[i], "-dtdvalid")) ||
|
||||
(!strcmp(argv[i], "--dtdvalid"))) {
|
||||
i++;
|
||||
dtdvalid = argv[i];
|
||||
loaddtd++;
|
||||
options |= XML_PARSE_DTDLOAD;
|
||||
} else if ((!strcmp(argv[i], "-dtdvalidfpi")) ||
|
||||
(!strcmp(argv[i], "--dtdvalidfpi"))) {
|
||||
i++;
|
||||
dtdvalidfpi = argv[i];
|
||||
loaddtd++;
|
||||
options |= XML_PARSE_DTDLOAD;
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
else if ((!strcmp(argv[i], "-dropdtd")) ||
|
||||
(!strcmp(argv[i], "--dropdtd")))
|
||||
dropdtd++;
|
||||
@ -2435,9 +2252,6 @@ main(int argc, char **argv) {
|
||||
if (dtdattrs)
|
||||
xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS;
|
||||
if (noent != 0) xmlSubstituteEntitiesDefault(1);
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if (valid != 0) xmlDoValidityCheckingDefaultValue = 1;
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
if ((htmlout) && (!nowrap)) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"\n");
|
||||
@ -2462,23 +2276,6 @@ main(int argc, char **argv) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if ((!strcmp(argv[i], "-dtdvalid")) ||
|
||||
(!strcmp(argv[i], "--dtdvalid"))) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if ((!strcmp(argv[i], "-path")) ||
|
||||
(!strcmp(argv[i], "--path"))) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if ((!strcmp(argv[i], "-dtdvalidfpi")) ||
|
||||
(!strcmp(argv[i], "--dtdvalidfpi"))) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
if ((!strcmp(argv[i], "-relaxng")) ||
|
||||
(!strcmp(argv[i], "--relaxng"))) {
|
||||
i++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user