diff --git a/ChangeLog b/ChangeLog index 05507ac9..d530e9a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Tue Nov 7 15:11:34 CET 2000 Daniel Veillard + + * nanohttp.[ch]: applied Wayne Davison patches to access + the WWW-Authorization header. + * parser.c: Closed Bug#30847: Problems when switching encoding + in short files by applying Simon Berg's patch. + * valid.c: fixed a validation problem + * hash.c parser.h parserInternals.h testHTML.c testSAX.c tree.h + xmlerror.h xmlmemory.h xmlversion.h.in: applied a DLL patch from + Wayne Davison + * xpointer.[ch]: added first version of xmlXPtrBuildNodeList() + need to be extended to non full nodes selections. + * xinclude.c: starts to work decently + Mon Nov 6 17:22:46 CET 2000 Daniel Veillard * tree.[ch] xinclude.[ch] xmllint.c configure.in valid.c diff --git a/hash.c b/hash.c index 24e524c0..0f4f1048 100644 --- a/hash.c +++ b/hash.c @@ -17,6 +17,12 @@ * Author: bjorn.reese@systematic.dk */ +#ifdef WIN32 +#include "win32config.h" +#else +#include "config.h" +#endif + #include #include #include diff --git a/include/libxml/nanohttp.h b/include/libxml/nanohttp.h index 49f7645c..78d1c44d 100644 --- a/include/libxml/nanohttp.h +++ b/include/libxml/nanohttp.h @@ -29,6 +29,7 @@ void * xmlNanoHTTPMethod (const char *URL, void * xmlNanoHTTPOpen (const char *URL, char **contentType); int xmlNanoHTTPReturnCode (void *ctx); +const char * xmlNanoHTTPAuthHeader(void *ctx); int xmlNanoHTTPRead (void *ctx, void *dest, int len); diff --git a/include/libxml/parser.h b/include/libxml/parser.h index ee4c8087..3d7eb433 100644 --- a/include/libxml/parser.h +++ b/include/libxml/parser.h @@ -294,19 +294,19 @@ typedef xmlParserInputPtr (*xmlExternalEntityLoader)(const char *URL, * Global variables: just the default SAX interface tables and XML * version infos. */ -extern const char *xmlParserVersion; +LIBXML_DLL_IMPORT extern const char *xmlParserVersion; -extern xmlSAXLocator xmlDefaultSAXLocator; -extern xmlSAXHandler xmlDefaultSAXHandler; -extern xmlSAXHandler htmlDefaultSAXHandler; -extern xmlSAXHandler sgmlDefaultSAXHandler; +LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator; +LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler; +LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler; +LIBXML_DLL_IMPORT extern xmlSAXHandler sgmlDefaultSAXHandler; /** * entity substitution default behaviour. */ -extern int xmlSubstituteEntitiesDefaultValue; -extern int xmlGetWarningsDefaultValue; +LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue; +LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue; /** diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h index 7b85b8aa..646738cb 100644 --- a/include/libxml/parserInternals.h +++ b/include/libxml/parserInternals.h @@ -101,13 +101,13 @@ extern "C" { * Global vaiables affecting the default parser behaviour. */ -extern int xmlParserDebugEntities; -extern int xmlGetWarningsDefaultValue; -extern int xmlParserDebugEntities; -extern int xmlSubstituteEntitiesDefaultValue; -extern int xmlDoValidityCheckingDefaultValue; -extern int xmlPedanticParserDefaultValue; -extern int xmlKeepBlanksDefaultValue; +LIBXML_DLL_IMPORT extern int xmlParserDebugEntities; +LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue; +LIBXML_DLL_IMPORT extern int xmlParserDebugEntities; +LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue; +LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue; +LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue; +LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue; /* * Function to finish teh work of the macros where needed diff --git a/include/libxml/tree.h b/include/libxml/tree.h index 2168d4fc..b2838e1e 100644 --- a/include/libxml/tree.h +++ b/include/libxml/tree.h @@ -374,11 +374,11 @@ struct _xmlDoc { /* * Variables. */ -extern xmlNsPtr baseDTD; -extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */ -extern int xmlIndentTreeOutput; /* try to indent the tree dumps */ -extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */ -extern int xmlSaveNoEmptyTags; /* save empty tags as */ +LIBXML_DLL_IMPORT extern xmlNsPtr baseDTD; +LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */ +LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */ +LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */ +LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as */ /* * Handling Buffers. @@ -533,6 +533,10 @@ void xmlTextConcat (xmlNodePtr node, int len); void xmlFreeNodeList (xmlNodePtr cur); void xmlFreeNode (xmlNodePtr cur); +void xmlSetTreeDoc (xmlNodePtr tree, + xmlDocPtr doc); +void xmlSetListDoc (xmlNodePtr list, + xmlDocPtr doc); /* * Namespaces diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h index fa675abe..53c57518 100644 --- a/include/libxml/xmlerror.h +++ b/include/libxml/xmlerror.h @@ -146,8 +146,8 @@ typedef void (*xmlGenericErrorFunc) (void *ctx, const char *msg, ...); * when when there is an error and no parsing or validity context available */ -extern xmlGenericErrorFunc xmlGenericError; -extern void *xmlGenericErrorContext; +LIBXML_DLL_IMPORT extern xmlGenericErrorFunc xmlGenericError; +LIBXML_DLL_IMPORT extern void *xmlGenericErrorContext; /* * Use the following function to reset the two previous global variables. diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in index 4d21762c..86f88553 100644 --- a/include/libxml/xmlversion.h.in +++ b/include/libxml/xmlversion.h.in @@ -111,6 +111,14 @@ extern void xmlCheckVersion(int version); #define DEBUG_MEMORY_LOCATION #endif +#ifndef LIBXML_DLL_IMPORT +#if defined(WIN32) && !defined(STATIC) +#define LIBXML_DLL_IMPORT __declspec(dllimport) +#else +#define LIBXML_DLL_IMPORT +#endif +#endif + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include/libxml/xpointer.h b/include/libxml/xpointer.h index 39216876..f90d9c6e 100644 --- a/include/libxml/xpointer.h +++ b/include/libxml/xpointer.h @@ -48,6 +48,7 @@ xmlXPathObjectPtr xmlXPtrEval (const xmlChar *str, xmlXPathContextPtr ctx); void xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, int nargs); +xmlNodePtr xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); #ifdef __cplusplus } diff --git a/nanohttp.c b/nanohttp.c index a92a9b31..beecbed2 100644 --- a/nanohttp.c +++ b/nanohttp.c @@ -106,6 +106,7 @@ typedef struct xmlNanoHTTPCtxt { int returnValue; /* the protocol return value */ char *contentType; /* the MIME type for the input */ char *location; /* the new URL in case of redirect */ + char *authHeader; /* contents of {WWW,Proxy}-Authenticate header */ } xmlNanoHTTPCtxt, *xmlNanoHTTPCtxtPtr; static int initialized = 0; @@ -390,6 +391,7 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) { if (ctxt->in != NULL) xmlFree(ctxt->in); if (ctxt->contentType != NULL) xmlFree(ctxt->contentType); if (ctxt->location != NULL) xmlFree(ctxt->location); + if (ctxt->authHeader != NULL) xmlFree(ctxt->authHeader); ctxt->state = XML_NANO_HTTP_NONE; if (ctxt->fd >= 0) closesocket(ctxt->fd); ctxt->fd = -1; @@ -607,6 +609,18 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) { if (ctxt->location != NULL) xmlFree(ctxt->location); ctxt->location = xmlMemStrdup(cur); + } else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"WWW-Authenticate:", 17)) { + cur += 17; + while ((*cur == ' ') || (*cur == '\t')) cur++; + if (ctxt->authHeader != NULL) + xmlFree(ctxt->authHeader); + ctxt->authHeader = xmlMemStrdup(cur); + } else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"Proxy-Authenticate:", 19)) { + cur += 19; + while ((*cur == ' ') || (*cur == '\t')) cur++; + if (ctxt->authHeader != NULL) + xmlFree(ctxt->authHeader); + ctxt->authHeader = xmlMemStrdup(cur); } } @@ -1105,6 +1119,22 @@ xmlNanoHTTPReturnCode(void *ctx) { return(ctxt->returnValue); } +/** + * xmlNanoHTTPAuthHeader: + * @ctx: the HTTP context + * + * Returns the stashed value of the WWW-Authenticate or Proxy-Authenticate + * header. + */ +const char * +xmlNanoHTTPAuthHeader(void *ctx) { + xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr) ctx; + + if (ctxt == NULL) return(NULL); + + return(ctxt->authHeader); +} + #ifdef STANDALONE int main(int argc, char **argv) { char *contentType = NULL; diff --git a/nanohttp.h b/nanohttp.h index 49f7645c..78d1c44d 100644 --- a/nanohttp.h +++ b/nanohttp.h @@ -29,6 +29,7 @@ void * xmlNanoHTTPMethod (const char *URL, void * xmlNanoHTTPOpen (const char *URL, char **contentType); int xmlNanoHTTPReturnCode (void *ctx); +const char * xmlNanoHTTPAuthHeader(void *ctx); int xmlNanoHTTPRead (void *ctx, void *dest, int len); diff --git a/parser.c b/parser.c index ea8170fa..054f6308 100644 --- a/parser.c +++ b/parser.c @@ -8171,6 +8171,15 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size, if ((terminate) || (ctxt->input->buf->buffer->use > 80)) xmlParseTryOrFinish(ctxt, terminate); } else if (ctxt->instate != XML_PARSER_EOF) + if ((ctxt->input != NULL) && ctxt->input->buf != NULL) { + xmlParserInputBufferPtr in = ctxt->input->buf; + int nbchars = xmlCharEncInFunc(in->encoder, in->buffer, in->raw); + if (nbchars < 0) { + xmlGenericError(xmlGenericErrorContext, + "xmlParseChunk: encoder error\n"); + return(XML_ERR_INVALID_ENCODING); + } + } xmlParseTryOrFinish(ctxt, terminate); if (terminate) { /* diff --git a/parser.h b/parser.h index ee4c8087..3d7eb433 100644 --- a/parser.h +++ b/parser.h @@ -294,19 +294,19 @@ typedef xmlParserInputPtr (*xmlExternalEntityLoader)(const char *URL, * Global variables: just the default SAX interface tables and XML * version infos. */ -extern const char *xmlParserVersion; +LIBXML_DLL_IMPORT extern const char *xmlParserVersion; -extern xmlSAXLocator xmlDefaultSAXLocator; -extern xmlSAXHandler xmlDefaultSAXHandler; -extern xmlSAXHandler htmlDefaultSAXHandler; -extern xmlSAXHandler sgmlDefaultSAXHandler; +LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator; +LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler; +LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler; +LIBXML_DLL_IMPORT extern xmlSAXHandler sgmlDefaultSAXHandler; /** * entity substitution default behaviour. */ -extern int xmlSubstituteEntitiesDefaultValue; -extern int xmlGetWarningsDefaultValue; +LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue; +LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue; /** diff --git a/parserInternals.h b/parserInternals.h index 7b85b8aa..646738cb 100644 --- a/parserInternals.h +++ b/parserInternals.h @@ -101,13 +101,13 @@ extern "C" { * Global vaiables affecting the default parser behaviour. */ -extern int xmlParserDebugEntities; -extern int xmlGetWarningsDefaultValue; -extern int xmlParserDebugEntities; -extern int xmlSubstituteEntitiesDefaultValue; -extern int xmlDoValidityCheckingDefaultValue; -extern int xmlPedanticParserDefaultValue; -extern int xmlKeepBlanksDefaultValue; +LIBXML_DLL_IMPORT extern int xmlParserDebugEntities; +LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue; +LIBXML_DLL_IMPORT extern int xmlParserDebugEntities; +LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue; +LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue; +LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue; +LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue; /* * Function to finish teh work of the macros where needed diff --git a/testHTML.c b/testHTML.c index 6a2a896b..63ba2375 100644 --- a/testHTML.c +++ b/testHTML.c @@ -8,6 +8,7 @@ #ifdef WIN32 #include "win32config.h" +#undef LIBXML_DLL_IMPORT #else #include "config.h" #endif diff --git a/testSAX.c b/testSAX.c index b74061db..ff96e4bd 100644 --- a/testSAX.c +++ b/testSAX.c @@ -8,6 +8,7 @@ #ifdef WIN32 #include "win32config.h" +#undef LIBXML_DLL_IMPORT #else #include "config.h" #endif diff --git a/tree.h b/tree.h index 2168d4fc..b2838e1e 100644 --- a/tree.h +++ b/tree.h @@ -374,11 +374,11 @@ struct _xmlDoc { /* * Variables. */ -extern xmlNsPtr baseDTD; -extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */ -extern int xmlIndentTreeOutput; /* try to indent the tree dumps */ -extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */ -extern int xmlSaveNoEmptyTags; /* save empty tags as */ +LIBXML_DLL_IMPORT extern xmlNsPtr baseDTD; +LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */ +LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */ +LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */ +LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as */ /* * Handling Buffers. @@ -533,6 +533,10 @@ void xmlTextConcat (xmlNodePtr node, int len); void xmlFreeNodeList (xmlNodePtr cur); void xmlFreeNode (xmlNodePtr cur); +void xmlSetTreeDoc (xmlNodePtr tree, + xmlDocPtr doc); +void xmlSetListDoc (xmlNodePtr list, + xmlDocPtr doc); /* * Namespaces diff --git a/valid.c b/valid.c index 7e6e12ac..438c84d8 100644 --- a/valid.c +++ b/valid.c @@ -3503,10 +3503,12 @@ child_ok: VERROR(ctxt->userData, "Element %s doesn't carry attribute %s\n", elem->name, attr->name); + ret = 0; } else { VERROR(ctxt->userData, "Element %s doesn't carry attribute %s:%s\n", elem->name, attr->prefix,attr->name); + ret = 0; } } else if (qualified == 0) { VWARNING(ctxt->userData, diff --git a/xinclude.c b/xinclude.c index 3a3bf67d..a5510f7c 100644 --- a/xinclude.c +++ b/xinclude.c @@ -256,12 +256,31 @@ xmlXIncludeNewContext(xmlDocPtr doc) { */ void xmlXIncludeFreeContext(xmlXIncludeCtxtPtr ctxt) { + int i; + if (ctxt == NULL) return; + for (i = 0;i < ctxt->docNr;i++) { + xmlFreeDoc(ctxt->docTab[i]); + if (ctxt->urlTab[i] != NULL) + xmlFree(ctxt->urlTab[i]); + } + for (i = 0;i < ctxt->txtNr;i++) { + if (ctxt->txturlTab[i] != NULL) + xmlFree(ctxt->txturlTab[i]); + } if (ctxt->incTab != NULL) xmlFree(ctxt->incTab); if (ctxt->repTab != NULL) xmlFree(ctxt->repTab); + if (ctxt->urlTab != NULL) + xmlFree(ctxt->urlTab); + if (ctxt->docTab != NULL) + xmlFree(ctxt->docTab); + if (ctxt->txtTab != NULL) + xmlFree(ctxt->txtTab); + if (ctxt->txturlTab != NULL) + xmlFree(ctxt->txturlTab); memset(ctxt, 0xeb, sizeof(xmlXIncludeCtxt)); xmlFree(ctxt); } @@ -285,6 +304,7 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) { xmlDocPtr doc; xmlURIPtr uri; xmlChar *URL; + xmlChar *fragment = NULL; int i; /* * Check the URL and remove any fragment identifier @@ -296,14 +316,16 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) { return; } if (uri->fragment != NULL) { - xmlFree(uri->fragment); - uri->fragment = NULL; /* TODO: kkep it for later processing */ + fragment = (xmlChar *) uri->fragment; + uri->fragment = NULL; } URL = xmlSaveUri(uri); xmlFreeURI(uri); if (URL == NULL) { xmlGenericError(xmlGenericErrorContext, "XInclude: invalid value URI %s\n", url); + if (fragment != NULL) + xmlFree(fragment); return; } @@ -311,9 +333,9 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) { * Handling of references to the local document are done * directly through ctxt->doc. */ - if (URL[0] == 0) { - xmlFree(URL); - return; + if ((URL[0] == 0) || (URL[0] == '#')) { + doc = NULL; + goto loaded; } /* @@ -333,15 +355,56 @@ xmlXIncludeLoadDoc(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) { xmlGenericError(xmlGenericErrorContext, "XInclude: could not load %s\n", URL); xmlFree(URL); + if (fragment != NULL) + xmlFree(fragment); return; } xmlXIncludeAddDoc(ctxt, doc, URL); loaded: - /* - * Add the top children list as the replacement copy. - */ - ctxt->repTab[nr] = xmlCopyNodeList(doc->children); + if (fragment == NULL) { + /* + * Add the top children list as the replacement copy. + * ISSUE: seems we should scrap DTD info from the copied list. + */ + if (doc == NULL) + ctxt->repTab[nr] = xmlCopyNodeList(ctxt->doc->children); + else + ctxt->repTab[nr] = xmlCopyNodeList(doc->children); + } else { + /* + * Computes the XPointer expression and make a copy used + * as the replacement copy. + */ + xmlXPathObjectPtr xptr; + xmlXPathContextPtr xptrctxt; + + if (doc == NULL) { + xptrctxt = xmlXPtrNewContext(ctxt->doc, ctxt->incTab[nr], NULL); + } else { + xptrctxt = xmlXPtrNewContext(doc, NULL, NULL); + } + if (xptrctxt == NULL) { + xmlGenericError(xmlGenericErrorContext, + "XInclude: could create XPointer context\n"); + xmlFree(URL); + xmlFree(fragment); + return; + } + xptr = xmlXPtrEval(fragment, xptrctxt); + if (xptr == NULL) { + xmlGenericError(xmlGenericErrorContext, + "XInclude: XPointer evaluation failed: #%s\n", + fragment); + xmlFree(URL); + xmlFree(fragment); + return; + } + ctxt->repTab[nr] = xmlXPtrBuildNodeList(xptr); + xmlXPathFreeObject(xptr); + xmlXPathFreeContext(xptrctxt); + xmlFree(fragment); + } xmlFree(URL); } @@ -370,9 +433,10 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) { return; } if (uri->fragment != NULL) { - xmlFreeURI(uri); xmlGenericError(xmlGenericErrorContext, - "XInclude: fragment identifier forbidden for text\n"); + "XInclude: fragment identifier forbidden for text: %s\n", + uri->fragment); + xmlFreeURI(uri); return; } URL = xmlSaveUri(uri); diff --git a/xmlerror.h b/xmlerror.h index fa675abe..53c57518 100644 --- a/xmlerror.h +++ b/xmlerror.h @@ -146,8 +146,8 @@ typedef void (*xmlGenericErrorFunc) (void *ctx, const char *msg, ...); * when when there is an error and no parsing or validity context available */ -extern xmlGenericErrorFunc xmlGenericError; -extern void *xmlGenericErrorContext; +LIBXML_DLL_IMPORT extern xmlGenericErrorFunc xmlGenericError; +LIBXML_DLL_IMPORT extern void *xmlGenericErrorContext; /* * Use the following function to reset the two previous global variables. diff --git a/xmlversion.h.in b/xmlversion.h.in index 4d21762c..86f88553 100644 --- a/xmlversion.h.in +++ b/xmlversion.h.in @@ -111,6 +111,14 @@ extern void xmlCheckVersion(int version); #define DEBUG_MEMORY_LOCATION #endif +#ifndef LIBXML_DLL_IMPORT +#if defined(WIN32) && !defined(STATIC) +#define LIBXML_DLL_IMPORT __declspec(dllimport) +#else +#define LIBXML_DLL_IMPORT +#endif +#endif + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/xpointer.c b/xpointer.c index 08d00b92..7eaf49f6 100644 --- a/xpointer.c +++ b/xpointer.c @@ -21,7 +21,6 @@ * TODO: Access into entities references are not supported now ... * need a start to be able to pop out of entities refs since * parent is the endity declaration, not the ref. - * TODO: some functions are still missing ! */ #include @@ -1302,6 +1301,45 @@ xmlXPtrEval(const xmlChar *str, xmlXPathContextPtr ctx) { return(res); } +/** + * xmlXPtrBuildNodeList: + * @obj: the XPointer result from the evaluation. + * + * Build a node list copy of the XPointer result. + * + * Returns an xmlNodePtr list or NULL. + * the caller has to free the node list. + */ +xmlNodePtr +xmlXPtrBuildNodeList(xmlXPathObjectPtr obj) { + xmlNodePtr list = NULL, last = NULL; + int i; + + if (obj == NULL) + return(NULL); + switch (obj->type) { + case XPATH_NODESET: { + xmlNodeSetPtr set = obj->nodesetval; + if (set == NULL) + return(NULL); + for (i = 0;i < set->nodeNr;i++) { + if (last == NULL) + list = last = xmlCopyNode(set->nodeTab[i], 1); + else { + xmlAddNextSibling(last, xmlCopyNode(set->nodeTab[i], 1)); + if (last->next != NULL) + last = last->next; + } + } + break; + } + case XPATH_LOCATIONSET: + break; + default: + break; + } + return(list); +} /************************************************************************ * * diff --git a/xpointer.h b/xpointer.h index 39216876..f90d9c6e 100644 --- a/xpointer.h +++ b/xpointer.h @@ -48,6 +48,7 @@ xmlXPathObjectPtr xmlXPtrEval (const xmlChar *str, xmlXPathContextPtr ctx); void xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, int nargs); +xmlNodePtr xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); #ifdef __cplusplus }