diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | debugXML.c | 4 | ||||
-rw-r--r-- | doc/examples/io1.c | 12 | ||||
-rw-r--r-- | doc/examples/reader1.c | 9 | ||||
-rw-r--r-- | doc/examples/reader2.c | 9 | ||||
-rw-r--r-- | doc/examples/reader3.c | 9 | ||||
-rw-r--r-- | doc/examples/testWriter.c | 9 | ||||
-rw-r--r-- | doc/examples/tree1.c | 8 | ||||
-rw-r--r-- | doc/examples/tree2.c | 8 | ||||
-rw-r--r-- | doc/examples/xpath1.c | 9 | ||||
-rw-r--r-- | include/libxml/xmlsave.h | 2 | ||||
-rw-r--r-- | testHTML.c | 6 | ||||
-rw-r--r-- | tree.c | 163 |
13 files changed, 178 insertions, 76 deletions
@@ -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")); diff --git a/doc/examples/io1.c b/doc/examples/io1.c index b505f805..c8a47e3f 100644 --- a/doc/examples/io1.c +++ b/doc/examples/io1.c @@ -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 diff --git a/doc/examples/reader1.c b/doc/examples/reader1.c index 2ae7f4dc..90db2a17 100644 --- a/doc/examples/reader1.c +++ b/doc/examples/reader1.c @@ -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 diff --git a/doc/examples/reader2.c b/doc/examples/reader2.c index cd0b9951..c32ada52 100644 --- a/doc/examples/reader2.c +++ b/doc/examples/reader2.c @@ -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 diff --git a/doc/examples/reader3.c b/doc/examples/reader3.c index d5475f63..2da75320 100644 --- a/doc/examples/reader3.c +++ b/doc/examples/reader3.c @@ -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 diff --git a/doc/examples/testWriter.c b/doc/examples/testWriter.c index c6bb41a9..02f9eb7a 100644 --- a/doc/examples/testWriter.c +++ b/doc/examples/testWriter.c @@ -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 diff --git a/doc/examples/tree1.c b/doc/examples/tree1.c index 7942fc68..8a303e23 100644 --- a/doc/examples/tree1.c +++ b/doc/examples/tree1.c @@ -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 diff --git a/doc/examples/tree2.c b/doc/examples/tree2.c index 196ffb4d..3ab21793 100644 --- a/doc/examples/tree2.c +++ b/doc/examples/tree2.c @@ -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 diff --git a/doc/examples/xpath1.c b/doc/examples/xpath1.c index 2629c3d3..0e49737d 100644 --- a/doc/examples/xpath1.c +++ b/doc/examples/xpath1.c @@ -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 diff --git a/include/libxml/xmlsave.h b/include/libxml/xmlsave.h index f783ffd6..1d43a713 100644 --- a/include/libxml/xmlsave.h +++ b/include/libxml/xmlsave.h @@ -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 /* @@ -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 @@ -6176,37 +6254,6 @@ xmlSetProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) { } /** - * 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 * @ns: the namespace definition @@ -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 */ /** |