#include <libxml/xmlerror.h>
#include <libxml/globals.h>
#include <libxml/xpathInternals.h>
+#include <libxml/uri.h>
/**
* xmlDebugDumpString:
switch (node->type) {
case XML_ELEMENT_NODE:
if (node->name != NULL)
- fprintf(output, "%s", node->name);
+ fprintf(output, "%s", (const char *) node->name);
break;
case XML_ATTRIBUTE_NODE:
if (node->name != NULL)
- fprintf(output, "%s", node->name);
+ fprintf(output, "%s", (const char *) node->name);
break;
case XML_TEXT_NODE:
if (node->content != NULL) {
break;
case XML_ENTITY_REF_NODE:
if (node->name != NULL)
- fprintf(output, "%s", node->name);
+ fprintf(output, "%s", (const char *) node->name);
break;
case XML_ENTITY_NODE:
if (node->name != NULL)
- fprintf(output, "%s", node->name);
+ fprintf(output, "%s", (const char *) node->name);
break;
case XML_PI_NODE:
if (node->name != NULL)
- fprintf(output, "%s", node->name);
+ fprintf(output, "%s", (const char *) node->name);
break;
case XML_COMMENT_NODE:
break;
}
default:
if (node->name != NULL)
- fprintf(output, "%s", node->name);
+ fprintf(output, "%s", (const char *) node->name);
}
fprintf(output, "\n");
}
#ifdef LIBXML_XPATH_ENABLED
ctxt->pctxt = xmlXPathNewContext(doc);
#endif /* LIBXML_XPATH_ENABLED */
- ctxt->filename = (char *) xmlStrdup((xmlChar *) filename);
+ ctxt->filename = (char *) xmlCanonicPath((xmlChar *) filename);
} else
return (-1);
return (0);
while (1) {
if (ctxt->node == (xmlNodePtr) ctxt->doc)
snprintf(prompt, sizeof(prompt), "%s > ", "/");
- else if (ctxt->node->name)
+ else if ((ctxt->node != NULL) && (ctxt->node->name))
snprintf(prompt, sizeof(prompt), "%s > ", ctxt->node->name);
else
snprintf(prompt, sizeof(prompt), "? > ");
if (list->nodesetval != NULL) {
if (list->nodesetval->nodeNr == 1) {
ctxt->node = list->nodesetval->nodeTab[0];
+ if ((ctxt->node != NULL) &&
+ (ctxt->node->type ==
+ XML_NAMESPACE_DECL)) {
+ xmlGenericError(xmlGenericErrorContext,
+ "cannot cd to namespace\n");
+ ctxt->node = NULL;
+ }
} else
xmlGenericError(xmlGenericErrorContext,
"%s is a %d Node Set\n",