*
* Check that a given namespace is in scope on a node.
*
- * Returns 1 if in scope, -1 in case of argument error,
+ * Returns 1 if in scope, -1 in case of argument error,
* -2 if the namespace is not in scope, and -3 if not on
* an ancestor node.
*/
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) ||
(node != (xmlNodePtr) node->parent->properties))
xmlDebugErr(ctxt, XML_CHECK_NO_PREV,
"Attr has no prev and not first of attr list\n");
-
+
} else if ((node->parent != NULL) && (node->parent->children != node))
xmlDebugErr(ctxt, XML_CHECK_NO_PREV,
"Node has no prev and not first of parent list\n");
(node->type != XML_ELEMENT_DECL) &&
(node->type != XML_ATTRIBUTE_DECL) &&
(node->type != XML_DTD_NODE) &&
- (node->type != XML_ELEMENT_DECL) &&
(node->type != XML_HTML_DOCUMENT_NODE) &&
(node->type != XML_DOCUMENT_NODE)) {
if (node->content != NULL)
return;
}
xmlCtxtDumpOneNode(ctxt, node);
- if ((node->type != XML_NAMESPACE_DECL) &&
+ if ((node->type != XML_NAMESPACE_DECL) &&
(node->children != NULL) && (node->type != XML_ENTITY_REF_NODE)) {
ctxt->depth++;
xmlCtxtDumpNodeList(ctxt, node->children);
xmlLsCountNode(xmlNodePtr node) {
int ret = 0;
xmlNodePtr list = NULL;
-
+
if (node == NULL)
return(0);
ret = 1;
break;
}
- for (;list != NULL;ret++)
+ for (;list != NULL;ret++)
list = list->next;
return(ret);
}
if (node->type != XML_NAMESPACE_DECL) {
if (node->properties != NULL)
fprintf(output, "a");
- else
+ else
fprintf(output, "-");
- if (node->nsDef != NULL)
+ if (node->nsDef != NULL)
fprintf(output, "n");
- else
+ else
fprintf(output, "-");
}
* xmlBoolToText:
* @boolval: a bool to turn into text
*
- * Convenient way to turn bool into text
+ * Convenient way to turn bool into text
*
* Returns a pointer to either "True" or "False"
*/
#ifdef LIBXML_XPATH_ENABLED
/****************************************************************
* *
- * The XML shell related functions *
+ * The XML shell related functions *
* *
****************************************************************/
if (node == NULL) {
fprintf(ctxt->output, "NULL\n");
return (0);
- }
+ }
base = xmlNodeGetBase(node->doc, node);
if (node == NULL) {
fprintf(ctxt->output, "NULL\n");
return (0);
- }
+ }
if ((node->type == XML_DOCUMENT_NODE) ||
(node->type == XML_HTML_DOCUMENT_NODE)) {
xmlDebugDumpDocumentHead(ctxt->output, (xmlDocPtr) node);
if (node == NULL) {
fprintf(ctxt->output, "NULL\n");
return (0);
- }
+ }
if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) {
#ifdef LIBXML_HTML_ENABLED
if (node->type == XML_HTML_DOCUMENT_NODE)
* xmlShellPwd:
* @ctxt: the shell context
* @buffer: the output buffer
- * @node: a node
+ * @node: a node
* @node2: unused
*
* Implements the XML shell function "pwd"
* @input: the line reading function
* @output: the output FILE*, defaults to stdout if NULL
*
- * Implements the XML shell
+ * Implements the XML shell
* This allow to load, validate, view, modify and save a document
* using a environment similar to a UNIX commandline.
*/
} 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
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;