1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-24 21:33:51 +03:00

- include/libxml/globals.h include/libxml/threads.h threads.c

testThreads.c: far more testing, cleaning up bugs
- *.c : make sure globals.h is always included.
Daniel
This commit is contained in:
Daniel Veillard 2001-10-17 15:58:35 +00:00
parent 7cc95c0b6a
commit 3c01b1d81b
33 changed files with 145 additions and 40 deletions

View File

@ -1,3 +1,9 @@
Wed Oct 17 11:56:25 EDT 2001 Daniel Veillard <daniel@veillard.com>
* include/libxml/globals.h include/libxml/threads.h threads.c
testThreads.c: far more testing, cleaning up bugs
* *.c : make sure globals.h is always included.
Wed Oct 17 17:41:41 CEST 2001 Daniel Veillard <daniel@veillard.com> Wed Oct 17 17:41:41 CEST 2001 Daniel Veillard <daniel@veillard.com>
* HTMLparser.c: try to get rid of parser loops for good. * HTMLparser.c: try to get rid of parser loops for good.

View File

@ -45,6 +45,7 @@
#include <libxml/valid.h> #include <libxml/valid.h>
#include <libxml/xmlIO.h> #include <libxml/xmlIO.h>
#include <libxml/uri.h> #include <libxml/uri.h>
#include <libxml/globals.h>
/* /*
* Internal description of an SGML entity * Internal description of an SGML entity

View File

@ -40,6 +40,7 @@
#include <libxml/encoding.h> #include <libxml/encoding.h>
#include <libxml/valid.h> #include <libxml/valid.h>
#include <libxml/xmlIO.h> #include <libxml/xmlIO.h>
#include <libxml/globals.h>
#define HTML_MAX_NAMELEN 1000 #define HTML_MAX_NAMELEN 1000
#define HTML_PARSER_BIG_BUFFER_SIZE 1000 #define HTML_PARSER_BIG_BUFFER_SIZE 1000

View File

@ -24,6 +24,7 @@
#include <libxml/valid.h> #include <libxml/valid.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/parserInternals.h> #include <libxml/parserInternals.h>
#include <libxml/globals.h>
/************************************************************************ /************************************************************************
* * * *

5
SAX.c
View File

@ -23,6 +23,7 @@
#include <libxml/uri.h> #include <libxml/uri.h>
#include <libxml/valid.h> #include <libxml/valid.h>
#include <libxml/HTMLtree.h> #include <libxml/HTMLtree.h>
#include <libxml/globals.h>
/* #define DEBUG_SAX */ /* #define DEBUG_SAX */
/* #define DEBUG_SAX_TREE */ /* #define DEBUG_SAX_TREE */
@ -1713,7 +1714,7 @@ initxmlDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
void void
xmlDefaultSAXHandlerInit(void) xmlDefaultSAXHandlerInit(void)
{ {
initxmlDefaultSAXHandler(&xmlDefaultSAXHandler, xmlGetWarningsDefaultValue); initxmlDefaultSAXHandler(&xmlDefaultSAXHandler, xmlGetWarningsDefaultValue);
} }
#ifdef LIBXML_HTML_ENABLED #ifdef LIBXML_HTML_ENABLED
@ -1820,7 +1821,7 @@ initdocbDefaultSAXHandler(xmlSAXHandler *hdlr)
void void
docbDefaultSAXHandlerInit(void) docbDefaultSAXHandlerInit(void)
{ {
initdocbDefaultSAXHandler(&docbDefaultSAXHandler); initdocbDefaultSAXHandler(&docbDefaultSAXHandler);
} }
#endif /* LIBXML_DOCB_ENABLED */ #endif /* LIBXML_DOCB_ENABLED */

View File

