diff options
| author | Daniel Veillard <veillard@src.gnome.org> | 2000-11-07 14:21:01 +0000 |
|---|---|---|
| committer | Daniel Veillard <veillard@src.gnome.org> | 2000-11-07 14:21:01 +0000 |
| commit | c2def84b484f6706c2ad7d076a2f3e1c56f76b9f (patch) | |
| tree | 4608b7a47d45df49150e105c23f44fcd9b20728a /xpointer.c | |
| parent | 9e8bfae59a087a938a810a5527023b1e7b0e15b3 (diff) | |
| download | android_external_libxml2-c2def84b484f6706c2ad7d076a2f3e1c56f76b9f.tar.gz android_external_libxml2-c2def84b484f6706c2ad7d076a2f3e1c56f76b9f.tar.bz2 android_external_libxml2-c2def84b484f6706c2ad7d076a2f3e1c56f76b9f.zip | |
Various patches and bug fixes, and XInclude progresses:
- 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
Daniel
Diffstat (limited to 'xpointer.c')
| -rw-r--r-- | xpointer.c | 40 |
1 files changed, 39 insertions, 1 deletions
@@ -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 <stdio.h> @@ -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); +} /************************************************************************ * * |
