fixing compilation and link option when configuring with --without-valid

* debugXML.c relaxng.c valid.c xinclude.c xmllint.c xmlreader.c:
  fixing compilation and link option when configuring with
  --without-valid should fix #135309
Daniel
This commit is contained in:
Daniel Veillard 2004-02-25 11:52:31 +00:00
parent afbca8e281
commit f54cd533d8
8 changed files with 312 additions and 286 deletions

View File

@ -1,3 +1,9 @@
Wed Feb 25 12:50:53 CET 2004 Daniel Veillard <daniel@veillard.com>
* debugXML.c relaxng.c valid.c xinclude.c xmllint.c xmlreader.c:
fixing compilation and link option when configuring with
--without-valid should fix #135309
Wed Feb 25 11:36:06 CET 2004 Daniel Veillard <daniel@veillard.com>
* catalog.c: fixed the main issues reported by Peter Breitenlohner

View File

@ -1955,6 +1955,7 @@ xmlShellSave(xmlShellCtxtPtr ctxt, char *filename,
}
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_VALID_ENABLED
/**
* xmlShellValidate:
* @ctxt: the shell context
@ -1994,6 +1995,7 @@ xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd,
}
return (res);
}
#endif /* LIBXML_VALID_ENABLED */
/**
* xmlShellDu:
@ -2249,13 +2251,17 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
fprintf(ctxt->output, "\tsave [name] save this document to name or the original name\n");
fprintf(ctxt->output, "\twrite [name] write the current node to the filename\n");
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_VALID_ENABLED
fprintf(ctxt->output, "\tvalidate check the document for errors\n");
#endif /* LIBXML_VALID_ENABLED */
#ifdef LIBXML_SCHEMAS_ENABLED
fprintf(ctxt->output, "\trelaxng rng validate the document agaisnt the Relax-NG schemas\n");
#endif
fprintf(ctxt->output, "\tgrep string search for a string in the subtree\n");
#ifdef LIBXML_VALID_ENABLED
} else if (!strcmp(command, "validate")) {
xmlShellValidate(ctxt, arg, NULL, NULL);
#endif /* LIBXML_VALID_ENABLED */
} else if (!strcmp(command, "load")) {
xmlShellLoad(ctxt, arg, NULL, NULL);
#ifdef LIBXML_SCHEMAS_ENABLED

View File

@ -632,6 +632,57 @@ Class xmlDoc(xmlNode)
# functions from module xpointer
xpointerNewContext()
Class xpathContext()
# accessors
contextDoc()
contextNode()
contextPosition()
contextSize()
function()
functionURI()
setContextDoc()
setContextNode()
# functions from module python
registerXPathFunction()
# functions from module xpath
xpathEval()
xpathEvalExpression()
xpathFreeContext()
# functions from module xpathInternals
xpathNewParserContext()
xpathNsLookup()
xpathRegisterAllFunctions()
xpathRegisterNs()
xpathRegisteredFuncsCleanup()
xpathRegisteredNsCleanup()
xpathRegisteredVariablesCleanup()
xpathVariableLookup()
xpathVariableLookupNS()
# functions from module xpointer
xpointerEval()
Class xmlAttribute(xmlNode)
Class catalog()
# functions from module catalog
add()
catalogIsEmpty()
convertSGMLCatalog()
dump()
freeCatalog()
remove()
resolve()
resolvePublic()
resolveSystem()
resolveURI()
Class xmlElement(xmlNode)
Class xmlAttr(xmlNode)
@ -650,6 +701,62 @@ Class xmlAttr(xmlNode)
# functions from module valid
removeID()
removeRef()
Class xmlTextReader(xmlTextReaderCore)
# functions from module xmlreader
AttributeCount()
BaseUri()
Close()
CurrentDoc()
CurrentNode()
Depth()
Expand()
GetAttribute()
GetAttributeNo()
GetAttributeNs()
GetParserProp()
GetRemainder()
HasAttributes()
HasValue()
IsDefault()
IsEmptyElement()
IsValid()
LocalName()
LookupNamespace()
MoveToAttribute()
MoveToAttributeNo()
MoveToAttributeNs()
MoveToElement()
MoveToFirstAttribute()
MoveToNextAttribute()
Name()
NamespaceUri()
NewDoc()
NewFd()
NewFile()
NewMemory()
NewWalker()
Next()
NextSibling()
NodeType()
Normalization()
Prefix()
Preserve()
QuoteChar()
Read()
ReadAttributeValue()
ReadInnerXml()
ReadOuterXml()
ReadState()
ReadString()
RelaxNGSetSchema()
RelaxNGValidate()
SetParserProp()
String()
Value()
XmlLang()
Class xmlReg()
# functions from module xmlregexp
@ -657,6 +764,34 @@ Class xmlReg()
regexpFreeRegexp()
regexpIsDeterminist()
regexpPrint()
Class xmlEntity(xmlNode)
# functions from module parserInternals
handleEntity()
Class relaxNgSchema()
# functions from module relaxng
relaxNGDump()
relaxNGDumpTree()
relaxNGFree()
relaxNGNewValidCtxt()
# functions from module xmlreader
RelaxNGSetSchema()
Class Error()
# accessors
code()
domain()
file()
level()
line()
message()
# functions from module xmlerror
copyError()
resetError()
Class relaxNgValidCtxt()
# functions from module relaxng
@ -665,6 +800,73 @@ Class relaxNgValidCtxt()
relaxNGValidatePopElement()
relaxNGValidatePushCData()
relaxNGValidatePushElement()
Class xpathParserContext()
# accessors
context()
# functions from module xpathInternals
xpathAddValues()
xpathBooleanFunction()
xpathCeilingFunction()
xpathCompareValues()
xpathConcatFunction()
xpathContainsFunction()
xpathCountFunction()
xpathDivValues()
xpathEqualValues()
xpathErr()
xpathEvalExpr()
xpathFalseFunction()
xpathFloorFunction()
xpathFreeParserContext()
xpathIdFunction()
xpathLangFunction()
xpathLastFunction()
xpathLocalNameFunction()
xpathModValues()
xpathMultValues()
xpathNamespaceURIFunction()
xpathNextAncestor()
xpathNextAncestorOrSelf()
xpathNextAttribute()
xpathNextChild()
xpathNextDescendant()
xpathNextDescendantOrSelf()
xpathNextFollowing()
xpathNextFollowingSibling()
xpathNextNamespace()
xpathNextParent()
xpathNextPreceding()
xpathNextPrecedingSibling()
xpathNextSelf()
xpathNormalizeFunction()
xpathNotEqualValues()
xpathNotFunction()
xpathNumberFunction()
xpathParseNCName()
xpathParseName()
xpathPopBoolean()
xpathPopNumber()
xpathPopString()
xpathPositionFunction()
xpathRoot()
xpathRoundFunction()
xpathStartsWithFunction()
xpathStringFunction()
xpathStringLengthFunction()
xpathSubValues()
xpathSubstringAfterFunction()
xpathSubstringBeforeFunction()
xpathSubstringFunction()
xpathSumFunction()
xpathTranslateFunction()
xpathTrueFunction()
xpathValueFlipSign()
xpatherror()
# functions from module xpointer
xpointerEvalRangePredicate()
xpointerRangeToFunction()
Class parserCtxt(parserCtxtCore)
@ -772,92 +974,6 @@ Class xmlDtd(xmlNode)
dtdElementDesc()
dtdQAttrDesc()
dtdQElementDesc()
Class relaxNgParserCtxt()
# functions from module relaxng
relaxNGFreeParserCtxt()
relaxNGParse()
relaxParserSetFlag()
Class xpathParserContext()
# accessors
context()
# functions from module xpathInternals
xpathAddValues()
xpathBooleanFunction()
xpathCeilingFunction()
xpathCompareValues()
xpathConcatFunction()
xpathContainsFunction()
xpathCountFunction()
xpathDivValues()
xpathEqualValues()
xpathErr()
xpathEvalExpr()
xpathFalseFunction()
xpathFloorFunction()
xpathFreeParserContext()
xpathIdFunction()
xpathLangFunction()
xpathLastFunction()
xpathLocalNameFunction()
xpathModValues()
xpathMultValues()
xpathNamespaceURIFunction()
xpathNextAncestor()
xpathNextAncestorOrSelf()
xpathNextAttribute()
xpathNextChild()
xpathNextDescendant()
xpathNextDescendantOrSelf()
xpathNextFollowing()
xpathNextFollowingSibling()
xpathNextNamespace()
xpathNextParent()
xpathNextPreceding()
xpathNextPrecedingSibling()
xpathNextSelf()
xpathNormalizeFunction()
xpathNotEqualValues()
xpathNotFunction()
xpathNumberFunction()
xpathParseNCName()
xpathParseName()
xpathPopBoolean()
xpathPopNumber()
xpathPopString()
xpathPositionFunction()
xpathRoot()
xpathRoundFunction()
xpathStartsWithFunction()
xpathStringFunction()
xpathStringLengthFunction()
xpathSubValues()
xpathSubstringAfterFunction()
xpathSubstringBeforeFunction()
xpathSubstringFunction()
xpathSumFunction()
xpathTranslateFunction()
xpathTrueFunction()
xpathValueFlipSign()
xpatherror()
# functions from module xpointer
xpointerEvalRangePredicate()
xpointerRangeToFunction()
Class catalog()
# functions from module catalog
add()
catalogIsEmpty()
convertSGMLCatalog()
dump()
freeCatalog()
remove()
resolve()
resolvePublic()
resolveSystem()
resolveURI()
Class xmlNs(xmlNode)
@ -881,6 +997,42 @@ Class xmlNs(xmlNode)
# functions from module xpathInternals
xpathNodeSetFreeNs()
Class inputBuffer(ioReadWrapper)
# functions from module xmlIO
freeParserInputBuffer()
grow()
push()
read()
# functions from module xmlreader
newTextReader()
Class relaxNgParserCtxt()
# functions from module relaxng
relaxNGFreeParserCtxt()
relaxNGParse()
relaxParserSetFlag()
Class outputBuffer(ioWriteWrapper)
# functions from module HTMLtree
htmlDocContentDumpFormatOutput()
htmlDocContentDumpOutput()
htmlNodeDumpFormatOutput()
htmlNodeDumpOutput()
# functions from module tree
nodeDumpOutput()
saveFileTo()
saveFormatFileTo()
# functions from module xmlIO
write()
writeString()
Class xmlTextReaderLocator()
# functions from module xmlreader
@ -912,155 +1064,3 @@ Class URI()
parseURIReference()
printURI()
saveUri()
Class xmlAttribute(xmlNode)
Class xpathContext()
# accessors
contextDoc()
contextNode()
contextPosition()
contextSize()
function()
functionURI()
setContextDoc()
setContextNode()
# functions from module python
registerXPathFunction()
# functions from module xpath
xpathEval()
xpathEvalExpression()
xpathFreeContext()
# functions from module xpathInternals
xpathNewParserContext()
xpathNsLookup()
xpathRegisterAllFunctions()
xpathRegisterNs()
xpathRegisteredFuncsCleanup()
xpathRegisteredNsCleanup()
xpathRegisteredVariablesCleanup()
xpathVariableLookup()
xpathVariableLookupNS()
# functions from module xpointer
xpointerEval()
Class xmlElement(xmlNode)
Class xmlTextReader(xmlTextReaderCore)
# functions from module xmlreader
AttributeCount()
BaseUri()
Close()
CurrentDoc()
CurrentNode()
Depth()
Expand()
GetAttribute()
GetAttributeNo()
GetAttributeNs()
GetParserProp()
GetRemainder()
HasAttributes()
HasValue()
IsDefault()
IsEmptyElement()
IsValid()
LocalName()
LookupNamespace()
MoveToAttribute()
MoveToAttributeNo()
MoveToAttributeNs()
MoveToElement()
MoveToFirstAttribute()
MoveToNextAttribute()
Name()
NamespaceUri()
NewDoc()
NewFd()
NewFile()
NewMemory()
NewWalker()
Next()
NextSibling()
NodeType()
Normalization()
Prefix()
Preserve()
QuoteChar()
Read()
ReadAttributeValue()
ReadInnerXml()
ReadOuterXml()
ReadState()
ReadString()
RelaxNGSetSchema()
RelaxNGValidate()
SetParserProp()
String()
Value()
XmlLang()
Class xmlEntity(xmlNode)
# functions from module parserInternals
handleEntity()
Class Error()
# accessors
code()
domain()
file()
level()
line()
message()
# functions from module xmlerror
copyError()
resetError()
Class relaxNgSchema()
# functions from module relaxng
relaxNGDump()
relaxNGDumpTree()
relaxNGFree()
relaxNGNewValidCtxt()
# functions from module xmlreader
RelaxNGSetSchema()
Class inputBuffer(ioReadWrapper)
# functions from module xmlIO
freeParserInputBuffer()
grow()
push()
read()
# functions from module xmlreader
newTextReader()
Class outputBuffer(ioWriteWrapper)
# functions from module HTMLtree
htmlDocContentDumpFormatOutput()
htmlDocContentDumpOutput()
htmlNodeDumpFormatOutput()
htmlNodeDumpOutput()
# functions from module tree
nodeDumpOutput()
saveFileTo()
saveFormatFileTo()
# functions from module xmlIO
write()
writeString()

View File

@ -10464,6 +10464,7 @@ xmlRelaxNGValidateDocument(xmlRelaxNGValidCtxtPtr ctxt, xmlDocPtr doc)
xmlRelaxNGDumpValidError(ctxt);
}
#endif
#ifdef LIBXML_VALID_ENABLED
if (ctxt->idref == 1) {
xmlValidCtxt vctxt;
@ -10476,6 +10477,7 @@ xmlRelaxNGValidateDocument(xmlRelaxNGValidCtxtPtr ctxt, xmlDocPtr doc)
if (xmlValidateDocumentFinal(&vctxt, doc) != 1)
ret = -1;
}
#endif /* LIBXML_VALID_ENABLED */
if ((ret == 0) && (ctxt->errNo != XML_RELAXNG_OK))
ret = -1;