@ -38,6 +38,7 @@
#include <libxml/catalog.h> #include <libxml/catalog.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/threads.h> #include <libxml/threads.h>
#include <libxml/globals.h>
#define MAX_DELEGATE 50 #define MAX_DELEGATE 50
@ -1217,7 +1218,7 @@ xmlParseXMLCatalogFile(xmlCatalogPrefer prefer, const xmlChar *filename) {
if (xmlDebugCatalogs) if (xmlDebugCatalogs)
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"Parsing catalog %s\n", filename); "%d Parsing catalog %s\n", xmlGetThreadId(), filename);
cur = xmlDocGetRootElement(doc); cur = xmlDocGetRootElement(doc);
if ((cur != NULL) && (xmlStrEqual(cur->name, BAD_CAST "catalog")) && if ((cur != NULL) && (xmlStrEqual(cur->name, BAD_CAST "catalog")) &&

View File

@ -26,6 +26,7 @@
#include <libxml/HTMLtree.h> #include <libxml/HTMLtree.h>
#include <libxml/HTMLparser.h> #include <libxml/HTMLparser.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/globals.h>
/** /**
* xmlDebugDumpString: * xmlDebugDumpString:

View File

@ -17,6 +17,7 @@
#include <libxml/entities.h> #include <libxml/entities.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/globals.h>
/* /*
* The XML predefined entities. * The XML predefined entities.

View File

@ -12,6 +12,7 @@
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/globals.h>
#define XML_GET_VAR_STR(msg, str) { \ #define XML_GET_VAR_STR(msg, str) { \
int size; \ int size; \

View File

@ -18,19 +18,17 @@
#endif #endif
#include <string.h> #include <string.h>
#include <libxml/xmlversion.h>
#include <libxml/globals.h>
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
/* #define DEBUG_GLOBALS */
/* /*
* Helpful Macro * Helpful Macro
*/ */
#ifdef WITH_PTHREAD_H #ifdef LIBXML_THREAD_ENABLED
#if defined(SOLARIS) #define IS_MAIN_THREAD (xmlIsMainThread())
#define THR_MAIN(tid) (-1 == thr_main() || tid == thr_main())
#else
#define THR_MAIN(tid) (tid == 0 || tid == 1024)
#endif
#define IS_MAIN_THREAD (THR_MAIN(pthread_self()))
#else #else
#define IS_MAIN_THREAD 1 #define IS_MAIN_THREAD 1
#endif #endif
@ -41,8 +39,6 @@
* * * *
************************************************************************/ ************************************************************************/
const char *xmlParserVersion = LIBXML_VERSION_STRING;
/* /*
* Memory allocation routines * Memory allocation routines
*/ */
@ -93,6 +89,8 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) strdup;
#undef xmlMemStrdup #undef xmlMemStrdup
#undef xmlRealloc #undef xmlRealloc
const char *xmlParserVersion = LIBXML_VERSION_STRING;
/* /*
* Buffers stuff * Buffers stuff
*/ */
@ -252,11 +250,19 @@ xmlSAXHandler docbDefaultSAXHandler = {
void void
xmlInitializeGlobalState(xmlGlobalStatePtr gs) xmlInitializeGlobalState(xmlGlobalStatePtr gs)
{ {
#ifdef DEBUG_GLOBALS
fprintf(stderr, "Initializing globals at %lu for thread %d\n",
(unsigned long) gs, xmlGetThreadId());
#endif
/* /*
* Perform initialisation as required by libxml * Perform initialisation as required by libxml
*/ */
initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler); initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler); inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
initGenericErrorDefaultFunc(&gs->xmlGenericError);
gs->oldXMLWDcompatibility = 0; gs->oldXMLWDcompatibility = 0;
gs->xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT; gs->xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
gs->xmlDefaultBufferSize = BASE_BUFFER_SIZE; gs->xmlDefaultBufferSize = BASE_BUFFER_SIZE;
@ -277,7 +283,6 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlRealloc = (xmlReallocFunc) realloc; gs->xmlRealloc = (xmlReallocFunc) realloc;
gs->xmlMemStrdup = (xmlStrdupFunc) strdup; gs->xmlMemStrdup = (xmlStrdupFunc) strdup;
#endif #endif
initGenericErrorDefaultFunc(&gs->xmlGenericError);
gs->xmlGenericErrorContext = NULL; gs->xmlGenericErrorContext = NULL;
gs->xmlGetWarningsDefaultValue = 1; gs->xmlGetWarningsDefaultValue = 1;
gs->xmlIndentTreeOutput = 0; gs->xmlIndentTreeOutput = 0;

1
hash.c
View File

@ -24,6 +24,7 @@
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/globals.h>
#define MAX_HASH_LEN 8 #define MAX_HASH_LEN 8

View File

@ -57,6 +57,11 @@ struct _xmlGlobalState
{ {
const char *xmlParserVersion; const char *xmlParserVersion;
xmlSAXLocator xmlDefaultSAXLocator;
xmlSAXHandler xmlDefaultSAXHandler;
xmlSAXHandler docbDefaultSAXHandler;
xmlSAXHandler htmlDefaultSAXHandler;
xmlFreeFunc xmlFree; xmlFreeFunc xmlFree;
xmlMallocFunc xmlMalloc; xmlMallocFunc xmlMalloc;
xmlStrdupFunc xmlMemStrdup; xmlStrdupFunc xmlMemStrdup;
@ -65,11 +70,6 @@ struct _xmlGlobalState
xmlGenericErrorFunc xmlGenericError; xmlGenericErrorFunc xmlGenericError;
void *xmlGenericErrorContext; void *xmlGenericErrorContext;
xmlSAXLocator xmlDefaultSAXLocator;
xmlSAXHandler xmlDefaultSAXHandler;
xmlSAXHandler docbDefaultSAXHandler;
xmlSAXHandler htmlDefaultSAXHandler;
int oldXMLWDcompatibility; int oldXMLWDcompatibility;
xmlBufferAllocationScheme xmlBufferAllocScheme; xmlBufferAllocationScheme xmlBufferAllocScheme;

View File

@ -43,6 +43,8 @@ void xmlFreeRMutex (xmlRMutexPtr tok);
void xmlInitThreads (void); void xmlInitThreads (void);
void xmlLockLibrary (void); void xmlLockLibrary (void);
void xmlUnlockLibrary(void); void xmlUnlockLibrary(void);
int xmlGetThreadId (void);
int xmlIsMainThread (void);
void xmlCleanupThreads(void); void xmlCleanupThreads(void);
xmlGlobalStatePtr xmlGetGlobalState(void); xmlGlobalStatePtr xmlGetGlobalState(void);

1
list.c
View File

@ -21,6 +21,7 @@
#include <string.h> #include <string.h>
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/list.h> #include <libxml/list.h>
#include <libxml/globals.h>
/* /*
* Type definition are kept internal * Type definition are kept internal

View File

@ -59,6 +59,7 @@
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/nanoftp.h> #include <libxml/nanoftp.h>
#include <libxml/globals.h>
/* #define DEBUG_FTP 1 */ /* #define DEBUG_FTP 1 */
#ifdef STANDALONE #ifdef STANDALONE

View File

@ -68,6 +68,7 @@
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/parser.h> /* for xmlStr(n)casecmp() */ #include <libxml/parser.h> /* for xmlStr(n)casecmp() */
#include <libxml/nanohttp.h> #include <libxml/nanohttp.h>
#include <libxml/globals.h>
/** /**
* A couple portability macros * A couple portability macros

View File

@ -10186,7 +10186,8 @@ static int xmlParserInitialized = 0;
void void
xmlInitParser(void) { xmlInitParser(void) {
if (xmlParserInitialized) return; if (xmlParserInitialized != 0)
return;
initGenericErrorDefaultFunc(NULL); initGenericErrorDefaultFunc(NULL);
xmlInitThreads(); xmlInitThreads();

View File

@ -50,6 +50,7 @@
#ifdef LIBXML_CATALOG_ENABLED #ifdef LIBXML_CATALOG_ENABLED
#include <libxml/catalog.h> #include <libxml/catalog.h>
#endif #endif
#include <libxml/globals.h>
void xmlUpgradeOldNs(xmlDocPtr doc); void xmlUpgradeOldNs(xmlDocPtr doc);
@ -2234,7 +2235,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
ctxt->space = &ctxt->spaceTab[0]; ctxt->space = &ctxt->spaceTab[0];
ctxt->sax = sax; ctxt->sax = sax;
memcpy(sax, &xmlDefaultSAXHandler, sizeof(xmlSAXHandler)); initxmlDefaultSAXHandler(sax, xmlGetWarningsDefaultValue);
ctxt->userData = ctxt; ctxt->userData = ctxt;
ctxt->myDoc = NULL; ctxt->myDoc = NULL;

View File

@ -35,6 +35,7 @@
#include <libxml/DOCBparser.h> #include <libxml/DOCBparser.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include <libxml/debugXML.h> #include <libxml/debugXML.h>
#include <libxml/globals.h>
#ifdef LIBXML_DEBUG_ENABLED #ifdef LIBXML_DEBUG_ENABLED
static int debug = 0; static int debug = 0;

View File

@ -35,6 +35,7 @@
#include <libxml/HTMLtree.h> #include <libxml/HTMLtree.h>
#include <libxml/debugXML.h> #include <libxml/debugXML.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/globals.h>
#ifdef LIBXML_DEBUG_ENABLED #ifdef LIBXML_DEBUG_ENABLED
static int debug = 0; static int debug = 0;

View File

@ -1,4 +1,5 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <features.h> #include <features.h>
#include <libxml/xmlversion.h> #include <libxml/xmlversion.h>
@ -26,13 +27,24 @@ static const char *testfiles[] = {
"test/threads/invalid.xml", "test/threads/invalid.xml",
}; };
const char *Okay = "OK";
const char *Failed = "Failed";
#ifndef xmlDoValidityCheckingDefaultValue
#error xmlDoValidityCheckingDefaultValue is not a macro
#endif
#ifndef xmlGenericErrorContext
#error xmlGenericErrorContext is not a macro
#endif
static void * static void *
thread_specific_data(void *private_data) thread_specific_data(void *private_data)
{ {
xmlDocPtr myDoc; xmlDocPtr myDoc;
const char *filename = (const char *) private_data; const char *filename = (const char *) private_data;
int okay = 1;
if (!strcmp(filename, "test/thread/invalid.xml") == 0) { if (!strcmp(filename, "test/threads/invalid.xml")) {
xmlDoValidityCheckingDefaultValue = 0; xmlDoValidityCheckingDefaultValue = 0;
xmlGenericErrorContext = stdout; xmlGenericErrorContext = stdout;
} else { } else {
@ -42,36 +54,72 @@ thread_specific_data(void *private_data)
myDoc = xmlParseFile(filename); myDoc = xmlParseFile(filename);
if (myDoc) { if (myDoc) {
xmlFreeDoc(myDoc); xmlFreeDoc(myDoc);
} else
printf("parse failed\n");
if (!strcmp(filename, "test/thread/invalid.xml") == 0) {
if (xmlDoValidityCheckingDefaultValue != 0)
printf("ValidityCheckingDefaultValue override failed\n");
if (xmlGenericErrorContext != stdout)
printf("ValidityCheckingDefaultValue override failed\n");
} else { } else {
if (xmlDoValidityCheckingDefaultValue != 1) printf("parse failed\n");
printf("ValidityCheckingDefaultValue override failed\n"); okay = 0;
if (xmlGenericErrorContext != stderr)
printf("ValidityCheckingDefaultValue override failed\n");
} }
return (NULL); if (!strcmp(filename, "test/threads/invalid.xml")) {
if (xmlDoValidityCheckingDefaultValue != 0) {
printf("ValidityCheckingDefaultValue override failed\n");
okay = 0;
}
if (xmlGenericErrorContext != stdout) {
printf("xmlGenericErrorContext override failed\n");
okay = 0;
}
} else {
if (xmlDoValidityCheckingDefaultValue != 1) {
printf("ValidityCheckingDefaultValue override failed\n");
okay = 0;
}
if (xmlGenericErrorContext != stderr) {
printf("xmlGenericErrorContext override failed\n");
okay = 0;
}
}
if (okay == 0)
return((void *) Failed);
return ((void *) Okay);
} }
int int
main() main()
{ {
unsigned int i; unsigned int i, repeat;
unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]); unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]);
void *results[MAX_ARGC];
int ret;
xmlInitParser(); xmlInitParser();
xmlLoadCatalog(catalog); for (repeat = 0;repeat < 10000;repeat++) {
xmlLoadCatalog(catalog);
for (i = 0; i < num_threads; i++) for (i = 0; i < num_threads; i++) {
pthread_create(&tid[i], 0, thread_specific_data, (void *) testfiles[i]); results[i] = NULL;
for (i = 0; i < num_threads; i++) tid[i] = -1;
pthread_join(tid[i], NULL); }
for (i = 0; i < num_threads; i++) {
ret = pthread_create(&tid[i], 0, thread_specific_data,
(void *) testfiles[i]);
if (ret != 0) {
perror("pthread_create");
exit(1);
}
}
for (i = 0; i < num_threads; i++) {
ret = pthread_join(tid[i], &results[i]);
if (ret != 0) {
perror("pthread_join");
exit(1);
}
}
xmlCatalogCleanup();
for (i = 0; i < num_threads; i++)
if (results[i] != (void *) Okay)
printf("Thread %d handling %s failed\n", i, testfiles[i]);
}
xmlCleanupParser(); xmlCleanupParser();
xmlMemoryDump(); xmlMemoryDump();
return (0); return (0);

View File

@ -14,6 +14,7 @@
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/uri.h> #include <libxml/uri.h>
#include <libxml/globals.h>
int main(int argc, char **argv) { int main(int argc, char **argv) {
int i, ret, arg = 1; int i, ret, arg = 1;

View File

@ -36,6 +36,7 @@
#include <libxml/parserInternals.h> #include <libxml/parserInternals.h>
#include <libxml/xpathInternals.h> #include <libxml/xpathInternals.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/globals.h>
#if defined(LIBXML_XPTR_ENABLED) #if defined(LIBXML_XPTR_ENABLED)
#include <libxml/xpointer.h> #include <libxml/xpointer.h>
static int xptr = 0; static int xptr = 0;

View File

@ -331,6 +331,23 @@ xmlGetGlobalState(void)
* * * *
************************************************************************/ ************************************************************************/
/**
* xmlGetThreadId:
*
* xmlGetThreadId() find the current thread ID number
*
* Returns the current thread ID number
*/
int
xmlGetThreadId(void)
{
#ifdef HAVE_PTHREAD_H
return((int) pthread_self());
#else
return((int) 0);
#endif
}
/** /**
* xmlIsMainThread: * xmlIsMainThread:
* *

1
tree.c
View File

@ -33,6 +33,7 @@
#include <libxml/valid.h> #include <libxml/valid.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/parserInternals.h> #include <libxml/parserInternals.h>
#include <libxml/globals.h>
xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns); xmlNsPtr xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);

View File

@ -22,6 +22,7 @@
#include <libxml/parserInternals.h> #include <libxml/parserInternals.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/list.h> #include <libxml/list.h>
#include <libxml/globals.h>
/* #define DEBUG_VALID_ALGO */ /* #define DEBUG_VALID_ALGO */

View File

@ -24,6 +24,7 @@
#include <libxml/xpointer.h> #include <libxml/xpointer.h>
#include <libxml/parserInternals.h> #include <libxml/parserInternals.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/globals.h>
#ifdef LIBXML_XINCLUDE_ENABLED #ifdef LIBXML_XINCLUDE_ENABLED
#include <libxml/xinclude.h> #include <libxml/xinclude.h>

View File

@ -35,6 +35,7 @@
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/valid.h> #include <libxml/valid.h>
#include <libxml/xlink.h> #include <libxml/xlink.h>
#include <libxml/globals.h>
#define XLINK_NAMESPACE (BAD_CAST "http://www.w3.org/1999/xlink/namespace/") #define XLINK_NAMESPACE (BAD_CAST "http://www.w3.org/1999/xlink/namespace/")
#define XHTML_NAMESPACE (BAD_CAST "http://www.w3.org/1999/xhtml/") #define XHTML_NAMESPACE (BAD_CAST "http://www.w3.org/1999/xhtml/")

View File

@ -73,6 +73,7 @@
#ifdef LIBXML_CATALOG_ENABLED #ifdef LIBXML_CATALOG_ENABLED
#include <libxml/catalog.h> #include <libxml/catalog.h>
#endif #endif
#include <libxml/globals.h>
#ifdef VMS #ifdef VMS
#define xmlRegisterDefaultInputCallbacks xmlRegisterDefInputCallbacks #define xmlRegisterDefaultInputCallbacks xmlRegisterDefInputCallbacks

View File

@ -27,6 +27,7 @@
#include <libxml/uri.h> #include <libxml/uri.h>
#include <libxml/catalog.h> #include <libxml/catalog.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/globals.h>
static int shell = 0; static int shell = 0;
static int sgml = 0; static int sgml = 0;

View File

@ -68,6 +68,7 @@
#ifdef LIBXML_CATALOG_ENABLED #ifdef LIBXML_CATALOG_ENABLED
#include <libxml/catalog.h> #include <libxml/catalog.h>
#endif #endif
#include <libxml/globals.h>
#ifdef LIBXML_DEBUG_ENABLED #ifdef LIBXML_DEBUG_ENABLED
static int debug = 0; static int debug = 0;

View File

@ -52,6 +52,7 @@
#endif #endif
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/threads.h> #include <libxml/threads.h>
#include <libxml/globals.h>
/* #define DEBUG */ /* #define DEBUG */
/* #define DEBUG_STEP */ /* #define DEBUG_STEP */

View File

@ -27,6 +27,7 @@
#include <libxml/xpath.h> #include <libxml/xpath.h>
#include <libxml/xpathInternals.h> #include <libxml/xpathInternals.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/globals.h>
#ifdef LIBXML_XPTR_ENABLED #ifdef LIBXML_XPTR_ENABLED