summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2003-09-28 18:58:27 +0000
committerDaniel Veillard <veillard@src.gnome.org>2003-09-28 18:58:27 +0000
commit4432df239b7aba6bff86c838e0be11d08f283b76 (patch)
treea12cc42ee7a3e819404c2b8816386f320aab812c
parent9ee35f36437073d952bc88fd64cf1618aad27c7b (diff)
downloadlibxml2-4432df239b7aba6bff86c838e0be11d08f283b76.tar.gz
cleanup, creating a new legacy.c module, made sure make tests ran in
* Makefile.am: cleanup, creating a new legacy.c module, made sure make tests ran in reduced conditions * SAX.c SAX2.c configure.in entities.c globals.c parser.c parserInternals.c tree.c valid.c xlink.c xmlIO.c xmlcatalog.c xmlmemory.c xpath.c xmlmemory.c include/libxml/xmlversion.h.in: increased the modularization, allow to configure out validation code and legacy code, added a configuration option --with-minimum compiling only the mandatory code which then shrink to 200KB. Daniel
-rw-r--r--ChangeLog12
-rw-r--r--Makefile.am12
-rw-r--r--SAX.c583
-rw-r--r--SAX2.c38
-rw-r--r--configure.in169
-rw-r--r--doc/libxml2-api.xml8
-rw-r--r--entities.c176
-rw-r--r--globals.c8
-rw-r--r--include/libxml/xmlversion.h.in18
-rw-r--r--parser.c83
-rw-r--r--parserInternals.c404
-rw-r--r--python/libxml2class.txt1
-rwxr-xr-xpython/tests/reader2.py2
-rw-r--r--tree.c2
-rw-r--r--valid.c30
-rw-r--r--win32/libxml2.def.src1
-rw-r--r--xlink.c2
-rw-r--r--xmlIO.c2
-rw-r--r--xmlcatalog.c2
-rw-r--r--xmllint.c40
-rw-r--r--xmlmemory.c17
-rw-r--r--xpath.c4
22 files changed, 419 insertions, 1195 deletions
diff --git a/ChangeLog b/ChangeLog
index b2ea22b4..0f4b2c90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Sun Sep 28 20:53:17 CEST 2003 Daniel Veillard <daniel@veillard.com>
+
+ * Makefile.am: cleanup, creating a new legacy.c module,
+ made sure make tests ran in reduced conditions
+ * SAX.c SAX2.c configure.in entities.c globals.c parser.c
+ parserInternals.c tree.c valid.c xlink.c xmlIO.c xmlcatalog.c
+ xmlmemory.c xpath.c xmlmemory.c include/libxml/xmlversion.h.in:
+ increased the modularization, allow to configure out
+ validation code and legacy code, added a configuration
+ option --with-minimum compiling only the mandatory code
+ which then shrink to 200KB.
+
Sun Sep 28 02:15:07 CEST 2003 Daniel Veillard <daniel@veillard.com>
* parser.c: fix a bug raised by the Mips compiler.
diff --git a/Makefile.am b/Makefile.am
index fd6fdf38..8fb810b8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,7 +26,8 @@ libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c \
catalog.c globals.c threads.c c14n.c \
xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
- triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c
+ triostr.c trio.c xmlreader.c relaxng.c dict.c SAX2.c \
+ legacy.c
else
libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
parser.c tree.c hash.c list.c xmlIO.c xmlmemory.c uri.c \
@@ -34,7 +35,8 @@ libxml2_la_SOURCES = SAX.c entities.c encoding.c error.c parserInternals.c \
xpointer.c xinclude.c nanohttp.c nanoftp.c DOCBparser.c \
catalog.c globals.c threads.c c14n.c \
xmlregexp.c xmlschemas.c xmlschemastypes.c xmlunicode.c \
- xmlreader.c relaxng.c dict.c SAX2.c
+ xmlreader.c relaxng.c dict.c SAX2.c \
+ legacy.c
endif
DEPS = $(top_builddir)/libxml2.la
@@ -120,7 +122,7 @@ check-local: tests
testall : tests SVGtests SAXtests
-tests: XMLtests XMLenttests NStests Readertests SAXtests HTMLtests Validtests URItests XPathtests XPtrtests XIncludetests C14Ntests Scripttests Catatests @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@ Timingtests
+tests: XMLtests XMLenttests NStests Readertests SAXtests @TEST_HTML@ @TEST_VALID@ URItests @TEST_XPATH@ @TEST_XPTR@ @TEST_XINCLUDE@ @TEST_C14N@ @TEST_DEBUG@ @TEST_CATALOG@ @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@ Timingtests @TEST_VTIME@
@(if [ "@PYTHON_SUBDIR@" != "" ] ; then cd python ; $(MAKE) tests ; fi)
valgrind:
@@ -720,7 +722,7 @@ $(srcdir)/dba100000.xml: dbgenattr.pl
@echo "## generating dba100000.xml"
@(dbgenattr.pl 100000 > $(srcdir)/dba100000.xml)
-Timingtests: $(srcdir)/dba100000.xml
+Timingtests: xmllint$(EXEEXT) $(srcdir)/dba100000.xml
@echo "##"
@echo "## Timing tests to try to detect performance"
@echo "## as well a memory usage breakage when streaming"
@@ -744,6 +746,8 @@ Timingtests: $(srcdir)/dba100000.xml
if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
exit 0)
+
+VTimingtests: xmllint$(EXEEXT)
-@(xmllint --noout --timing --valid --repeat $(srcdir)/test/valid/REC-xml-19980210.xml; \
MEM=`cat .memdump | grep "MEMORY ALLOCATED" | awk '{ print $$7}'`;\
if [ "$$MEM" != "" ] ; then echo Using $$MEM bytes ; fi ; \
diff --git a/SAX.c b/SAX.c
index 417e450a..b4a1aac6 100644
--- a/SAX.c
+++ b/SAX.c
@@ -28,589 +28,6 @@
#include <libxml/globals.h>
#include <libxml/SAX2.h>
-/* #define DEBUG_SAX */
-/* #define DEBUG_SAX_TREE */
-
-static int deprecated_msg = 0;
-
-#define DEPRECATED(n) \
- if (deprecated_msg == 0) \
- xmlGenericError(xmlGenericErrorContext, \
- "Use of deprecated SAXv1 function %s\n", n); \
- deprecated_msg++;
-
-/**
- * getPublicId:
- * @ctx: the user data (XML parser context)
- *
- * Provides the public ID e.g. "-//SGMLSOURCE//DTD DEMO//EN"
- * DEPRECATED: use xmlSAX2GetPublicId()
- *
- * Returns a xmlChar *
- */
-const xmlChar *
-getPublicId(void *ctx)
-{
- DEPRECATED("getPublicId")
- return(xmlSAX2GetPublicId(ctx));
-}
-
-/**
- * getSystemId:
- * @ctx: the user data (XML parser context)
- *
- * Provides the system ID, basically URL or filename e.g.
- * http://www.sgmlsource.com/dtds/memo.dtd
- * DEPRECATED: use xmlSAX2GetSystemId()
- *
- * Returns a xmlChar *
- */
-const xmlChar *
-getSystemId(void *ctx)
-{
- DEPRECATED("getSystemId")
- return(xmlSAX2GetSystemId(ctx));
-}
-
-/**
- * getLineNumber:
- * @ctx: the user data (XML parser context)
- *
- * Provide the line number of the current parsing point.
- * DEPRECATED: use xmlSAX2GetLineNumber()
- *
- * Returns an int
- */
-int
-getLineNumber(void *ctx)
-{
- DEPRECATED("getLineNumber")
- return(xmlSAX2GetLineNumber(ctx));
-}
-
-/**
- * getColumnNumber:
- * @ctx: the user data (XML parser context)
- *
- * Provide the column number of the current parsing point.
- * DEPRECATED: use xmlSAX2GetColumnNumber()
- *
- * Returns an int
- */
-int
-getColumnNumber(void *ctx)
-{
- DEPRECATED("getColumnNumber")
- return(xmlSAX2GetColumnNumber(ctx));
-}
-
-/**
- * isStandalone:
- * @ctx: the user data (XML parser context)
- *
- * Is this document tagged standalone ?
- * DEPRECATED: use xmlSAX2IsStandalone()
- *
- * Returns 1 if true
- */
-int
-isStandalone(void *ctx)
-{
- DEPRECATED("isStandalone")
- return(xmlSAX2IsStandalone(ctx));
-}
-
-/**
- * hasInternalSubset:
- * @ctx: the user data (XML parser context)
- *
- * Does this document has an internal subset
- * DEPRECATED: use xmlSAX2HasInternalSubset()
- *
- * Returns 1 if true
- */
-int
-hasInternalSubset(void *ctx)
-{
- DEPRECATED("hasInternalSubset")
- return(xmlSAX2HasInternalSubset(ctx));
-}
-
-/**
- * hasExternalSubset:
- * @ctx: the user data (XML parser context)
- *
- * Does this document has an external subset
- * DEPRECATED: use xmlSAX2HasExternalSubset()
- *
- * Returns 1 if true
- */
-int
-hasExternalSubset(void *ctx)
-{
- DEPRECATED("hasExternalSubset")
- return(xmlSAX2HasExternalSubset(ctx));
-}
-
-/**
- * internalSubset:
- * @ctx: the user data (XML parser context)
- * @name: the root element name
- * @ExternalID: the external ID
- * @SystemID: the SYSTEM ID (e.g. filename or URL)
- *
- * Callback on internal subset declaration.
- * DEPRECATED: use xmlSAX2InternalSubset()
- */
-void
-internalSubset(void *ctx, const xmlChar *name,
- const xmlChar *ExternalID, const xmlChar *SystemID)
-{
- DEPRECATED("internalSubset")
- xmlSAX2InternalSubset(ctx, name, ExternalID, SystemID);
-}
-
-/**
- * externalSubset:
- * @ctx: the user data (XML parser context)
- * @name: the root element name
- * @ExternalID: the external ID
- * @SystemID: the SYSTEM ID (e.g. filename or URL)
- *
- * Callback on external subset declaration.
- * DEPRECATED: use xmlSAX2ExternalSubset()
- */
-void
-externalSubset(void *ctx, const xmlChar *name,
- const xmlChar *ExternalID, const xmlChar *SystemID)
-{
- DEPRECATED("externalSubset")
- xmlSAX2ExternalSubset(ctx, name, ExternalID, SystemID);
-}
-
-/**
- * resolveEntity:
- * @ctx: the user data (XML parser context)
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- *
- * The entity loader, to control the loading of external entities,
- * the application can either:
- * - override this resolveEntity() callback in the SAX block
- * - or better use the xmlSetExternalEntityLoader() function to
- * set up it's own entity resolution routine
- * DEPRECATED: use xmlSAX2ResolveEntity()
- *
- * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
- */
-xmlParserInputPtr
-resolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
-{
- DEPRECATED("resolveEntity")
- return(xmlSAX2ResolveEntity(ctx, publicId, systemId));
-}
-
-/**
- * getEntity:
- * @ctx: the user data (XML parser context)
- * @name: The entity name
- *
- * Get an entity by name
- * DEPRECATED: use xmlSAX2GetEntity()
- *
- * Returns the xmlEntityPtr if found.
- */
-xmlEntityPtr
-getEntity(void *ctx, const xmlChar *name)
-{
- DEPRECATED("getEntity")
- return(xmlSAX2GetEntity(ctx, name));
-}
-
-/**
- * getParameterEntity:
- * @ctx: the user data (XML parser context)
- * @name: The entity name
- *
- * Get a parameter entity by name
- * DEPRECATED: use xmlSAX2GetParameterEntity()
- *
- * Returns the xmlEntityPtr if found.
- */
-xmlEntityPtr
-getParameterEntity(void *ctx, const xmlChar *name)
-{
- DEPRECATED("getParameterEntity")
- return(xmlSAX2GetParameterEntity(ctx, name));
-}
-
-
-/**
- * entityDecl:
- * @ctx: the user data (XML parser context)
- * @name: the entity name
- * @type: the entity type
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- * @content: the entity value (without processing).
- *
- * An entity definition has been parsed
- * DEPRECATED: use xmlSAX2EntityDecl()
- */
-void
-entityDecl(void *ctx, const xmlChar *name, int type,
- const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
-{
- DEPRECATED("entityDecl")
- xmlSAX2EntityDecl(ctx, name, type, publicId, systemId, content);
-}
-
-/**
- * attributeDecl:
- * @ctx: the user data (XML parser context)
- * @elem: the name of the element
- * @fullname: the attribute name
- * @type: the attribute type
- * @def: the type of default value
- * @defaultValue: the attribute default value
- * @tree: the tree of enumerated value set
- *
- * An attribute definition has been parsed
- * DEPRECATED: use xmlSAX2AttributeDecl()
- */
-void
-attributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
- int type, int def, const xmlChar *defaultValue,
- xmlEnumerationPtr tree)
-{
- DEPRECATED("attributeDecl")
- xmlSAX2AttributeDecl(ctx, elem, fullname, type, def, defaultValue, tree);
-}
-
-/**
- * elementDecl:
- * @ctx: the user data (XML parser context)
- * @name: the element name
- * @type: the element type
- * @content: the element value tree
- *
- * An element definition has been parsed
- * DEPRECATED: use xmlSAX2ElementDecl()
- */
-void
-elementDecl(void *ctx, const xmlChar * name, int type,
- xmlElementContentPtr content)
-{
- DEPRECATED("elementDecl")
- xmlSAX2ElementDecl(ctx, name, type, content);
-}
-
-/**
- * notationDecl:
- * @ctx: the user data (XML parser context)
- * @name: The name of the notation
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- *
- * What to do when a notation declaration has been parsed.
- * DEPRECATED: use xmlSAX2NotationDecl()
- */
-void
-notationDecl(void *ctx, const xmlChar *name,
- const xmlChar *publicId, const xmlChar *systemId)
-{
- DEPRECATED("notationDecl")
- xmlSAX2NotationDecl(ctx, name, publicId, systemId);
-}
-
-/**
- * unparsedEntityDecl:
- * @ctx: the user data (XML parser context)
- * @name: The name of the entity
- * @publicId: The public ID of the entity
- * @systemId: The system ID of the entity
- * @notationName: the name of the notation
- *
- * What to do when an unparsed entity declaration is parsed
- * DEPRECATED: use xmlSAX2UnparsedEntityDecl()
- */
-void
-unparsedEntityDecl(void *ctx, const xmlChar *name,
- const xmlChar *publicId, const xmlChar *systemId,
- const xmlChar *notationName)
-{
- DEPRECATED("unparsedEntityDecl")
- xmlSAX2UnparsedEntityDecl(ctx, name, publicId, systemId, notationName);
-}
-
-/**
- * setDocumentLocator:
- * @ctx: the user data (XML parser context)
- * @loc: A SAX Locator
- *
- * Receive the document locator at startup, actually xmlDefaultSAXLocator
- * Everything is available on the context, so this is useless in our case.
- * DEPRECATED
- */
-void
-setDocumentLocator(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED)
-{
- DEPRECATED("setDocumentLocator")
-}
-
-/**
- * startDocument:
- * @ctx: the user data (XML parser context)
- *
- * called when the document start being processed.
- * DEPRECATED: use xmlSAX2StartDocument()
- */
-void
-startDocument(void *ctx)
-{
- DEPRECATED("startDocument")
- xmlSAX2StartDocument(ctx);
-}
-
-/**
- * endDocument:
- * @ctx: the user data (XML parser context)
- *
- * called when the document end has been detected.
- * DEPRECATED: use xmlSAX2EndDocument()
- */
-void
-endDocument(void *ctx)
-{
- DEPRECATED("endDocument")
- xmlSAX2EndDocument(ctx);
-}
-
-/**
- * attribute:
- * @ctx: the user data (XML parser context)
- * @fullname: The attribute name, including namespace prefix
- * @value: The attribute value
- *
- * Handle an attribute that has been read by the parser.
- * The default handling is to convert the attribute into an
- * DOM subtree and past it in a new xmlAttr element added to
- * the element.
- * DEPRECATED: use xmlSAX2Attribute()
- */
-void
-attribute(void *ctx ATTRIBUTE_UNUSED, const xmlChar *fullname ATTRIBUTE_UNUSED, const xmlChar *value ATTRIBUTE_UNUSED)
-{
- DEPRECATED("attribute")
-}
-
-/**
- * startElement:
- * @ctx: the user data (XML parser context)
- * @fullname: The element name, including namespace prefix
- * @atts: An array of name/value attributes pairs, NULL terminated
- *
- * called when an opening tag has been processed.
- * DEPRECATED: use xmlSAX2StartElement()
- */
-void
-startElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
-{
- DEPRECATED("startElement")
- xmlSAX2StartElement(ctx, fullname, atts);
-}
-
-/**
- * endElement:
- * @ctx: the user data (XML parser context)
- * @name: The element name
- *
- * called when the end of an element has been detected.
- * DEPRECATED: use xmlSAX2EndElement()
- */
-void
-endElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
-{
- DEPRECATED("endElement")
- xmlSAX2EndElement(ctx, name);
-}
-
-/**
- * reference:
- * @ctx: the user data (XML parser context)
- * @name: The entity name
- *
- * called when an entity reference is detected.
- * DEPRECATED: use xmlSAX2Reference()
- */
-void
-reference(void *ctx, const xmlChar *name)
-{
- DEPRECATED("reference")
- xmlSAX2Reference(ctx, name);
-}
-
-/**
- * characters:
- * @ctx: the user data (XML parser context)
- * @ch: a xmlChar string
- * @len: the number of xmlChar
- *
- * receiving some chars from the parser.
- * DEPRECATED: use xmlSAX2Characters()
- */
-void
-characters(void *ctx, const xmlChar *ch, int len)
-{
- DEPRECATED("characters")
- xmlSAX2Characters(ctx, ch, len);
-}
-
-/**
- * ignorableWhitespace:
- * @ctx: the user data (XML parser context)
- * @ch: a xmlChar string
- * @len: the number of xmlChar
- *
- * receiving some ignorable whitespaces from the parser.
- * UNUSED: by default the DOM building will use characters
- * DEPRECATED: use xmlSAX2IgnorableWhitespace()
- */
-void
-ignorableWhitespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED)
-{
- DEPRECATED("ignorableWhitespace")
-}
-
-/**
- * processingInstruction:
- * @ctx: the user data (XML parser context)
- * @target: the target name
- * @data: the PI data's
- *
- * A processing instruction has been parsed.
- * DEPRECATED: use xmlSAX2ProcessingInstruction()
- */
-void
-processingInstruction(void *ctx, const xmlChar *target,
- const xmlChar *data)
-{
- DEPRECATED("processingInstruction")
- xmlSAX2ProcessingInstruction(ctx, target, data);
-}
-
-/**
- * globalNamespace:
- * @ctx: the user data (XML parser context)
- * @href: the namespace associated URN
- * @prefix: the namespace prefix
- *
- * An old global namespace has been parsed.
- * DEPRECATED
- */
-void
-globalNamespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *href ATTRIBUTE_UNUSED, const xmlChar *prefix ATTRIBUTE_UNUSED)
-{
- DEPRECATED("globalNamespace")
-}
-
-/**
- * setNamespace:
- * @ctx: the user data (XML parser context)
- * @name: the namespace prefix
- *
- * Set the current element namespace.
- * DEPRECATED
- */
-
-void
-setNamespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name ATTRIBUTE_UNUSED)
-{
- DEPRECATED("setNamespace")
-}
-
-/**
- * getNamespace:
- * @ctx: the user data (XML parser context)
- *
- * Get the current element namespace.
- * DEPRECATED
- *
- * Returns the xmlNsPtr or NULL if none
- */
-
-xmlNsPtr
-getNamespace(void *ctx ATTRIBUTE_UNUSED)
-{
- DEPRECATED("getNamespace")
- return(NULL);
-}
-
-/**
- * checkNamespace:
- * @ctx: the user data (XML parser context)
- * @namespace: the namespace to check against
- *
- * Check that the current element namespace is the same as the
- * one read upon parsing.
- * DEPRECATED
- *
- * Returns 1 if true 0 otherwise
- */
-
-int
-checkNamespace(void *ctx ATTRIBUTE_UNUSED, xmlChar *namespace ATTRIBUTE_UNUSED)
-{
- DEPRECATED("checkNamespace")
- return(0);
-}
-
-/**
- * namespaceDecl:
- * @ctx: the user data (XML parser context)
- * @href: the namespace associated URN
- * @prefix: the namespace prefix
- *
- * A namespace has been parsed.
- * DEPRECATED
- */
-void
-namespaceDecl(void *ctx ATTRIBUTE_UNUSED, const xmlChar *href ATTRIBUTE_UNUSED, const xmlChar *prefix ATTRIBUTE_UNUSED)
-{
- DEPRECATED("namespaceDecl")
-}
-
-/**
- * comment:
- * @ctx: the user data (XML parser context)
- * @value: the comment content
- *
- * A comment has been parsed.
- * DEPRECATED: use xmlSAX2Comment()
- */
-void
-comment(void *ctx, const xmlChar *value)
-{
- DEPRECATED("comment")
- xmlSAX2Comment(ctx, value);
-}
-
-/**
- * cdataBlock:
- * @ctx: the user data (XML parser context)
- * @value: The pcdata content
- * @len: the block length
- *
- * called when a pcdata block has been parsed
- * DEPRECATED: use xmlSAX2CDataBlock()
- */
-void
-cdataBlock(void *ctx, const xmlChar *value, int len)
-{
- DEPRECATED("cdataBlock")
- xmlSAX2CDataBlock(ctx, value, len);
-}
-
/**
* initxmlDefaultSAXHandler:
* @hdlr: the SAX handler
diff --git a/SAX2.c b/SAX2.c
index 0625b8a9..261842fb 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -560,12 +560,14 @@ 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 != NULL) && (ctxt->myDoc->intSubset != NULL))
ctxt->valid &= xmlValidateAttributeDecl(&ctxt->vctxt, ctxt->myDoc,
attr);
+#endif /* LIBXML_VALID_ENABLED */
if (prefix != NULL)
xmlFree(prefix);
if (name != NULL)
@@ -606,12 +608,14 @@ xmlSAX2ElementDecl(void *ctx, const xmlChar * name, int type,
name);
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 */
}
/**
@@ -654,11 +658,13 @@ xmlSAX2NotationDecl(void *ctx, const xmlChar *name,
"SAX.xmlSAX2NotationDecl(%s) called while not in subset\n", name);
return;
}
+#ifdef LIBXML_VALID_ENABLED
if (nota == NULL) ctxt->valid = 0;
if (ctxt->validate && ctxt->wellFormed &&
ctxt->myDoc && ctxt->myDoc->intSubset)
ctxt->valid &= xmlValidateNotationDecl(&ctxt->vctxt, ctxt->myDoc,
nota);
+#endif /* LIBXML_VALID_ENABLED */
}
/**
@@ -827,9 +833,11 @@ xmlSAX2EndDocument(void *ctx)
xmlGenericError(xmlGenericErrorContext,
"SAX.xmlSAX2EndDocument()\n");
#endif
+#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
@@ -904,6 +912,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
return;
}
+#ifdef LIBXML_VALID_ENABLED
/*
* Do the last stage of the attribute normalization
* Needed for HTML too:
@@ -918,6 +927,9 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
}
if (nval != NULL)
value = nval;
+#else
+ nval = NULL;
+#endif /* LIBXML_VALID_ENABLED */
/*
* Check whether it's a namespace definition
@@ -958,6 +970,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
/* a default namespace definition */
nsret = xmlNewNs(ctxt->node, val, NULL);
+#ifdef LIBXML_VALID_ENABLED
/*
* Validate also for namespace decls, they are attributes from
* an XML-1.0 perspective
@@ -966,6 +979,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
ctxt->myDoc && ctxt->myDoc->intSubset)
ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
ctxt->node, prefix, nsret, val);
+#endif /* LIBXML_VALID_ENABLED */
if (name != NULL)
xmlFree(name);
if (nval != NULL)
@@ -1027,6 +1041,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
/* a standard namespace definition */
nsret = xmlNewNs(ctxt->node, val, name);
xmlFree(ns);
+#ifdef LIBXML_VALID_ENABLED
/*
* Validate also for namespace decls, they are attributes from
* an XML-1.0 perspective
@@ -1035,6 +1050,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
ctxt->myDoc && ctxt->myDoc->intSubset)
ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
ctxt->node, prefix, nsret, value);
+#endif /* LIBXML_VALID_ENABLED */
if (name != NULL)
xmlFree(name);
if (nval != NULL)
@@ -1099,6 +1115,7 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
}
}
+#ifdef LIBXML_VALID_ENABLED
if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
ctxt->myDoc && ctxt->myDoc->intSubset) {
@@ -1140,7 +1157,9 @@ xmlSAX2AttributeInternal(void *ctx, const xmlChar *fullname,
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, ctxt->myDoc,
ctxt->node, ret, value);
}
- } else if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) &&
+ } else
+#endif /* LIBXML_VALID_ENABLED */
+ if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) &&
(((ctxt->replaceEntities == 0) && (ctxt->external != 2)) ||
((ctxt->replaceEntities != 0) && (ctxt->inSubset == 0)))) {
/*
@@ -1500,6 +1519,7 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
}
}
+#ifdef LIBXML_VALID_ENABLED
/*
* If it's the Document root, finish the DTD validation and
* check the document root element for validity
@@ -1515,6 +1535,7 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
ctxt->vctxt.finishDtd = 1;
}
+#endif /* LIBXML_VALID_ENABLED */
if (prefix != NULL)
xmlFree(prefix);
@@ -1551,10 +1572,12 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
}
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 */
/*
@@ -1636,6 +1659,7 @@ skip:
return(ret);
}
+#ifdef LIBXML_VALID_ENABLED
/*
* xmlSAX2DecodeAttrEntities:
* @ctxt: the parser context
@@ -1664,6 +1688,7 @@ decode:
ctxt->depth--;
return(ret);
}
+#endif /* LIBXML_VALID_ENABLED */
/**
* xmlSAX2AttributeNs:
@@ -1781,6 +1806,7 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
}
}
+#ifdef LIBXML_VALID_ENABLED
if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
ctxt->myDoc && ctxt->myDoc->intSubset) {
/*
@@ -1848,7 +1874,9 @@ xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt,
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
ctxt->myDoc, ctxt->node, ret, dup);
}
- } else if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) &&
+ } else
+#endif /* LIBXML_VALID_ENABLED */
+ if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) &&
(((ctxt->replaceEntities == 0) && (ctxt->external != 2)) ||
((ctxt->replaceEntities != 0) && (ctxt->inSubset == 0)))) {
/*
@@ -1985,11 +2013,13 @@ xmlSAX2StartElementNs(void *ctx,
ctxt->disableSAX = 1;
return;
}
+#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;
@@ -2039,6 +2069,7 @@ 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
@@ -2054,6 +2085,7 @@ xmlSAX2StartElementNs(void *ctx,
ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
ctxt->vctxt.finishDtd = 1;
}
+#endif /* LIBXML_VALID_ENABLED */
}
/**
@@ -2085,9 +2117,11 @@ 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.
diff --git a/configure.in b/configure.in
index 320784de..57bafa00 100644
--- a/configure.in
+++ b/configure.in
@@ -43,6 +43,15 @@ AM_PROG_LIBTOOL
AM_MAINTAINER_MODE
+dnl
+dnl option to build a minimal libxml2 library
+dnl
+AC_ARG_WITH(minimum, [ --with-minimum build a minimally sized library (off)])
+if test "$with_minimum" = "yes"
+then
+ echo "Configuring for a minimal library"
+fi
+
dnl Checks for zlib library.
_cppflags="${CPPFLAGS}"
_ldflags="${LDFLAGS}"
@@ -56,6 +65,10 @@ AC_ARG_WITH(zlib,
LDFLAGS="${LDFLAGS} -L$withval/lib"
fi
])
+if test "$with_minimum" = "yes" -a "$with_zlib" = ""
+then
+ with_zlib=no
+fi
if test "$with_zlib" = "no"; then
echo "Disabling compression support"
else
@@ -197,6 +210,10 @@ dnl ***********************Checking for availability of IPv6*******************
AC_MSG_CHECKING([whether to enable IPv6])
AC_ARG_ENABLE(ipv6, [ --enable-ipv6=[yes/no] enables compilation of IPv6 code],, enable_ipv6=yes)
+if test "$with_minimum" = "yes"
+then
+ enable_ipv6=no
+fi
if test $enable_ipv6 = yes; then
have_ipv6=no
AC_TRY_COMPILE([
@@ -247,6 +264,10 @@ RDL_LIBS=""
AC_ARG_WITH(fexceptions,
[ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)])
+if test "$with_minimum" = "yes" -a "$with_fexceptions" = ""
+then
+ with_fexceptions=no
+fi
dnl
dnl Workaround for native compilers
dnl HP : http://bugs.gnome.org/db/31/3163.html
@@ -305,6 +326,10 @@ PYTHON_SITE_PACKAGES=
pythondir=
AC_ARG_WITH(python,
[ --with-python[[=DIR]] build Python bindings if found])
+if test "$with_minimum" = "yes" -a "$with_python" = ""
+then
+ with_python=no
+fi
if test "$with_python" != "no" ; then
if test -x "$with_python/bin/python"
then
@@ -382,17 +407,24 @@ AC_ARG_WITH(readline,
LDFLAGS="${LDFLAGS} -L$withval/lib"
fi
])
+if test "$with_minimum" = "yes" -a "$with_readline" = ""
+then
+ with_readline=no
+fi
dnl
dnl specific tests to setup DV's devel environment with debug etc ...
dnl (-Wunreachable-code)
dnl
if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ; then
- if test "${with_mem_debug}" = "" ; then
- with_mem_debug="yes"
- fi
- if test "${with_docbook}" = "" ; then
- with_docbook="yes"
+ if test "$with_minimum" != "yes"
+ then
+ if test "${with_mem_debug}" = "" ; then
+ with_mem_debug="yes"
+ fi
+ if test "${with_docbook}" = "" ; then
+ with_docbook="yes"
+ fi
fi
CFLAGS="-g -O -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls "
STATIC_BINARIES="-static"
@@ -426,6 +458,10 @@ TEST_THREADS=""
AC_ARG_WITH(threads,
[ --with-threads add multithread support(on)])
+if test "$with_minimum" = "yes" -a "$with_threads" = ""
+then
+ with_threads=no
+fi
if test "$with_threads" = "no" ; then
echo Disabling multithreaded support
else
@@ -445,6 +481,10 @@ else
fi
AC_ARG_WITH(thread-alloc,
[ --with-thread-alloc add per-thread memory(off)])
+if test "$with_minimum" = "yes" -a "$with_thread_alloc" = ""
+then
+ with_thread_alloc=no
+fi
if test "$with_threads_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
fi
@@ -456,6 +496,10 @@ AC_SUBST(TEST_THREADS)
AC_ARG_WITH(history,
[ --with-history add history support to xmllint shell(off)])
+if test "$with_minimum" = "yes" -a "$with_history" = ""
+then
+ with_history=no
+fi
if test "$with_history" = "yes" ; then
echo Enabling xmllint shell history
dnl check for terminal library. this is a very cool solution
@@ -487,6 +531,10 @@ AC_SUBST(WITH_FTP)
AC_SUBST(FTP_OBJ)
AC_ARG_WITH(ftp,
[ --with-ftp add the FTP support (on)])
+if test "$with_minimum" = "yes" -a "$with_ftp" = ""
+then
+ with_ftp=no
+fi
if test "$with_ftp" = "no" ; then
echo Disabling FTP support
WITH_FTP=0
@@ -500,6 +548,10 @@ AC_SUBST(FTP_OBJ)
AC_ARG_WITH(http,
[ --with-http add the HTTP support (on)])
+if test "$with_minimum" = "yes" -a "$with_http" = ""
+then
+ with_http=no
+fi
if test "$with_http" = "no" ; then
echo Disabling HTTP support
WITH_HTTP=0
@@ -513,32 +565,84 @@ AC_SUBST(HTTP_OBJ)
AC_ARG_WITH(html,
[ --with-html add the HTML support (on)])
+if test "$with_minimum" = "yes" -a "$with_html" = ""
+then
+ with_html=no
+fi
if test "$with_html" = "no" ; then
echo Disabling HTML support
WITH_HTML=0
HTML_OBJ=
+ TEST_HTML=
else
WITH_HTML=1
HTML_OBJ="HTMLparser.o HTMLtree.o"
+ TEST_HTML=HTMLtests
fi
AC_SUBST(WITH_HTML)
AC_SUBST(HTML_OBJ)
+AC_SUBST(TEST_HTML)
+
+AC_ARG_WITH(legacy,
+[ --with-legacy add deprecated APIs for compatibility (on)])
+if test "$with_minimum" = "yes" -a "$with_legacy" = ""
+then
+ with_legacy=no
+fi
+if test "$with_legacy" = "no" ; then
+ echo Disabling deprecated APIs
+ WITH_LEGACY=0
+else
+ WITH_LEGACY=1
+fi
+AC_SUBST(WITH_LEGACY)
+
+AC_ARG_WITH(valid,
+[ --with-valid add the DTD validation support (on)])
+if test "$with_minimum" = "yes" -a "$with_valid" = ""
+then
+ with_valid=no
+fi
+if test "$with_html" = "no" ; then
+ echo Disabling DTD validation support
+ WITH_VALID=0
+ TEST_VALID=
+ TEST_VTIME=
+else
+ WITH_VALID=1
+ TEST_VALID=Validtests
+ TEST_VTIME=VTimingtests
+fi
+AC_SUBST(WITH_VALID)
+AC_SUBST(TEST_VALID)
+AC_SUBST(TEST_VTIME)
AC_ARG_WITH(catalog,
[ --with-catalog add the Catalog support (on)])
+if test "$with_minimum" = "yes" -a "$with_catalog" = ""
+then
+ with_catalog=no
+fi
if test "$with_catalog" = "no" ; then
echo Disabling Catalog support
WITH_CATALOG=0
CATALOG_OBJ=
+ TEST_CATALOG=
else
WITH_CATALOG=1
CATALOG_OBJ="catalog.o"
+ TEST_CATALOG=Catatests
fi
AC_SUBST(WITH_CATALOG)
AC_SUBST(CATALOG_OBJ)
+AC_SUBST(TEST_CATALOG)
AC_ARG_WITH(docbook,
[ --with-docbook add Docbook SGML support (on)])
+if test "$with_minimum" = "yes" -a "$with_docbook" = ""
+then
+ with_docbook=no
+fi
if test "$with_docbook" = "no" ; then
echo Disabling Docbook support
WITH_DOCB=0
@@ -553,6 +657,10 @@ AC_SUBST(DOCB_OBJ)
AC_ARG_WITH(xpath,
[ --with-xpath add the XPATH support (on)])
+if test "$with_minimum" = "yes" -a "$with_xpath" = ""
+then
+ with_xpath=no
+fi
if test "$with_xpath" = "no" ; then
echo Disabling XPATH support
with_xptr="no"
@@ -560,56 +668,84 @@ if test "$with_xpath" = "no" ; then
with_xinclude="no"
WITH_XPATH=0
XPATH_OBJ=
+ TEST_XPATH=
else
WITH_XPATH=1
XPATH_OBJ=xpath.o
+ TEST_XPATH=XPathtests
fi
AC_SUBST(WITH_XPATH)
AC_SUBST(XPATH_OBJ)
+AC_SUBST(TEST_XPATH)
AC_ARG_WITH(xptr,
[ --with-xptr add the XPointer support (on)])
+if test "$with_minimum" = "yes" -a "$with_xptr" = ""
+then
+ with_xptr=no
+fi
if test "$with_xptr" = "no" ; then
echo Disabling XPointer support
WITH_XPTR=0
XPTR_OBJ=
+ TEST_XPTR=
else
WITH_XPTR=1
XPTR_OBJ=xpointer.o
+ TEST_XPTR=XPtrtests
fi
AC_SUBST(WITH_XPTR)
AC_SUBST(XPTR_OBJ)
+AC_SUBST(TEST_XPTR)
AC_ARG_WITH(c14n,
[ --with-c14n add the Canonicalization support (on)])
+if test "$with_minimum" = "yes" -a "$with_c14n" = ""
+then
+ with_c14n=no
+fi
if test "$with_c14n" = "no" ; then
echo Disabling C14N support
WITH_C14N=0
C14N_OBJ=
+ TEST_C14N=
else
WITH_C14N=1
C14N_OBJ="c14n.c"
+ TEST_C14N=C14Ntests
fi
AC_SUBST(WITH_C14N)
AC_SUBST(C14N_OBJ)
+AC_SUBST(TEST_C14N)
AC_ARG_WITH(xinclude,
[ --with-xinclude add the XInclude support (on)])
+if test "$with_minimum" = "yes" -a "$with_xinclude" = ""
+then
+ with_xinclude=no
+fi
if test "$with_xinclude" = "no" ; then
echo Disabling XInclude support
WITH_XINCLUDE=0
XINCLUDE_OBJ=
with_xinclude="no"
+ TEST_XINCLUDE=
else
WITH_XINCLUDE=1
XINCLUDE_OBJ=xinclude.o
+ TEST_XINCLUDE=XIncludetests
fi
AC_SUBST(WITH_XINCLUDE)
AC_SUBST(XINCLUDE_OBJ)
+AC_SUBST(TEST_XINCLUDE)
WITH_ICONV=0
AC_ARG_WITH(iconv,
[ --with-iconv[[=DIR]] add ICONV support (on)])
+if test "$with_minimum" = "yes" -a "$with_iconv" = ""
+then
+ with_iconv=no
+fi
if test "$with_iconv" = "no" ; then
echo Disabling ICONV support
else
@@ -657,6 +793,10 @@ AC_SUBST(WITH_ICONV)
WITH_ISO8859X=1
AC_ARG_WITH(iso8859x,
[ --with-iso8859x add ISO8859X support if no iconv (on)])
+if test "$with_minimum" = "yes" -a "$with_iso8859x" = ""
+then
+ with_iso8859x=no
+fi
if test "$WITH_ICONV" != "1" ; then
if test "$with_iso8859x" = "no" ; then
echo Disabling ISO8859X support
@@ -667,6 +807,10 @@ AC_SUBST(WITH_ISO8859X)
AC_ARG_WITH(schemas,
[ --with-schemas add experimental Schemas/RelaxNG support (on)])
+if test "$with_minimum" = "yes" -a "$with_schemas" = ""
+then
+ with_schemas=no
+fi
if test "$with_schemas" = "no" ; then
echo "Disabled Schemas/Relax-NG support"
WITH_SCHEMAS=0
@@ -682,6 +826,10 @@ AC_SUBST(TEST_SCHEMAS)
AC_ARG_WITH(regexps,
[ --with-regexps add Regular Expressions support (on)])
+if test "$with_minimum" = "yes" -a "$with_regexps" = ""
+then
+ with_regexps=no
+fi
if test "$with_regexps" = "no" ; then
echo Disabling Regexps support
WITH_REGEXPS=0
@@ -695,19 +843,30 @@ AC_SUBST(TEST_REGEXPS)
AC_ARG_WITH(debug,
[ --with-debug add the debugging module (on)])
+if test "$with_minimum" = "yes" -a "$with_debug" = ""
+then
+ with_debug=no
+fi
if test "$with_debug" = "no" ; then
echo Disabling DEBUG support
WITH_DEBUG=0
DEBUG_OBJ=
+ TEST_DEBUG=
else
WITH_DEBUG=1
DEBUG_OBJ=debugXML.o
+ TEST_DEBUG=Scripttests
fi
AC_SUBST(WITH_DEBUG)
AC_SUBST(DEBUG_OBJ)
+AC_SUBST(TEST_DEBUG)
AC_ARG_WITH(mem_debug,
[ --with-mem-debug add the memory debugging module (off)])
+if test "$with_minimum" = "yes" -a "$with_mem_debug" = ""
+then
+ with_mem_debug=no
+fi
if test "$with_mem_debug" = "yes" ; then
echo Enabling memory debug support
WITH_MEM_DEBUG=1
diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml
index b120ac3f..402fcd81 100644
--- a/doc/libxml2-api.xml
+++ b/doc/libxml2-api.xml
@@ -1380,6 +1380,7 @@
<exports symbol='xmlTextReaderNodeType'/>
<exports symbol='xmlTextReaderNormalization'/>
<exports symbol='xmlTextReaderPrefix'/>
+ <exports symbol='xmlTextReaderPreserve'/>
<exports symbol='xmlTextReaderPtr'/>
<exports symbol='xmlTextReaderQuoteChar'/>
<exports symbol='xmlTextReaderRead'/>
@@ -7012,7 +7013,7 @@ actually an xmlCharEncoding'/>
<arg name='publicID' type='const xmlChar *' info='the public identifier'/>
</function>
<function name='xmlKeepBlanksDefault' file='parser'>
- <info>Set and return the previous value for default blanks text nodes support. The 1.x version of the parser used an heuristic to try to detect ignorable white spaces. As a result the SAX callback was generating ignorableWhitespace() callbacks instead of characters() one, and when using the DOM output text nodes containing those blanks were not generated. The 2.x and later version will switch to the XML standard way and ignorableWhitespace() are only generated when running the parser in validating mode and when the current element doesn&apos;t allow CDATA or mixed content. This function is provided as a way to force the standard behavior on 1.X libs and to switch back to the old mode for compatibility when running 1.X client code on 2.X . Upgrade of 1.X code should be done by using xmlIsBlankNode() commodity function to detect the &quot;empty&quot; nodes generated. This value also affect autogeneration of indentation when saving code if blanks sections are kept, indentation is not generated.</info>
+ <info>Set and return the previous value for default blanks text nodes support. The 1.x version of the parser used an heuristic to try to detect ignorable white spaces. As a result the SAX callback was generating xmlSAX2IgnorableWhitespace() callbacks instead of characters() one, and when using the DOM output text nodes containing those blanks were not generated. The 2.x and later version will switch to the XML standard way and ignorableWhitespace() are only generated when running the parser in validating mode and when the current element doesn&apos;t allow CDATA or mixed content. This function is provided as a way to force the standard behavior on 1.X libs and to switch back to the old mode for compatibility when running 1.X client code on 2.X . Upgrade of 1.X code should be done by using xmlIsBlankNode() commodity function to detect the &quot;empty&quot; nodes generated. This value also affect autogeneration of indentation when saving code if blanks sections are kept, indentation is not generated.</info>
<return type='int' info='the last value for 0 for no substitution, 1 for substitution.'/>
<arg name='val' type='int' info='int 0 or 1'/>
</function>
@@ -10064,6 +10065,11 @@ actually an xmlCharEncoding'/>
<return type='xmlChar *' info='the prefix or NULL if not available'/>
<arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
</function>
+ <function name='xmlTextReaderPreserve' file='xmlreader'>
+ <info>current node being accessed by the xmlTextReader. This is dangerous because the underlying node may be destroyed on the next Reads.</info>
+ <return type='xmlNodePtr' info='the xmlNodePtr or NULL in case of error.'/>
+ <arg name='reader' type='xmlTextReaderPtr' info='the xmlTextReaderPtr used'/>
+ </function>
<function name='xmlTextReaderQuoteChar' file='xmlreader'>
<info>The quotation mark character used to enclose the value of an attribute.</info>
<return type='int' info='&quot; or &apos; and -1 in case of error'/>
diff --git a/entities.c b/entities.c
index 1ab70bd5..ae6fe488 100644
--- a/entities.c
+++ b/entities.c
@@ -413,150 +413,6 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) {
(((c) >= 0x20) && ((c) != 0xFFFE) && ((c) != 0xFFFF)))
/*
- * A buffer used for converting entities to their equivalent and back.
- */
-static int static_buffer_size = 0;
-static xmlChar *static_buffer = NULL;
-
-static int growBuffer(void) {
- static_buffer_size *= 2;
- static_buffer = (xmlChar *) xmlRealloc(static_buffer,
- static_buffer_size * sizeof(xmlChar));
- if (static_buffer == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
- return(-1);
- }
- return(0);
-}
-
-
-/**
- * xmlEncodeEntities:
- * @doc: the document containing the string
- * @input: A string to convert to XML.
- *
- * Do a global encoding of a string, replacing the predefined entities
- * and non ASCII values with their entities and CharRef counterparts.
- *
- * TODO: remove xmlEncodeEntities, once we are not afraid of breaking binary
- * compatibility
- *
- * People must migrate their code to xmlEncodeEntitiesReentrant !
- * This routine will issue a warning when encountered.
- *
- * Returns A newly allocated string with the substitution done.
- */
-const xmlChar *
-xmlEncodeEntities(xmlDocPtr doc, const xmlChar *input) {
- const xmlChar *cur = input;
- xmlChar *out = static_buffer;
- static int warning = 1;
- int html = 0;
-
-
- if (warning) {
- xmlGenericError(xmlGenericErrorContext,
- "Deprecated API xmlEncodeEntities() used\n");
- xmlGenericError(xmlGenericErrorContext,
- " change code to use xmlEncodeEntitiesReentrant()\n");
- warning = 0;
- }
-
- if (input == NULL) return(NULL);
- if (doc != NULL)
- html = (doc->type == XML_HTML_DOCUMENT_NODE);
-
- if (static_buffer == NULL) {
- static_buffer_size = 1000;
- static_buffer = (xmlChar *)
- xmlMalloc(static_buffer_size * sizeof(xmlChar));
- if (static_buffer == NULL) {
- xmlGenericError(xmlGenericErrorContext, "malloc failed\n");
- return(NULL);
- }
- out = static_buffer;
- }
- while (*cur != '\0') {
- if (out - static_buffer > static_buffer_size - 100) {
- int indx = out - static_buffer;
-
- growBuffer();
- out = &static_buffer[indx];
- }
-
- /*
- * By default one have to encode at least '<', '>', '"' and '&' !
- */
- if (*cur == '<') {
- *out++ = '&';
- *out++ = 'l';
- *out++ = 't';
- *out++ = ';';
- } else if (*cur == '>') {
- *out++ = '&';
- *out++ = 'g';
- *out++ = 't';
- *out++ = ';';
- } else if (*cur == '&') {
- *out++ = '&';
- *out++ = 'a';
- *out++ = 'm';
- *out++ = 'p';
- *out++ = ';';
- } else if (*cur == '"') {
- *out++ = '&';
- *out++ = 'q';
- *out++ = 'u';
- *out++ = 'o';
- *out++ = 't';
- *out++ = ';';
- } else if ((*cur == '\'') && (!html)) {
- *out++ = '&';
- *out++ = 'a';
- *out++ = 'p';
- *out++ = 'o';
- *out++ = 's';
- *out++ = ';';
- } else if (((*cur >= 0x20) && (*cur < 0x80)) ||
- (*cur == '\n') || (*cur == '\r') || (*cur == '\t')) {
- /*
- * default case, just copy !
- */
- *out++ = *cur;
-#ifndef USE_UTF_8
- } else if ((sizeof(xmlChar) == 1) && (*cur >= 0x80)) {
- char buf[10], *ptr;
-
- snprintf(buf, sizeof(buf), "&#%d;", *cur);
- buf[sizeof(buf) - 1] = 0;
- ptr = buf;
- while (*ptr != 0) *out++ = *ptr++;
-#endif
- } else if (IS_CHAR((unsigned int) *cur)) {
- char buf[10], *ptr;
-
- snprintf(buf, sizeof(buf), "&#%d;", *cur);
- buf[sizeof(buf) - 1] = 0;
- ptr = buf;
- while (*ptr != 0) *out++ = *ptr++;
- }
-#if 0
- else {
- /*
- * default case, this is not a valid char !
- * Skip it...
- */
- xmlGenericError(xmlGenericErrorContext,
- "xmlEncodeEntities: invalid char %d\n", (int) *cur);
- }
-#endif
- cur++;
- }
- *out++ = 0;
- return(static_buffer);
-}
-
-/*
* Macro used to grow the current buffer.
*/
#define growBufferReentrant() { \
@@ -632,22 +488,6 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
*out++ = 'm';
*out++ = 'p';
*out++ = ';';
-#if 0
- } else if (*cur == '"') {
- *out++ = '&';
- *out++ = 'q';
- *out++ = 'u';
- *out++ = 'o';
- *out++ = 't';
- *out++ = ';';
- } else if ((*cur == '\'') && (!html)) {
- *out++ = '&';
- *out++ = 'a';
- *out++ = 'p';
- *out++ = 'o';
- *out++ = 's';
- *out++ = ';';
-#endif
} else if (((*cur >= 0x20) && (*cur < 0x80)) ||
(*cur == '\n') || (*cur == '\t') || ((html) && (*cur == '\r'))) {
/*
@@ -739,16 +579,6 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
ptr = buf;
while (*ptr != 0) *out++ = *ptr++;
}
-#if 0
- else {
- /*
- * default case, this is not a valid char !
- * Skip it...
- */
- xmlGenericError(xmlGenericErrorContext,
- "xmlEncodeEntities: invalid char %d\n", (int) *cur);
- }
-#endif
cur++;
}
*out++ = 0;
@@ -771,12 +601,6 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) {
xmlChar *buffer = NULL;
xmlChar *out = NULL;
int buffer_size = 0;
-#if 0
- int html = 0;
-
- if (doc != NULL)
- html = (doc->type == XML_HTML_DOCUMENT_NODE);
-#endif
if (input == NULL) return(NULL);
/*
diff --git a/globals.c b/globals.c
index bdbbc376..070c1e49 100644
--- a/globals.c
+++ b/globals.c
@@ -484,10 +484,10 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef;
gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef;
initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
- gs->xmlDefaultSAXLocator.getPublicId = getPublicId;
- gs->xmlDefaultSAXLocator.getSystemId = getSystemId;
- gs->xmlDefaultSAXLocator.getLineNumber = getLineNumber;
- gs->xmlDefaultSAXLocator.getColumnNumber = getColumnNumber;
+ gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId;
+ gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
+ gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
+ gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
gs->xmlDoValidityCheckingDefaultValue =
xmlDoValidityCheckingDefaultValueThrDef;
#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in
index e5ecc190..ef1a3351 100644
--- a/include/libxml/xmlversion.h.in
+++ b/include/libxml/xmlversion.h.in
@@ -102,6 +102,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
+ * LIBXML_VALID_ENABLED:
+ *
+ * Whether the DTD validation support is configured in
+ */
+#if @WITH_VALID@
+#define LIBXML_VALID_ENABLED
+#endif
+
+/**
* LIBXML_HTML_ENABLED:
*
* Whether the HTML support is configured in
@@ -111,6 +120,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif
/**
+ * LIBXML_LEGACY_ENABLED:
+ *
+ * Whether the deprecated APIs are compiled in for compatibility
+ */
+#if @WITH_LEGACY@
+#define LIBXML_LEGACY_ENABLED
+#endif
+
+/**
* LIBXML_C14N_ENABLED:
*
* Whether the Canonicalization support is configured in
diff --git a/parser.c b/parser.c
index b7082ab5..746d2b00 100644
--- a/parser.c
+++ b/parser.c
@@ -657,6 +657,78 @@ mem_error:
return;
}
+/**
+ * xmlCheckLanguageID:
+ * @lang: pointer to the string value
+ *
+ * Checks that the value conforms to the LanguageID production:
+ *
+ * NOTE: this is somewhat deprecated, those productions were removed from
+ * the XML Second edition.
+ *
+ * [33] LanguageID ::= Langcode ('-' Subcode)*
+ * [34] Langcode ::= ISO639Code | IanaCode | UserCode
+ * [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z])
+ * [36] IanaCode ::= ('i' | 'I') '-' ([a-z] | [A-Z])+
+ * [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+
+ * [38] Subcode ::= ([a-z] | [A-Z])+
+ *
+ * Returns 1 if correct 0 otherwise
+ **/
+int
+xmlCheckLanguageID(const xmlChar * lang)
+{
+ const xmlChar *cur = lang;
+
+ if (cur == NULL)
+ return (0);
+ if (((cur[0] == 'i') && (cur[1] == '-')) ||
+ ((cur[0] == 'I') && (cur[1] == '-'))) {
+ /*
+ * IANA code
+ */
+ cur += 2;
+ while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
+ ((cur[0] >= 'a') && (cur[0] <= 'z')))
+ cur++;
+ } else if (((cur[0] == 'x') && (cur[1] == '-')) ||
+ ((cur[0] == 'X') && (cur[1] == '-'))) {
+ /*
+ * User code
+ */
+ cur += 2;
+ while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
+ ((cur[0] >= 'a') && (cur[0] <= 'z')))
+ cur++;
+ } else if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
+ ((cur[0] >= 'a') && (cur[0] <= 'z'))) {
+ /*
+ * ISO639
+ */
+ cur++;
+ if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
+ ((cur[0] >= 'a') && (cur[0] <= 'z')))
+ cur++;
+ else
+ return (0);
+ } else
+ return (0);
+ while (cur[0] != 0) { /* non input consuming */
+ if (cur[0] != '-')
+ return (0);
+ cur++;
+ if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
+ ((cur[0] >= 'a') && (cur[0] <= 'z')))
+ cur++;
+ else
+ return (0);
+ while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
+ ((cur[0] >= 'a') && (cur[0] <= 'z')))
+ cur++;
+ }
+ return (1);
+}
+
/************************************************************************
* *
* Parser stacks related functions and macros *
@@ -8185,6 +8257,7 @@ 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
@@ -8193,6 +8266,7 @@ xmlParseElement(xmlParserCtxtPtr ctxt) {
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.
@@ -9406,6 +9480,7 @@ 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
@@ -9414,6 +9489,7 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
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.
@@ -10219,6 +10295,7 @@ xmlCreateIOParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
return(ctxt);
}
+#ifdef LIBXML_VALID_ENABLED
/************************************************************************
* *
* Front ends when parsing a DTD *
@@ -10437,6 +10514,7 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
return(ret);
}
+
/**
* xmlParseDTD:
* @ExternalID: a NAME* containing the External ID of the DTD
@@ -10451,6 +10529,7 @@ xmlDtdPtr
xmlParseDTD(const xmlChar *ExternalID, const xmlChar *SystemID) {
return(xmlSAXParseDTD(NULL, ExternalID, SystemID));
}
+#endif /* LIBXML_VALID_ENABLED */
/************************************************************************
* *
@@ -10985,11 +11064,13 @@ 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) {
oldctxt->valid &= xmlValidateElement(&oldctxt->vctxt,
oldctxt->myDoc, cur);
}
+#endif /* LIBXML_VALID_ENABLED */
cur->parent = NULL;
cur = cur->next;
}
@@ -12024,8 +12105,10 @@ xmlCtxtReset(xmlParserCtxtPtr ctxt)
ctxt->attsSpecial = NULL;
}
+#ifdef LIBXML_CATALOG_ENABLED
if (ctxt->catalogs != NULL)
xmlCatalogFreeLocal(ctxt->catalogs);
+#endif
}
/**
diff --git a/parserInternals.c b/parserInternals.c
index c2d88f7c..0ab1c817 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -54,8 +54,6 @@
#endif
#include <libxml/globals.h>
-void xmlUpgradeOldNs(xmlDocPtr doc);
-
/*
* Various global defaults for parsing
*/
@@ -2713,405 +2711,3 @@ xmlKeepBlanksDefault(int val) {
return(old);
}
-/************************************************************************
- * *
- * Deprecated functions kept for compatibility *
- * *
- ************************************************************************/
-
-/**
- * xmlCheckLanguageID:
- * @lang: pointer to the string value
- *
- * Checks that the value conforms to the LanguageID production:
- *
- * NOTE: this is somewhat deprecated, those productions were removed from
- * the XML Second edition.
- *
- * [33] LanguageID ::= Langcode ('-' Subcode)*
- * [34] Langcode ::= ISO639Code | IanaCode | UserCode
- * [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z])
- * [36] IanaCode ::= ('i' | 'I') '-' ([a-z] | [A-Z])+
- * [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+
- * [38] Subcode ::= ([a-z] | [A-Z])+
- *
- * Returns 1 if correct 0 otherwise
- **/
-int
-xmlCheckLanguageID(const xmlChar * lang)
-{
- const xmlChar *cur = lang;
-
- if (cur == NULL)
- return (0);
- if (((cur[0] == 'i') && (cur[1] == '-')) ||
- ((cur[0] == 'I') && (cur[1] == '-'))) {
- /*
- * IANA code
- */
- cur += 2;
- while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
- ((cur[0] >= 'a') && (cur[0] <= 'z')))
- cur++;
- } else if (((cur[0] == 'x') && (cur[1] == '-')) ||
- ((cur[0] == 'X') && (cur[1] == '-'))) {
- /*
- * User code
- */
- cur += 2;
- while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
- ((cur[0] >= 'a') && (cur[0] <= 'z')))
- cur++;
- } else if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
- ((cur[0] >= 'a') && (cur[0] <= 'z'))) {
- /*
- * ISO639
- */
- cur++;
- if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
- ((cur[0] >= 'a') && (cur[0] <= 'z')))
- cur++;
- else
- return (0);
- } else
- return (0);
- while (cur[0] != 0) { /* non input consuming */
- if (cur[0] != '-')
- return (0);
- cur++;
- if (((cur[0] >= 'A') && (cur[0] <= 'Z')) ||
- ((cur[0] >= 'a') && (cur[0] <= 'z')))
- cur++;
- else
- return (0);
- while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || /* non input consuming */
- ((cur[0] >= 'a') && (cur[0] <= 'z')))
- cur++;
- }
- return (1);
-}
-
-/**
- * xmlDecodeEntities:
- * @ctxt: the parser context
- * @len: the len to decode (in bytes !), -1 for no size limit
- * @what: combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF
- * @end: an end marker xmlChar, 0 if none
- * @end2: an end marker xmlChar, 0 if none
- * @end3: an end marker xmlChar, 0 if none
- *
- * This function is deprecated, we now always process entities content
- * through xmlStringDecodeEntities
- *
- * TODO: remove it in next major release.
- *
- * [67] Reference ::= EntityRef | CharRef
- *
- * [69] PEReference ::= '%' Name ';'
- *
- * Returns A newly allocated string with the substitution done. The caller
- * must deallocate it !
- */
-xmlChar *
-xmlDecodeEntities(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
- int len ATTRIBUTE_UNUSED, int what ATTRIBUTE_UNUSED,
- xmlChar end ATTRIBUTE_UNUSED,
- xmlChar end2 ATTRIBUTE_UNUSED,
- xmlChar end3 ATTRIBUTE_UNUSED)
-{
- static int deprecated = 0;
-
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlDecodeEntities() deprecated function reached\n");
- deprecated = 1;
- }
- return (NULL);
-}
-
-/**
- * xmlNamespaceParseNCName:
- * @ctxt: an XML parser context
- *
- * parse an XML namespace name.
- *
- * TODO: this seems not in use anymore, the namespace handling is done on
- * top of the SAX interfaces, i.e. not on raw input.
- *
- * [NS 3] NCName ::= (Letter | '_') (NCNameChar)*
- *
- * [NS 4] NCNameChar ::= Letter | Digit | '.' | '-' | '_' |
- * CombiningChar | Extender
- *
- * Returns the namespace name or NULL
- */
-
-xmlChar *
-xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
-{
- static int deprecated = 0;
-
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNamespaceParseNCName() deprecated function reached\n");
- deprecated = 1;
- }
- return (NULL);
-}
-
-/**
- * xmlNamespaceParseQName:
- * @ctxt: an XML parser context
- * @prefix: a xmlChar **
- *
- * TODO: this seems not in use anymore, the namespace handling is done on
- * top of the SAX interfaces, i.e. not on raw input.
- *
- * parse an XML qualified name
- *
- * [NS 5] QName ::= (Prefix ':')? LocalPart
- *
- * [NS 6] Prefix ::= NCName
- *
- * [NS 7] LocalPart ::= NCName
- *
- * Returns the local part, and prefix is updated
- * to get the Prefix if any.
- */
-
-xmlChar *
-xmlNamespaceParseQName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
- xmlChar ** prefix ATTRIBUTE_UNUSED)
-{
-
- static int deprecated = 0;
-
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNamespaceParseQName() deprecated function reached\n");
- deprecated = 1;
- }
- return (NULL);
-}
-
-/**
- * xmlNamespaceParseNSDef:
- * @ctxt: an XML parser context
- *
- * parse a namespace prefix declaration
- *
- * TODO: this seems not in use anymore, the namespace handling is done on
- * top of the SAX interfaces, i.e. not on raw input.
- *
- * [NS 1] NSDef ::= PrefixDef Eq SystemLiteral
- *
- * [NS 2] PrefixDef ::= 'xmlns' (':' NCName)?
- *
- * Returns the namespace name
- */
-
-xmlChar *
-xmlNamespaceParseNSDef(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
-{
- static int deprecated = 0;
-
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNamespaceParseNSDef() deprecated function reached\n");
- deprecated = 1;
- }
- return (NULL);
-}
-
-/**
- * xmlParseQuotedString:
- * @ctxt: an XML parser context
- *
- * Parse and return a string between quotes or doublequotes
- *
- * TODO: Deprecated, to be removed at next drop of binary compatibility
- *
- * Returns the string parser or NULL.
- */
-xmlChar *
-xmlParseQuotedString(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
-{
- static int deprecated = 0;
-
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParseQuotedString() deprecated function reached\n");
- deprecated = 1;
- }
- return (NULL);
-}
-
-/**
- * xmlParseNamespace:
- * @ctxt: an XML parser context
- *
- * xmlParseNamespace: parse specific PI '<?namespace ...' constructs.
- *
- * This is what the older xml-name Working Draft specified, a bunch of
- * other stuff may still rely on it, so support is still here as
- * if it was declared on the root of the Tree:-(
- *
- * TODO: remove from library
- *
- * To be removed at next drop of binary compatibility
- */
-
-void
-xmlParseNamespace(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
-{
- static int deprecated = 0;
-
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParseNamespace() deprecated function reached\n");
- deprecated = 1;
- }
-}
-
-/**
- * xmlScanName:
- * @ctxt: an XML parser context
- *
- * Trickery: parse an XML name but without consuming the input flow
- * Needed for rollback cases. Used only when parsing entities references.
- *
- * TODO: seems deprecated now, only used in the default part of
- * xmlParserHandleReference
- *
- * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
- * CombiningChar | Extender
- *
- * [5] Name ::= (Letter | '_' | ':') (NameChar)*
- *
- * [6] Names ::= Name (S Name)*
- *
- * Returns the Name parsed or NULL
- */
-
-xmlChar *
-xmlScanName(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
-{
- static int deprecated = 0;
-
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlScanName() deprecated function reached\n");
- deprecated = 1;
- }
- return (NULL);
-}
-
-/**
- * xmlParserHandleReference:
- * @ctxt: the parser context
- *
- * TODO: Remove, now deprecated ... the test is done directly in the
- * content parsing
- * routines.
- *
- * [67] Reference ::= EntityRef | CharRef
- *
- * [68] EntityRef ::= '&' Name ';'
- *
- * [ WFC: Entity Declared ]
- * the Name given in the entity reference must match that in an entity
- * declaration, except that well-formed documents need not declare any
- * of the following entities: amp, lt, gt, apos, quot.
- *
- * [ WFC: Parsed Entity ]
- * An entity reference must not contain the name of an unparsed entity
- *
- * [66] CharRef ::= '&#' [0-9]+ ';' |
- * '&#x' [0-9a-fA-F]+ ';'
- *
- * A PEReference may have been detected in the current input stream
- * the handling is done accordingly to
- * http://www.w3.org/TR/REC-xml#entproc
- */
-void
-xmlParserHandleReference(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
-{
- static int deprecated = 0;
-
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParserHandleReference() deprecated function reached\n");
- deprecated = 1;
- }
-
- return;
-}
-
-/**
- * xmlHandleEntity:
- * @ctxt: an XML parser context
- * @entity: an XML entity pointer.
- *
- * Default handling of defined entities, when should we define a new input
- * stream ? When do we just handle that as a set of chars ?
- *
- * OBSOLETE: to be removed at some point.
- */
-
-void
-xmlHandleEntity(xmlParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
- xmlEntityPtr entity ATTRIBUTE_UNUSED)
-{
- static int deprecated = 0;
-
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlHandleEntity() deprecated function reached\n");
- deprecated = 1;
- }
-}
-
-/**
- * xmlNewGlobalNs:
- * @doc: the document carrying the namespace
- * @href: the URI associated
- * @prefix: the prefix for the namespace
- *
- * Creation of a Namespace, the old way using PI and without scoping
- * DEPRECATED !!!
- * It now create a namespace on the root element of the document if found.
- * Returns NULL this functionality had been removed
- */
-xmlNsPtr
-xmlNewGlobalNs(xmlDocPtr doc ATTRIBUTE_UNUSED,
- const xmlChar * href ATTRIBUTE_UNUSED,
- const xmlChar * prefix ATTRIBUTE_UNUSED)
-{
- static int deprecated = 0;
-
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlNewGlobalNs() deprecated function reached\n");
- deprecated = 1;
- }
- return (NULL);
-}
-
-/**
- * xmlUpgradeOldNs:
- * @doc: a document pointer
- *
- * Upgrade old style Namespaces (PI) and move them to the root of the document.
- * DEPRECATED
- */
-void
-xmlUpgradeOldNs(xmlDocPtr doc ATTRIBUTE_UNUSED)
-{
- static int deprecated = 0;
-
- if (!deprecated) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlUpgradeOldNs() deprecated function reached\n");
- deprecated = 1;
- }
-}
diff --git a/python/libxml2class.txt b/python/libxml2class.txt
index 7214e36c..0d1cd4bc 100644
--- a/python/libxml2class.txt
+++ b/python/libxml2class.txt
@@ -693,6 +693,7 @@ Class xmlTextReader(xmlTextReaderCore)
NodeType()
Normalization()
Prefix()
+ Preserve()
QuoteChar()
Read()
ReadAttributeValue()
diff --git a/python/tests/reader2.py b/python/tests/reader2.py
index e3252272..d122dca9 100755
--- a/python/tests/reader2.py
+++ b/python/tests/reader2.py
@@ -229,7 +229,7 @@ res=""
err=""
input = libxml2.inputBuffer(StringIO.StringIO(s))
-reader = input.newTextReader("test4")
+reader = input.newTextReader("test5")
reader.SetParserProp(libxml2.PARSER_VALIDATE,1)
while reader.Read() == 1:
res = res + "%s %s %d\n" % (reader.NodeType(),reader.Name(),reader.Depth())
diff --git a/tree.c b/tree.c
index 4b7ef5ee..b372e43e 100644
--- a/tree.c
+++ b/tree.c
@@ -7062,9 +7062,11 @@ xmlElemDump(FILE * f, xmlDocPtr doc, xmlNodePtr cur)
* *
************************************************************************/
+#ifdef LIBXML_HTML_ENABLED
static void
xhtmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
int level, int format, const char *encoding);
+#endif
static void
xmlNodeListDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
int level, int format, const char *encoding);
diff --git a/valid.c b/valid.c
index 470f912f..b1555a8d 100644
--- a/valid.c
+++ b/valid.c
@@ -25,6 +25,10 @@
#include <libxml/list.h>
#include <libxml/globals.h>
+static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name,
+ int create);
+#ifdef LIBXML_VALID_ENABLED
+
/* #define DEBUG_VALID_ALGO */
/* #define DEBUG_REGEXP_ALGO */
@@ -449,8 +453,6 @@ xmlValidStateDebug(xmlValidCtxtPtr ctxt) {
else if ((doc->intSubset == NULL) && \
(doc->extSubset == NULL)) return(0)
-static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name,
- int create);
xmlAttributePtr xmlScanAttributeDecl(xmlDtdPtr dtd, const xmlChar *elem);
#ifdef LIBXML_REGEXP_ENABLED
@@ -709,6 +711,8 @@ xmlFreeValidCtxt(xmlValidCtxtPtr cur) {
xmlFree(cur);
}
+#endif /* LIBXML_VALID_ENABLED */
+
/**
* xmlNewElementContent:
* @name: the subelement name or NULL
@@ -1160,10 +1164,12 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
ret = xmlHashLookup2(table, name, ns);
if (ret != NULL) {
if (ret->etype != XML_ELEMENT_TYPE_UNDEFINED) {
+#ifdef LIBXML_VALID_ENABLED
/*
* The element is already defined in this DTD.
*/
VERROR(ctxt->userData, "Redefinition of element %s\n", name);
+#endif /* LIBXML_VALID_ENABLED */
if (uqname != NULL)
xmlFree(uqname);
if (ns != NULL)
@@ -1205,10 +1211,12 @@ xmlAddElementDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name,
* Insertion must not fail
*/
if (xmlHashAddEntry2(table, name, ns, ret)) {
+#ifdef LIBXML_VALID_ENABLED
/*
* The element is already defined in this DTD.
*/
VERROR(ctxt->userData, "Redefinition of element %s\n", name);
+#endif /* LIBXML_VALID_ENABLED */
xmlFreeElement(ret);
if (uqname != NULL)
xmlFree(uqname);
@@ -1472,6 +1480,7 @@ xmlCreateAttributeTable(void) {
return(xmlHashCreate(0));
}
+#ifdef LIBXML_VALID_ENABLED
/**
* xmlScanAttributeDeclCallback:
* @attr: the attribute decl
@@ -1552,6 +1561,7 @@ xmlScanIDAttributeDecl(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
}
return(ret);
}
+#endif /* LIBXML_VALID_ENABLED */
/**
* xmlFreeAttribute:
@@ -1622,6 +1632,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
return(NULL);
}
+#ifdef LIBXML_VALID_ENABLED
/*
* Check the type and possibly the default value.
*/
@@ -1659,6 +1670,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
defaultValue = NULL;
ctxt->valid = 0;
}
+#endif /* LIBXML_VALID_ENABLED */
/*
* Check first that an attribute defined in the external subset wasn't
@@ -1713,12 +1725,14 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
* Search the DTD for previous declarations of the ATTLIST
*/
if (xmlHashAddEntry3(table, name, ns, elem, ret) < 0) {
+#ifdef LIBXML_VALID_ENABLED
/*
* The attribute is already defined in this DTD.
*/
VWARNING(ctxt->userData,
"Attribute %s of element %s: already defined\n",
name, elem);
+#endif /* LIBXML_VALID_ENABLED */
xmlFreeAttribute(ret);
return(NULL);
}
@@ -1730,6 +1744,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
elemDef = xmlGetDtdElementDesc2(dtd, elem, 1);
if (elemDef != NULL) {
+#ifdef LIBXML_VALID_ENABLED
if ((type == XML_ATTRIBUTE_ID) &&
(xmlScanIDAttributeDecl(NULL, elemDef) != 0)) {
VERROR(ctxt->userData,
@@ -1737,6 +1752,7 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem,
elem, name);
ctxt->valid = 0;
}
+#endif /* LIBXML_VALID_ENABLED */
/*
* Insert namespace default def first they need to be
@@ -2040,8 +2056,10 @@ xmlAddNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDtdPtr dtd,
* Check the DTD for previous declarations of the ATTLIST
*/
if (xmlHashAddEntry(table, name, ret)) {
+#ifdef LIBXML_VALID_ENABLED
xmlGenericError(xmlGenericErrorContext,
"xmlAddNotationDecl: %s already defined\n", name);
+#endif /* LIBXML_VALID_ENABLED */
xmlFreeNotation(ret);
return(NULL);
}
@@ -2246,6 +2264,7 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
ret->lineno = xmlGetLineNo(attr->parent);
if (xmlHashAddEntry(table, value, ret) < 0) {
+#ifdef LIBXML_VALID_ENABLED
/*
* The id is already defined in this DTD.
*/
@@ -2253,6 +2272,7 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
VECTXT(ctxt, attr->parent);
VERROR(ctxt->userData, "ID %s already defined\n", value);
}
+#endif /* LIBXML_VALID_ENABLED */
xmlFreeID(ret);
return(NULL);
}
@@ -2920,6 +2940,7 @@ xmlGetDtdNotationDesc(xmlDtdPtr dtd, const xmlChar *name) {
return(xmlHashLookup(table, name));
}
+#ifdef LIBXML_VALID_ENABLED
/**
* xmlValidateNotationUse:
* @ctxt: the validation context
@@ -2949,6 +2970,7 @@ xmlValidateNotationUse(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
}
return(1);
}
+#endif /* LIBXML_VALID_ENABLED */
/**
* xmlIsMixedElement:
@@ -2988,6 +3010,7 @@ xmlIsMixedElement(xmlDocPtr doc, const xmlChar *name) {
return(1);
}
+#ifdef LIBXML_VALID_ENABLED
/**
* xmlValidateNameValue:
* @value: an Name value
@@ -6295,7 +6318,6 @@ xmlValidateDocument(xmlValidCtxtPtr ctxt, xmlDocPtr doc) {
return(ret);
}
-
/************************************************************************
* *
* Routines for dynamic validation editing *
@@ -6473,3 +6495,5 @@ xmlValidGetValidElements(xmlNode *prev, xmlNode *next, const xmlChar **list,
return(nb_valid_elements);
}
+#endif /* LIBXML_VALID_ENABLED */
+
diff --git a/win32/libxml2.def.src b/win32/libxml2.def.src
index c1a1bd40..3864d9a1 100644
--- a/win32/libxml2.def.src
+++ b/win32/libxml2.def.src
@@ -1597,6 +1597,7 @@ xmlTextReaderNext
xmlTextReaderNodeType
xmlTextReaderNormalization
xmlTextReaderPrefix
+xmlTextReaderPreserve
xmlTextReaderQuoteChar
xmlTextReaderRead
xmlTextReaderReadAttributeValue
diff --git a/xlink.c b/xlink.c
index d7fc6029..4454d173 100644
--- a/xlink.c
+++ b/xlink.c
@@ -11,6 +11,7 @@
#define IN_LIBXML
#include "libxml.h"
+#ifdef LIBXML_XPTR_ENABLED
#include <string.h> /* for memset() only */
#ifdef HAVE_CTYPE_H
#include <ctype.h>
@@ -177,3 +178,4 @@ xlinkIsLink (xmlDocPtr doc, xmlNodePtr node) {
if (role != NULL) xmlFree(role);
return(ret);
}
+#endif /* LIBXML_XPTR_ENABLED */
diff --git a/xmlIO.c b/xmlIO.c
index af8a44e3..7992f18b 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -1794,7 +1794,9 @@ xmlOutputBufferCreateFilename(const char *URI,
void *context = NULL;
char *unescaped;
+#ifdef LIBXML_HTTP_ENABLED
int is_http_uri = 0; /* Can't change if HTTP disabled */
+#endif
if (xmlOutputCallbackInitialized == 0)
xmlRegisterDefaultOutputCallbacks();
diff --git a/xmlcatalog.c b/xmlcatalog.c
index 0e320fe5..44c8e633 100644
--- a/xmlcatalog.c
+++ b/xmlcatalog.c
@@ -29,6 +29,7 @@
#include <libxml/parser.h>
#include <libxml/globals.h>
+#ifdef LIBXML_CATALOG_ENABLED
static int shell = 0;
static int sgml = 0;
static int noout = 0;
@@ -39,7 +40,6 @@ static int convert = 0;
static int verbose = 0;
static char *filename;
-#ifdef LIBXML_CATALOG_ENABLED
#ifndef XML_SGML_DEFAULT_CATALOG
#define XML_SGML_DEFAULT_CATALOG "/etc/sgml/catalog"
diff --git a/xmllint.c b/xmllint.c
index 77d6cd2e..92d55478 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -104,10 +104,12 @@ static int recovery = 0;
static int noent = 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
#ifdef LIBXML_SCHEMAS_ENABLED
static char * relaxng = NULL;
static xmlRelaxNGPtr relaxngschemas = NULL;
@@ -117,7 +119,9 @@ static xmlSchemaPtr wxschemas = NULL;
static int repeat = 0;
static int insert = 0;
static int compress = 0;
+#ifdef LIBXML_HTML_ENABLED
static int html = 0;
+#endif
static int htmlout = 0;
static int push = 0;
#ifdef HAVE_SYS_MMAN_H
@@ -633,9 +637,11 @@ static void streamFile(char *filename) {
reader = xmlNewTextReaderFilename(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);
#ifdef LIBXML_SCHEMAS_ENABLED
if (relaxng != NULL) {
@@ -670,13 +676,16 @@ static void streamFile(char *filename) {
#ifdef LIBXML_SCHEMAS_ENABLED
if ((valid) || (relaxng != NULL))
#else
+#ifdef LIBXML_VALID_ENABLED
if (valid)
-#endif
endTimer("Parsing and validating");
else
+#endif /* LIBXML_VALID_ENABLED */
+#endif
endTimer("Parsing");
}
+#ifdef LIBXML_VALID_ENABLED
if (valid) {
if (xmlTextReaderIsValid(reader) != 1) {
xmlGenericError(xmlGenericErrorContext,
@@ -684,6 +693,7 @@ static void streamFile(char *filename) {
progresult = 3;
}
}
+#endif /* LIBXML_VALID_ENABLED */
#ifdef LIBXML_SCHEMAS_ENABLED
if (relaxng != NULL) {
if (xmlTextReaderIsValid(reader) != 1) {
@@ -866,6 +876,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
munmap((char *) base, info.st_size);
#endif
+#ifdef LIBXML_VALID_ENABLED
} else if (valid) {
xmlParserCtxtPtr ctxt = NULL;
@@ -883,6 +894,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
if (rectxt == NULL)
xmlFreeParserCtxt(ctxt);
}
+#endif /* LIBXML_VALID_ENABLED */
} else {
if (rectxt != NULL)
doc = xmlCtxtReadFile(rectxt, filename, NULL, options);
@@ -945,6 +957,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
xmlFreeDoc(tmp);
}
+#ifdef LIBXML_VALID_ENABLED
if ((insert) && (!html)) {
const xmlChar* list[256];
int nb, i;
@@ -968,7 +981,9 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
}
}
}
- }else if (noout == 0) {
+ }else
+#endif /* LIBXML_VALID_ENABLED */
+ if (noout == 0) {
/*
* print it.
*/
@@ -1048,6 +1063,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
#endif
}
+#ifdef LIBXML_VALID_ENABLED
/*
* A posteriori validation test
*/
@@ -1128,8 +1144,10 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
endTimer("Validating");
}
xmlFreeValidCtxt(cvp);
+ }
+#endif /* LIBXML_VALID_ENABLED */
#ifdef LIBXML_SCHEMAS_ENABLED
- } else if (relaxngschemas != NULL) {
+ if (relaxngschemas != NULL) {
xmlRelaxNGValidCtxtPtr ctxt;
int ret;
@@ -1181,8 +1199,8 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
if ((timing) && (!repeat)) {
endTimer("Validating");
}
-#endif
}
+#endif
#ifdef LIBXML_DEBUG_ENABLED
if ((debugent) && (!html))
@@ -1210,6 +1228,9 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
static void showVersion(const char *name) {
fprintf(stderr, "%s: using libxml version %s\n", name, xmlParserVersion);
fprintf(stderr, " compiled with: ");
+#ifdef LIBXML_VALID_ENABLED
+ fprintf(stderr, "DTDValid ");
+#endif
#ifdef LIBXML_FTP_ENABLED
fprintf(stderr, "FTP ");
#endif
@@ -1273,10 +1294,12 @@ static void usage(const char *name) {
printf("\t--nonet : refuse to fetch DTDs or entities over network\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");
@@ -1415,7 +1438,9 @@ main(int argc, char **argv) {
loaddtd++;
dtdattrs++;
options |= XML_PARSE_DTDATTR;
- } else if ((!strcmp(argv[i], "-valid")) ||
+ }
+#ifdef LIBXML_VALID_ENABLED
+ else if ((!strcmp(argv[i], "-valid")) ||
(!strcmp(argv[i], "--valid"))) {
valid++;
options |= XML_PARSE_DTDVALID;
@@ -1434,6 +1459,7 @@ main(int argc, char **argv) {
dtdvalidfpi = argv[i];
loaddtd++;
}
+#endif /* LIBXML_VALID_ENABLED */
else if ((!strcmp(argv[i], "-dropdtd")) ||
(!strcmp(argv[i], "--dropdtd")))
dropdtd++;
@@ -1596,7 +1622,9 @@ 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");
@@ -1669,6 +1697,7 @@ main(int argc, char **argv) {
i++;
continue;
}
+#ifdef LIBXML_VALID_ENABLED
if ((!strcmp(argv[i], "-dtdvalid")) ||
(!strcmp(argv[i], "--dtdvalid"))) {
i++;
@@ -1679,6 +1708,7 @@ main(int argc, char **argv) {
i++;
continue;
}
+#endif /* LIBXML_VALID_ENABLED */
if ((!strcmp(argv[i], "-relaxng")) ||
(!strcmp(argv[i], "--relaxng"))) {
i++;
diff --git a/xmlmemory.c b/xmlmemory.c
index b4651feb..e20f721f 100644
--- a/xmlmemory.c
+++ b/xmlmemory.c
@@ -29,6 +29,7 @@
#include <ctype.h>
#endif
+
/**
* MEM_LIST:
*
@@ -43,6 +44,9 @@
#include <libxml/globals.h>
#include <libxml/xmlerror.h>
+static int xmlMemInitialized = 0;
+
+#ifdef DEBUG_MEMORY_LOCATION
void xmlMallocBreakpoint(void);
/************************************************************************
@@ -108,7 +112,6 @@ static unsigned long debugMaxMemSize = 0;
static int block=0;
static int xmlMemStopAtBlock = 0;
static void *xmlMemTraceBlockAt = NULL;
-static int xmlMemInitialized = 0;
#ifdef MEM_LIST
static MEMHDR *memlist = NULL;
#endif
@@ -712,6 +715,7 @@ static void debugmem_tag_error(void *p)
static FILE *xmlMemoryDumpFile = NULL;
+#endif /* DEBUG_MEMORY_LOCATION */
/**
* xmlMemoryDump:
@@ -722,6 +726,7 @@ static FILE *xmlMemoryDumpFile = NULL;
void
xmlMemoryDump(void)
{
+#ifdef DEBUG_MEMORY_LOCATION
FILE *dump;
if (debugMaxMemSize == 0)
@@ -734,6 +739,7 @@ xmlMemoryDump(void)
xmlMemDisplay(xmlMemoryDumpFile);
if (dump != NULL) fclose(dump);
+#endif /* DEBUG_MEMORY_LOCATION */
}
@@ -755,14 +761,15 @@ static int xmlInitMemoryDone = 0;
int
xmlInitMemory(void)
{
- int ret;
-
+#ifdef DEBUG_MEMORY_LOCATION
#ifdef HAVE_STDLIB_H
char *breakpoint;
#endif
+#endif
if (xmlInitMemoryDone) return(-1);
+#ifdef DEBUG_MEMORY_LOCATION
#ifdef HAVE_STDLIB_H
breakpoint = getenv("XML_MEM_BREAKPOINT");
if (breakpoint != NULL) {
@@ -775,6 +782,7 @@ xmlInitMemory(void)
sscanf(breakpoint, "%p", &xmlMemTraceBlockAt);
}
#endif
+#endif /* DEBUG_MEMORY_LOCATION */
#ifdef DEBUG_MEMORY
xmlGenericError(xmlGenericErrorContext,
@@ -783,8 +791,7 @@ xmlInitMemory(void)
xmlMemInitialized = 1;
xmlInitMemoryDone = 1;
- ret = 0;
- return(ret);
+ return(0);
}
/**
diff --git a/xpath.c b/xpath.c
index 7946fd67..65ca1800 100644
--- a/xpath.c
+++ b/xpath.c
@@ -52,6 +52,7 @@
#include <libxml/threads.h>
#include <libxml/globals.h>
+#if defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XPATH_ENABLED)
/************************************************************************
* *
* Floating point stuff *
@@ -119,6 +120,8 @@ xmlXPathIsInf(double val) {
return(trio_isinf(val));
}
+#endif /* SCHEMAS or XPATH */
+#ifdef LIBXML_XPATH_ENABLED
/**
* xmlXPathGetSign:
* @val: a double value
@@ -135,7 +138,6 @@ xmlXPathGetSign(double val) {
}
-#ifdef LIBXML_XPATH_ENABLED
/*
* TODO: when compatibility allows remove all "fake node libxslt" strings
* the test should just be name[0] = ' '