mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
fixing compilation bug with some options disabled as well as
* debugXML.c testHTML.c tree.c doc/examples/*.c include/libxml/xmlsave.h: fixing compilation bug with some options disabled as well as --with-minimum should fix #134695 Daniel
This commit is contained in:
@ -1,3 +1,9 @@
|
||||
Thu Mar 4 16:57:50 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* debugXML.c testHTML.c tree.c doc/examples/*.c
|
||||
include/libxml/xmlsave.h: fixing compilation bug with some options
|
||||
disabled as well as --with-minimum should fix #134695
|
||||
|
||||
Thu Mar 4 15:00:45 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* xmlcatalog.c: allow fallback to URI lookup when SYSTEM fails,
|
||||
|
@ -1538,6 +1538,7 @@ xmlShellBase(xmlShellCtxtPtr ctxt,
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef XML_TREE_ENABLED
|
||||
/**
|
||||
* xmlShellSetBase:
|
||||
* @ctxt: the shell context
|
||||
@ -1558,6 +1559,7 @@ xmlShellSetBase(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
||||
xmlNodeSetBase(node, (xmlChar*) arg);
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlShellGrep:
|
||||
@ -2306,8 +2308,10 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
|
||||
xmlXPathFreeObject(list);
|
||||
}
|
||||
#endif /* LIBXML_XPATH_ENABLED */
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
} else if (!strcmp(command, "setbase")) {
|
||||
xmlShellSetBase(ctxt, arg, ctxt->node, NULL);
|
||||
#endif
|
||||
} else if ((!strcmp(command, "ls")) || (!strcmp(command, "dir"))) {
|
||||
int dir = (!strcmp(command, "dir"));
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <libxml/xinclude.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
|
||||
#ifdef LIBXML_XINCLUDE_ENABLED
|
||||
static const char *result = "<list><people>a</people><people>b</people></list>";
|
||||
static const char *cur = NULL;
|
||||
static int rlen;
|
||||
@ -125,6 +126,7 @@ int main(void) {
|
||||
fprintf(stderr, "failed to parse the including file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* apply the XInclude process, this should trigger the I/O just
|
||||
* registered.
|
||||
@ -133,10 +135,14 @@ int main(void) {
|
||||
fprintf(stderr, "XInclude processing failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
/*
|
||||
* save the output for checking to stdout
|
||||
*/
|
||||
xmlDocDump(stdout, doc);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Free the document
|
||||
*/
|
||||
@ -152,3 +158,9 @@ int main(void) {
|
||||
xmlMemoryDump();
|
||||
return(0);
|
||||
}
|
||||
#else
|
||||
int main(void) {
|
||||
fprintf(stderr, "XInclude support not compiled in\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlreader.h>
|
||||
|
||||
#ifdef LIBXML_READER_ENABLED
|
||||
|
||||
/**
|
||||
* processNode:
|
||||
* @reader: the xmlReader
|
||||
@ -96,3 +98,10 @@ int main(int argc, char **argv) {
|
||||
xmlMemoryDump();
|
||||
return(0);
|
||||
}
|
||||
|
||||
#else
|
||||
int main(void) {
|
||||
fprintf(stderr, "XInclude support not compiled in\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlreader.h>
|
||||
|
||||
#ifdef LIBXML_READER_ENABLED
|
||||
|
||||
/**
|
||||
* processNode:
|
||||
* @reader: the xmlReader
|
||||
@ -111,3 +113,10 @@ int main(int argc, char **argv) {
|
||||
xmlMemoryDump();
|
||||
return(0);
|
||||
}
|
||||
|
||||
#else
|
||||
int main(void) {
|
||||
fprintf(stderr, "XInclude support not compiled in\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlreader.h>
|
||||
|
||||
#ifdef LIBXML_READER_ENABLED
|
||||
|
||||
/**
|
||||
* streamFile:
|
||||
* @filename: the file name to parse
|
||||
@ -108,3 +110,10 @@ int main(int argc, char **argv) {
|
||||
xmlMemoryDump();
|
||||
return(0);
|
||||
}
|
||||
|
||||
#else
|
||||
int main(void) {
|
||||
fprintf(stderr, "XInclude support not compiled in\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include <libxml/encoding.h>
|
||||
#include <libxml/xmlwriter.h>
|
||||
|
||||
#if defined(LIBXML_WRITER_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
|
||||
|
||||
#define MY_ENCODING "ISO-8859-1"
|
||||
|
||||
void testXmlwriterFilename(const char *uri);
|
||||
@ -1187,3 +1189,10 @@ ConvertInput(const char *in, const char *encoding)
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
#else
|
||||
int main(void) {
|
||||
fprintf(stderr, "Writer or output support not compiled in\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
|
||||
/*
|
||||
*To compile this file using gcc you can type
|
||||
*gcc `xml2-config --cflags --libs` -o xmlexample libxml2-example.c
|
||||
@ -84,3 +86,9 @@ main(int argc, char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int main(void) {
|
||||
fprintf(stderr, "Tree support not compiled in\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
|
||||
/*
|
||||
*To compile this file using gcc you can type
|
||||
*gcc `xml2-config --cflags --libs` -o tree2 tree2.c
|
||||
@ -108,3 +110,9 @@ main(int argc, char **argv)
|
||||
xmlMemoryDump();
|
||||
return(0);
|
||||
}
|
||||
#else
|
||||
int main(void) {
|
||||
fprintf(stderr, "tree support not compiled in\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
@ -17,6 +17,9 @@
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
|
||||
|
||||
void usage(const char *name);
|
||||
int execute_xpath_expression(const char* filename, const xmlChar* xpathExpr, const xmlChar* nsList);
|
||||
int register_namespaces(xmlXPathContextPtr xpathCtx, const xmlChar* nsList);
|
||||
@ -238,3 +241,9 @@ print_xpath_nodes(xmlNodeSetPtr nodes, FILE* output) {
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
int main(void) {
|
||||
fprintf(stderr, "XPath support not compiled in\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -54,6 +55,7 @@ XMLPUBFUN int XMLCALL
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
#endif /* __XML_XMLSAVE_H__ */
|
||||
|
||||
|
||||
|
@ -704,7 +704,7 @@ parseSAXFile(char *filename) {
|
||||
|
||||
static void
|
||||
parseAndPrintFile(char *filename) {
|
||||
htmlDocPtr doc = NULL, tmp;
|
||||
htmlDocPtr doc = NULL;
|
||||
|
||||
/*
|
||||
* build an HTML tree from a string;
|
||||
@ -745,14 +745,18 @@ parseAndPrintFile(char *filename) {
|
||||
"Could not parse %s\n", filename);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
/*
|
||||
* test intermediate copy if needed.
|
||||
*/
|
||||
if (copy) {
|
||||
htmlDocPtr tmp;
|
||||
|
||||
tmp = doc;
|
||||
doc = xmlCopyDoc(doc, 1);
|
||||
xmlFreeDoc(tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
/*
|
||||
|
163
tree.c
163
tree.c
@ -321,7 +321,6 @@ xmlSplitQName3(const xmlChar *name, int *len) {
|
||||
return(&name[l+1]);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
/************************************************************************
|
||||
* *
|
||||
* Check Name, NCName and QName strings *
|
||||
@ -330,6 +329,7 @@ xmlSplitQName3(const xmlChar *name, int *len) {
|
||||
|
||||
#define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l)
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
/**
|
||||
* xmlValidateNCName:
|
||||
* @value: the value to check
|
||||
@ -398,7 +398,9 @@ try_complex:
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
/**
|
||||
* xmlValidateQName:
|
||||
* @value: the value to check
|
||||
@ -1669,7 +1671,7 @@ xmlNodeListGetRawString(xmlDocPtr doc, xmlNodePtr list, int inLine)
|
||||
}
|
||||
#endif /* LIBXML_TREE_ENABLED */
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED)
|
||||
/**
|
||||
* xmlNewProp:
|
||||
* @node: the holding node
|
||||
@ -2716,7 +2718,7 @@ xmlSetListDoc(xmlNodePtr list, xmlDocPtr doc) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
/**
|
||||
* xmlNewChild:
|
||||
* @parent: the parent node
|
||||
@ -2874,7 +2876,7 @@ xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) {
|
||||
return(elem);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED)
|
||||
/**
|
||||
* xmlAddPrevSibling:
|
||||
* @cur: the child node
|
||||
@ -3427,7 +3429,7 @@ xmlUnlinkNode(xmlNodePtr cur) {
|
||||
cur->next = cur->prev = NULL;
|
||||
}
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
|
||||
/**
|
||||
* xmlReplaceNode:
|
||||
* @old: the old node
|
||||
@ -3933,7 +3935,7 @@ xmlNodePtr xmlCopyNodeList(const xmlNodePtr node) {
|
||||
return(ret);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
/**
|
||||
* xmlCopyDtd:
|
||||
* @dtd: the dtd
|
||||
@ -4018,7 +4020,9 @@ xmlCopyDtd(xmlDtdPtr dtd) {
|
||||
|
||||
return(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
/**
|
||||
* xmlCopyDoc:
|
||||
* @doc: the document
|
||||
@ -4047,11 +4051,13 @@ xmlCopyDoc(xmlDocPtr doc, int recursive) {
|
||||
|
||||
ret->last = NULL;
|
||||
ret->children = NULL;
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
if (doc->intSubset != NULL) {
|
||||
ret->intSubset = xmlCopyDtd(doc->intSubset);
|
||||
xmlSetTreeDoc((xmlNodePtr)ret->intSubset, ret);
|
||||
ret->intSubset->parent = ret;
|
||||
}
|
||||
#endif
|
||||
if (doc->oldNs != NULL)
|
||||
ret->oldNs = xmlCopyNamespaceList(doc->oldNs);
|
||||
if (doc->children != NULL) {
|
||||
@ -4107,7 +4113,7 @@ xmlGetLineNo(xmlNodePtr node)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
|
||||
/**
|
||||
* xmlGetNodePath:
|
||||
* @node: a node
|
||||
@ -4348,7 +4354,7 @@ xmlDocGetRootElement(xmlDocPtr doc) {
|
||||
return(ret);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
|
||||
/**
|
||||
* xmlDocSetRootElement:
|
||||
* @doc: the document
|
||||
@ -4387,7 +4393,9 @@ xmlDocSetRootElement(xmlDocPtr doc, xmlNodePtr root) {
|
||||
}
|
||||
return(old);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
/**
|
||||
* xmlNodeSetLang:
|
||||
* @cur: the node being changed
|
||||
@ -4588,7 +4596,9 @@ xmlNodeSetName(xmlNodePtr cur, const xmlChar *name) {
|
||||
if (cur->name != NULL) xmlFree((xmlChar *) cur->name);
|
||||
cur->name = xmlStrdup(name);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
|
||||
/**
|
||||
* xmlNodeSetBase:
|
||||
* @cur: the node being changed
|
||||
@ -5245,7 +5255,7 @@ xmlTextMerge(xmlNodePtr first, xmlNodePtr second) {
|
||||
return(first);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED)
|
||||
/**
|
||||
* xmlGetNsList:
|
||||
* @doc: the document
|
||||
@ -6121,7 +6131,75 @@ xmlGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
/**
|
||||
* xmlUnsetProp:
|
||||
* @node: the node
|
||||
* @name: the attribute name
|
||||
*
|
||||
* Remove an attribute carried by a node.
|
||||
* Returns 0 if successful, -1 if not found
|
||||
*/
|
||||
int
|
||||
xmlUnsetProp(xmlNodePtr node, const xmlChar *name) {
|
||||
xmlAttrPtr prop, prev = NULL;;
|
||||
|
||||
if ((node == NULL) || (name == NULL))
|
||||
return(-1);
|
||||
prop = node->properties;
|
||||
while (prop != NULL) {
|
||||
if ((xmlStrEqual(prop->name, name)) &&
|
||||
(prop->ns == NULL)) {
|
||||
if (prev == NULL)
|
||||
node->properties = prop->next;
|
||||
else
|
||||
prev->next = prop->next;
|
||||
xmlFreeProp(prop);
|
||||
return(0);
|
||||
}
|
||||
prev = prop;
|
||||
prop = prop->next;
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlUnsetNsProp:
|
||||
* @node: the node
|
||||
* @ns: the namespace definition
|
||||
* @name: the attribute name
|
||||
*
|
||||
* Remove an attribute carried by a node.
|
||||
* Returns 0 if successful, -1 if not found
|
||||
*/
|
||||
int
|
||||
xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) {
|
||||
xmlAttrPtr prop = node->properties, prev = NULL;;
|
||||
|
||||
if ((node == NULL) || (name == NULL))
|
||||
return(-1);
|
||||
if (ns == NULL)
|
||||
return(xmlUnsetProp(node, name));
|
||||
if (ns->href == NULL)
|
||||
return(-1);
|
||||
while (prop != NULL) {
|
||||
if ((xmlStrEqual(prop->name, name)) &&
|
||||
(prop->ns != NULL) && (xmlStrEqual(prop->ns->href, ns->href))) {
|
||||
if (prev == NULL)
|
||||
node->properties = prop->next;
|
||||
else
|
||||
prev->next = prop->next;
|
||||
xmlFreeProp(prop);
|
||||
return(0);
|
||||
}
|
||||
prev = prop;
|
||||
prop = prop->next;
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
|
||||
/**
|
||||
* xmlSetProp:
|
||||
* @node: the node
|
||||
@ -6175,37 +6253,6 @@ xmlSetProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) {
|
||||
return(prop);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlUnsetProp:
|
||||
* @node: the node
|
||||
* @name: the attribute name
|
||||
*
|
||||
* Remove an attribute carried by a node.
|
||||
* Returns 0 if successful, -1 if not found
|
||||
*/
|
||||
int
|
||||
xmlUnsetProp(xmlNodePtr node, const xmlChar *name) {
|
||||
xmlAttrPtr prop, prev = NULL;;
|
||||
|
||||
if ((node == NULL) || (name == NULL))
|
||||
return(-1);
|
||||
prop = node->properties;
|
||||
while (prop != NULL) {
|
||||
if ((xmlStrEqual(prop->name, name)) &&
|
||||
(prop->ns == NULL)) {
|
||||
if (prev == NULL)
|
||||
node->properties = prop->next;
|
||||
else
|
||||
prev->next = prop->next;
|
||||
xmlFreeProp(prop);
|
||||
return(0);
|
||||
}
|
||||
prev = prop;
|
||||
prop = prop->next;
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlSetNsProp:
|
||||
* @node: the node
|
||||
@ -6269,40 +6316,6 @@ xmlSetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name,
|
||||
return(prop);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlUnsetNsProp:
|
||||
* @node: the node
|
||||
* @ns: the namespace definition
|
||||
* @name: the attribute name
|
||||
*
|
||||
* Remove an attribute carried by a node.
|
||||
* Returns 0 if successful, -1 if not found
|
||||
*/
|
||||
int
|
||||
xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) {
|
||||
xmlAttrPtr prop = node->properties, prev = NULL;;
|
||||
|
||||
if ((node == NULL) || (name == NULL))
|
||||
return(-1);
|
||||
if (ns == NULL)
|
||||
return(xmlUnsetProp(node, name));
|
||||
if (ns->href == NULL)
|
||||
return(-1);
|
||||
while (prop != NULL) {
|
||||
if ((xmlStrEqual(prop->name, name)) &&
|
||||
(prop->ns != NULL) && (xmlStrEqual(prop->ns->href, ns->href))) {
|
||||
if (prev == NULL)
|
||||
node->properties = prop->next;
|
||||
else
|
||||
prev->next = prop->next;
|
||||
xmlFreeProp(prop);
|
||||
return(0);
|
||||
}
|
||||
prev = prop;
|
||||
prop = prop->next;
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
#endif /* LIBXML_TREE_ENABLED */
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user