75
valid.c
View File

@ -105,6 +105,42 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error,
msg);
}
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
/**
* xmlErrValidNode:
* @ctxt: an XML validation parser context
* @node: the node raising the error
* @error: the error number
* @str1: extra informations
* @str2: extra informations
* @str3: extra informations
*
* Handle a validation error, provide contextual informations
*/
static void
xmlErrValidNode(xmlValidCtxtPtr ctxt,
xmlNodePtr node, xmlParserErrors error,
const char *msg, const xmlChar * str1,
const xmlChar * str2, const xmlChar * str3)
{
xmlStructuredErrorFunc schannel = NULL;
xmlGenericErrorFunc channel = NULL;
xmlParserCtxtPtr pctxt = NULL;
void *data = NULL;
if (ctxt != NULL) {
channel = ctxt->error;
data = ctxt->userData;
pctxt = ctxt->userData;
}
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
XML_ERR_ERROR, NULL, 0,
(const char *) str1,
(const char *) str1,
(const char *) str3, 0, 0, msg, str1, str2, str3);
}
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
#ifdef LIBXML_VALID_ENABLED
/**
* xmlErrValidNodeNr:
@ -139,39 +175,7 @@ xmlErrValidNodeNr(xmlValidCtxtPtr ctxt,
(const char *) str3,
NULL, int2, 0, msg, str1, int2, str3);
}
/**
* xmlErrValidNode:
* @ctxt: an XML validation parser context
* @node: the node raising the error
* @error: the error number
* @str1: extra informations
* @str2: extra informations
* @str3: extra informations
*
* Handle a validation error, provide contextual informations
*/
static void
xmlErrValidNode(xmlValidCtxtPtr ctxt,
xmlNodePtr node, xmlParserErrors error,
const char *msg, const xmlChar * str1,
const xmlChar * str2, const xmlChar * str3)
{
xmlStructuredErrorFunc schannel = NULL;
xmlGenericErrorFunc channel = NULL;
xmlParserCtxtPtr pctxt = NULL;
void *data = NULL;
if (ctxt != NULL) {
channel = ctxt->error;
data = ctxt->userData;
pctxt = ctxt->userData;
}
__xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
XML_ERR_ERROR, NULL, 0,
(const char *) str1,
(const char *) str1,
(const char *) str3, 0, 0, msg, str1, str2, str3);
}
/**
* xmlErrValidWarning:
* @ctxt: an XML validation parser context
@ -2722,7 +2726,8 @@ xmlWalkRemoveRef(const void *data, const void *user)
* Do nothing, return 0. Used to create unordered lists.
*/
static int
xmlDummyCompare(const void *data0, const void *data1)
xmlDummyCompare(const void *data0 ATTRIBUTE_UNUSED,
const void *data1 ATTRIBUTE_UNUSED)
{
return (0);
}
@ -3150,7 +3155,7 @@ xmlGetDtdNotationDesc(xmlDtdPtr dtd, const xmlChar *name) {
return(xmlHashLookup(table, name));
}
#ifdef LIBXML_VALID_ENABLED
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
/**
* xmlValidateNotationUse:
* @ctxt: the validation context
@ -3181,7 +3186,7 @@ xmlValidateNotationUse(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
}
return(1);
}
#endif /* LIBXML_VALID_ENABLED */
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
/**
* xmlIsMixedElement:

View File

@ -132,6 +132,7 @@ xmlXIncludeErr(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node, int error,
msg, (const char *) extra);
}
#if 0
/**
* xmlXIncludeWarn:
* @ctxt: the XInclude context
@ -150,6 +151,7 @@ xmlXIncludeWarn(xmlXIncludeCtxtPtr ctxt, xmlNodePtr node, int error,
(const char *) extra, NULL, NULL, 0, 0,
msg, (const char *) extra);
}
#endif
/**
* xmlXIncludeGetProp:

View File

@ -704,20 +704,16 @@ static void streamFile(char *filename) {
}
if ((timing) && (!repeat)) {
#ifdef LIBXML_SCHEMAS_ENABLED
if ((valid) || (relaxng != NULL))
if (relaxng != NULL)
endTimer("Parsing and validating");
else
endTimer("Parsing");
#else
#endif
#ifdef LIBXML_VALID_ENABLED
if (valid)
endTimer("Parsing and validating");
else
endTimer("Parsing");
#else
endTimer("Parsing");
#endif /* LIBXML_VALID_ENABLED */
#endif
endTimer("Parsing");
}
#ifdef LIBXML_VALID_ENABLED

