diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2004-08-16 00:39:03 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2004-08-16 00:39:03 +0000 |
commit | 29b1748205897f727696b62fdba333efc9671440 (patch) | |
tree | 0fbd0025ff3d6fcd286b03834cba7d4d9c3cf1ad /debugXML.c | |
parent | 774a3bd4cd32c6515c5ef7b13c949c30499f74b3 (diff) | |
download | android_external_libxml2-29b1748205897f727696b62fdba333efc9671440.tar.gz android_external_libxml2-29b1748205897f727696b62fdba333efc9671440.tar.bz2 android_external_libxml2-29b1748205897f727696b62fdba333efc9671440.zip |
small typo pointed out by Mike Hommey slightly improved the --c14n
* xmlIO.c: small typo pointed out by Mike Hommey
* doc/xmllint.xml, xmllint.html, xmllint.1: slightly improved
the --c14n description, c.f. #144675 .
* nanohttp.c nanoftp.c: applied a first simple patch from
Mike Hommey for $no_proxy, c.f. #133470
* parserInternals.c include/libxml/parserInternals.h
include/libxml/xmlerror.h: cleanup to avoid 'error' identifier
in includes #
* parser.c SAX2.c debugXML.c include/libxml/parser.h:
first version of the inplementation of parsing within
the context of a node in the tree #142359, new function
xmlParseInNodeContext(), added support at the xmllint --shell
level as the "set" function
* test/scripts/set* result/scripts/* Makefile.am: extended
the script based regression tests to instrument the new function.
Daniel
Diffstat (limited to 'debugXML.c')
-rw-r--r-- | debugXML.c | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -1733,6 +1733,51 @@ xmlShellDir(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, return (0); } +/** + * xmlShellSetContent: + * @ctxt: the shell context + * @value: the content as a string + * @node: a node + * @node2: unused + * + * Implements the XML shell function "dir" + * dumps informations about the node (namespace, attributes, content). + * + * Returns 0 + */ +static int +xmlShellSetContent(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, + char *value, xmlNodePtr node, + xmlNodePtr node2 ATTRIBUTE_UNUSED) +{ + xmlNodePtr results; + xmlParserErrors ret; + + if (!ctxt) + return (0); + if (node == NULL) { + fprintf(ctxt->output, "NULL\n"); + return (0); + } + if (value == NULL) { + fprintf(ctxt->output, "NULL\n"); + return (0); + } + + ret = xmlParseInNodeContext(node, value, strlen(value), 0, &results); + if (ret == XML_ERR_OK) { + if (node->children != NULL) { + xmlFreeNodeList(node->children); + node->children = NULL; + node->last = NULL; + } + xmlAddChildList(node, results); + } else { + fprintf(ctxt->output, "failed to parse content\n"); + } + return (0); +} + #ifdef LIBXML_SCHEMAS_ENABLED /** * xmlShellRNGValidate: @@ -2358,6 +2403,8 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, xmlShellDu(ctxt, NULL, ctxt->node, NULL); } else if (!strcmp(command, "base")) { xmlShellBase(ctxt, NULL, ctxt->node, NULL); + } else if (!strcmp(command, "set")) { + xmlShellSetContent(ctxt, arg, ctxt->node, NULL); #ifdef LIBXML_XPATH_ENABLED } else if (!strcmp(command, "setns")) { if (arg[0] == 0) { |