Imported Upstream version 2.9.2
[platform/upstream/libxml2.git] / debugXML.c
index c8efe6a..b05fdff 100644 (file)
@@ -254,10 +254,12 @@ xmlCtxtCheckName(xmlDebugCtxtPtr ctxt, const xmlChar * name)
            xmlDebugErr(ctxt, XML_CHECK_NO_NAME, "Name is NULL");
            return;
        }
+#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
         if (xmlValidateName(name, 0)) {
            xmlDebugErr3(ctxt, XML_CHECK_NOT_NCNAME,
                         "Name is not an NCName '%s'", (const char *) name);
        }
+#endif
        if ((ctxt->dict != NULL) &&
            (!xmlDictOwns(ctxt->dict, name)) &&
             ((ctxt->doc == NULL) ||
@@ -2946,7 +2948,7 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
         } else if (!strcmp(command, "save")) {
             xmlShellSave(ctxt, arg, NULL, NULL);
         } else if (!strcmp(command, "write")) {
-           if ((arg == NULL) || (arg[0] == 0))
+           if (arg[0] == 0)
                xmlGenericError(xmlGenericErrorContext,
                         "Write command requires a filename argument\n");
            else
@@ -3241,7 +3243,12 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
                 ctxt->node = (xmlNodePtr) ctxt->doc;
             } else {
 #ifdef LIBXML_XPATH_ENABLED
+                int l;
+
                 ctxt->pctxt->node = ctxt->node;
+               l = strlen(arg);
+               if ((l >= 2) && (arg[l - 1] == '/'))
+                   arg[l - 1] = 0;
                 list = xmlXPathEval((xmlChar *) arg, ctxt->pctxt);
 #else
                 list = NULL;