View File

@ -877,6 +877,7 @@ static void
xmlTextReaderValidatePush(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) {
xmlNodePtr node = reader->node;
#ifdef LIBXML_VALID_ENABLED
if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
(reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
if ((node->ns == NULL) || (node->ns->prefix == NULL)) {
@ -894,8 +895,10 @@ xmlTextReaderValidatePush(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) {
if (qname != NULL)
xmlFree(qname);
}
}
#endif /* LIBXML_VALID_ENABLED */
#ifdef LIBXML_SCHEMAS_ENABLED
} else if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
(reader->rngValidCtxt != NULL)) {
int ret;
@ -920,8 +923,8 @@ printf("Expand failed !\n");
}
if (ret != 1)
reader->rngValidErrors++;
#endif
}
#endif
}
/**
@ -935,12 +938,15 @@ printf("Expand failed !\n");
static void
xmlTextReaderValidateCData(xmlTextReaderPtr reader,
const xmlChar *data, int len) {
#ifdef LIBXML_VALID_ENABLED
if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
(reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
reader->ctxt->valid &= xmlValidatePushCData(&reader->ctxt->vctxt,
data, len);
}
#endif /* LIBXML_VALID_ENABLED */
#ifdef LIBXML_SCHEMAS_ENABLED
} else if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
(reader->rngValidCtxt != NULL)) {
int ret;
@ -948,8 +954,8 @@ xmlTextReaderValidateCData(xmlTextReaderPtr reader,
ret = xmlRelaxNGValidatePushCData(reader->rngValidCtxt, data, len);
if (ret != 1)
reader->rngValidErrors++;
#endif
}
#endif
}
/**
@ -962,6 +968,7 @@ static void
xmlTextReaderValidatePop(xmlTextReaderPtr reader) {
xmlNodePtr node = reader->node;
#ifdef LIBXML_VALID_ENABLED
if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
(reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
if ((node->ns == NULL) || (node->ns->prefix == NULL)) {
@ -979,8 +986,10 @@ xmlTextReaderValidatePop(xmlTextReaderPtr reader) {
if (qname != NULL)
xmlFree(qname);
}
}
#endif /* LIBXML_VALID_ENABLED */
#ifdef LIBXML_SCHEMAS_ENABLED
} else if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
(reader->rngValidCtxt != NULL)) {
int ret;
@ -994,8 +1003,8 @@ xmlTextReaderValidatePop(xmlTextReaderPtr reader) {
node);
if (ret != 1)
reader->rngValidErrors++;
#endif
}
#endif
}
/**