Home | History | Annotate | Download | only in libxml2

Lines Matching full:node

46     xmlNodePtr node;		/* current node */
54 static void xmlCtxtDumpNodeList(xmlDebugCtxtPtr ctxt, xmlNodePtr node);
66 ctxt->node = NULL;
83 * @node: the node
84 * @ns: the namespace node
86 * Check that a given namespace is in scope on a node.
90 * an ancestor node.
93 xmlNsCheckScope(xmlNodePtr node, xmlNsPtr ns)
97 if ((node == NULL) || (ns == NULL))
100 if ((node->type != XML_ELEMENT_NODE) &&
101 (node->type != XML_ATTRIBUTE_NODE) &&
102 (node->type != XML_DOCUMENT_NODE) &&
103 (node->type != XML_TEXT_NODE) &&
104 (node->type != XML_HTML_DOCUMENT_NODE) &&
105 (node->type != XML_XINCLUDE_START))
108 while ((node != NULL) &&
109 ((node->type == XML_ELEMENT_NODE) ||
110 (node->type == XML_ATTRIBUTE_NODE) ||
111 (node->type == XML_TEXT_NODE) ||
112 (node->type == XML_XINCLUDE_START))) {
113 if ((node->type == XML_ELEMENT_NODE) ||
114 (node->type == XML_XINCLUDE_START)) {
115 cur = node->nsDef;
124 node = node->parent;
126 /* the xml namespace may be declared on the document node */
127 if ((node != NULL) &&
128 ((node->type == XML_DOCUMENT_NODE) ||
129 (node->type == XML_HTML_DOCUMENT_NODE))) {
130 xmlNsPtr oldNs = ((xmlDocPtr) node)->oldNs;
162 NULL, ctxt->node, XML_FROM_CHECK,
172 NULL, ctxt->node, XML_FROM_CHECK,
182 NULL, ctxt->node, XML_FROM_CHECK,
191 * @node: the node
192 * @ns: the namespace node
197 xmlCtxtNsCheckScope(xmlDebugCtxtPtr ctxt, xmlNodePtr node, xmlNsPtr ns)
201 ret = xmlNsCheckScope(node, ns);
271 xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) {
275 doc = node->doc;
277 if (node->parent == NULL)
279 "Node has no parent\n");
280 if (node->doc == NULL) {
282 "Node has no doc\n");
302 if ((node->parent != NULL) && (node->doc != node->parent->doc) &&
303 (!xmlStrEqual(node->name, BAD_CAST "pseudoroot")))
305 "Node doc differs from parent's one\n");
306 if (node->prev == NULL) {
307 if (node->type == XML_ATTRIBUTE_NODE) {
308 if ((node->parent != NULL) &&
309 (node != (xmlNodePtr) node->parent->properties))
313 } else if ((node->parent != NULL) && (node->parent->children != node))
315 "Node has no prev and not first of parent list\n");
317 if (node->prev->next != node)
319 "Node prev->next : back link wrong\n");
321 if (node->next == NULL) {
322 if ((node->parent != NULL) && (node->type != XML_ATTRIBUTE_NODE) &&
323 (node->parent->last != node) &&
324 (node->parent->type == XML_ELEMENT_NODE))
326 "Node has no next and not last of parent list\n");
328 if (node->next->prev != node)
330 "Node next->prev : forward link wrong\n");
331 if (node->next->parent != node->parent)
333 "Node next->prev : forward link wrong\n");
335 if (node->type == XML_ELEMENT_NODE) {
338 ns = node->nsDef;
340 xmlCtxtNsCheckScope(ctxt, node, ns);
343 if (node->ns != NULL)
344 xmlCtxtNsCheckScope(ctxt, node, node->ns);
345 } else if (node->type == XML_ATTRIBUTE_NODE) {
346 if (node->ns != NULL)
347 xmlCtxtNsCheckScope(ctxt, node, node->ns);
350 if ((node->type != XML_ELEMENT_NODE) &&
351 (node->type != XML_ATTRIBUTE_NODE) &&
352 (node->type != XML_ELEMENT_DECL) &&
353 (node->type != XML_ATTRIBUTE_DECL) &&
354 (node->type != XML_DTD_NODE) &&
355 (node->type != XML_ELEMENT_DECL) &&
356 (node->type != XML_HTML_DOCUMENT_NODE) &&
357 (node->type != XML_DOCUMENT_NODE)) {
358 if (node->content != NULL)
359 xmlCtxtCheckString(ctxt, (const xmlChar *) node->content);
361 switch (node->type) {
364 xmlCtxtCheckName(ctxt, node->name);
367 if ((node->name == xmlStringText) ||
368 (node->name == xmlStringTextNoenc))
372 (node->name == xmlDictLookup(ctxt->dict, BAD_CAST "nbktext",
377 "Text node has wrong name '%s'",
378 (const char *) node->name);
381 if (node->name == xmlStringComment)
384 "Comment node has wrong name '%s'",
385 (const char *) node->name);
388 xmlCtxtCheckName(ctxt, node->name);
391 if (node->name == NULL)
395 (const char *) node->name);
450 fprintf(ctxt->output, "DTD node is NULL\n");
456 "Node is not a DTD");
488 "Node is not an attribute declaration");
496 "Node attribute declaration has no name");
502 "Node attribute declaration has no element name");
593 "Node is not an element declaration");
652 "Node is not an entity declaration");
720 fprintf(ctxt->output, "namespace node is NULL\n");
725 "Node is not a namespace declaration");
870 * @node: the node
873 * Dumps debug information for the element node, it is not recursive
876 xmlCtxtDumpOneNode(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
878 if (node == NULL) {
881 fprintf(ctxt->output, "node is NULL\n");
885 ctxt->node = node;
887 switch (node->type) {
892 if ((node->ns != NULL) && (node->ns->prefix != NULL)) {
893 xmlCtxtDumpString(ctxt, node->ns->prefix);
896 xmlCtxtDumpString(ctxt, node->name);
904 xmlCtxtGenericNodeCheck(ctxt, node);
909 if (node->name == (const xmlChar *) xmlStringTextNoenc)
914 if (node->content == (xmlChar *) &(node->properties))
916 else if (xmlDictOwns(ctxt->dict, node->content) == 1)
934 (char *) node->name);
946 fprintf(ctxt->output, "PI %s\n", (char *) node->name);
961 xmlCtxtGenericNodeCheck(ctxt, node);
982 xmlCtxtDumpDtdNode(ctxt, (xmlDtdPtr) node);
985 xmlCtxtDumpElemDecl(ctxt, (xmlElementPtr) node);
988 xmlCtxtDumpAttrDecl(ctxt, (xmlAttributePtr) node);
991 xmlCtxtDumpEntityDecl(ctxt, (xmlEntityPtr) node);
994 xmlCtxtDumpNamespace(ctxt, (xmlNsPtr) node);
1012 "Unknown node type %d\n", node->type);
1015 if (node->doc == NULL) {
1022 if ((node->type == XML_ELEMENT_NODE) && (node->nsDef != NULL))
1023 xmlCtxtDumpNamespaceList(ctxt, node->nsDef);
1024 if ((node->type == XML_ELEMENT_NODE) && (node->properties != NULL))
1025 xmlCtxtDumpAttrList(ctxt, node->properties);
1026 if (node->type != XML_ENTITY_REF_NODE) {
1027 if ((node->type != XML_ELEMENT_NODE) && (node->content != NULL)) {
1031 xmlCtxtDumpString(ctxt, node->content);
1038 ent = xmlGetDocEntity(node->doc, node->name);
1047 xmlCtxtGenericNodeCheck(ctxt, node);
1053 * @node: the node
1056 * Dumps debug information for the element node, it is recursive
1059 xmlCtxtDumpNode(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
1061 if (node == NULL) {
1064 fprintf(ctxt->output, "node is NULL\n");
1068 xmlCtxtDumpOneNode(ctxt, node);
1069 if ((node->type != XML_NAMESPACE_DECL) &&
1070 (node->children != NULL) && (node->type != XML_ENTITY_REF_NODE)) {
1072 xmlCtxtDumpNodeList(ctxt, node->children);
1080 * @node: the node list
1083 * Dumps debug information for the list of element node, it is recursive
1086 xmlCtxtDumpNodeList(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
1088 while (node != NULL) {
1089 xmlCtxtDumpNode(ctxt, node);
1090 node = node->next;
1102 ctxt->node = (xmlNodePtr) doc;
1107 "Misplaced ELEMENT node\n");
1111 "Misplaced ATTRIBUTE node\n");
1115 "Misplaced TEXT node\n");
1119 "Misplaced CDATA node\n");
1123 "Misplaced ENTITYREF node\n");
1127 "Misplaced ENTITY node\n");
1131 "Misplaced PI node\n");
1135 "Misplaced COMMENT node\n");
1147 "Misplaced DOCTYPE node\n");
1151 "Misplaced FRAGMENT node\n");
1155 "Misplaced NOTATION node\n");
1159 "Unknown node type %d\n", doc->type);
1430 * @node: the node
1433 * Dumps debug information for the element node, it is not recursive
1436 xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth)
1444 xmlCtxtDumpOneNode(&ctxt, node);
1451 * @node: the node
1454 * Dumps debug information for the element node, it is recursive
1457 xmlDebugDumpNode(FILE * output, xmlNodePtr node, int depth)
1466 xmlCtxtDumpNode(&ctxt, node);
1473 * @node: the node list
1476 * Dumps debug information for the list of element node, it is recursive
1479 xmlDebugDumpNodeList(FILE * output, xmlNodePtr node, int depth)
1488 xmlCtxtDumpNodeList(&ctxt, node);
1594 * @node: the node to count
1596 * Count the children of @node.
1598 * Returns the number of children of @node.
1601 xmlLsCountNode(xmlNodePtr node) {
1605 if (node == NULL)
1608 switch (node->type) {
1610 list = node->children;
1617 list = ((xmlDocPtr) node)->children;
1620 list = ((xmlAttrPtr) node)->children;
1626 if (node->content != NULL) {
1627 ret = xmlStrlen(node->content);
1653 * @node: the node to dump
1655 * Dump to @output the type and name of @node.
1658 xmlLsOneNode(FILE *output, xmlNodePtr node) {
1660 if (node == NULL) {
1664 switch (node->type) {
1710 if (node->type != XML_NAMESPACE_DECL) {
1711 if (node->properties != NULL)
1715 if (node->nsDef != NULL)
1721 fprintf(output, " %8d ", xmlLsCountNode(node));
1723 switch (node->type) {
1725 if (node->name != NULL)
1726 fprintf(output, "%s", (const char *) node->name);
1729 if (node->name != NULL)
1730 fprintf(output, "%s", (const char *) node->name);
1733 if (node->content != NULL) {
1734 xmlDebugDumpString(output, node->content);
1740 if (node->name != NULL)
1741 fprintf(output, "%s", (const char *) node->name);
1744 if (node->name != NULL)
1745 fprintf(output, "%s", (const char *) node->name);
1748 if (node->name != NULL)
1749 fprintf(output, "%s", (const char *) node->name);
1764 xmlNsPtr ns = (xmlNsPtr) node;
1774 if (node->name != NULL)
1775 fprintf(output, "%s", (const char *) node->name);
1831 "%s: no such node\n", arg);
1879 * @node : a non-null node to print to the output FILE
1881 * Print node to the output FILE
1884 xmlShellPrintNodeCtxt(xmlShellCtxtPtr ctxt,xmlNodePtr node)
1888 if (!node)
1895 if (node->type == XML_DOCUMENT_NODE)
1896 xmlDocDump(fp, (xmlDocPtr) node);
1897 else if (node->type == XML_ATTRIBUTE_NODE)
1898 xmlDebugDumpAttrList(fp, (xmlAttrPtr) node, 0);
1900 xmlElemDump(fp, node->doc, node);
1907 * @node : a non-null node to print to the output FILE
1909 * Print node to the output FILE
1912 xmlShellPrintNode(xmlNodePtr node)
1914 xmlShellPrintNodeCtxt(NULL, node);
1945 "Empty node set\n");
1950 "Node set\n");
1989 * @node: a node
1993 * Does an Unix like listing of the given node (like a directory)
1999 char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
2005 if (node == NULL) {
2009 if ((node->type == XML_DOCUMENT_NODE) ||
2010 (node->type == XML_HTML_DOCUMENT_NODE)) {
2011 cur = ((xmlDocPtr) node)->children;
2012 } else if (node->type == XML_NAMESPACE_DECL) {
2013 xmlLsOneNode(ctxt->output, node);
2015 } else if (node->children != NULL) {
2016 cur = node->children;
2018 xmlLsOneNode(ctxt->output, node);
2032 * @node: a node
2036 * dumps the current XML base of the node
2042 char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
2048 if (node == NULL) {
2053 base = xmlNodeGetBase(node->doc, node);
2069 * @node: a node
2073 * change the current XML base of the node
2079 char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
2082 xmlNodeSetBase(node, (xmlChar*) arg);
2092 * @node: unused
2103 xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2149 * @node: the root element
2182 * @node: a node
2186 * dumps informations about the node (namespace, attributes, content).
2192 char *arg, xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2196 if (node == NULL)
2207 while (node != NULL) {
2208 if (node->type == XML_COMMENT_NODE) {
2209 if (xmlStrstr(node->content, (xmlChar *) arg)) {
2211 fprintf(ctxt->output, "%s : ", xmlGetNodePath(node));
2212 xmlShellList(ctxt, NULL, node, NULL);
2214 } else if (node->type == XML_TEXT_NODE) {
2215 if (xmlStrstr(node->content, (xmlChar *) arg)) {
2217 fprintf(ctxt->output, "%s : ", xmlGetNodePath(node->parent));
2218 xmlShellList(ctxt, NULL, node->parent, NULL);
2226 if ((node->type == XML_DOCUMENT_NODE) ||
2227 (node->type == XML_HTML_DOCUMENT_NODE)) {
2228 node = ((xmlDocPtr) node)->children;
2229 } else if ((node->children != NULL)
2230 && (node->type != XML_ENTITY_REF_NODE)) {
2232 node = node->children;
2233 } else if (node->next != NULL) {
2235 node = node->next;
2238 while (node != NULL) {
2239 if (node->parent != NULL) {
2240 node = node->parent;
2242 if (node->next != NULL) {
2243 node = node->next;
2246 if (node->parent == NULL) {
2247 node = NULL;
2260 * @node: a node
2264 * dumps informations about the node (namespace, attributes, content).
2270 char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
2275 if (node == NULL) {
2279 if ((node->type == XML_DOCUMENT_NODE) ||
2280 (node->type == XML_HTML_DOCUMENT_NODE)) {
2281 xmlDebugDumpDocumentHead(ctxt->output, (xmlDocPtr) node);
2282 } else if (node->type == XML_ATTRIBUTE_NODE) {
2283 xmlDebugDumpAttr(ctxt->output, (xmlAttrPtr) node, 0);
2285 xmlDebugDumpOneNode(ctxt->output, node, 0);
2294 * @node: a node
2298 * dumps informations about the node (namespace, attributes, content).
2304 char *value, xmlNodePtr node,
2312 if (node == NULL) {
2321 ret = xmlParseInNodeContext(node, value, strlen(value), 0, &results);
2323 if (node->children != NULL) {
2324 xmlFreeNodeList(node->children);
2325 node->children = NULL;
2326 node->last = NULL;
2328 xmlAddChildList(node, results);
2340 * @node: a node
2350 xmlNodePtr node ATTRIBUTE_UNUSED,
2396 * @node: a node
2400 * dumps the serialization node content (XML or HTML).
2406 xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2410 if (node == NULL) {
2416 if (node->type == XML_HTML_DOCUMENT_NODE)
2417 htmlDocDump(ctxt->output, (htmlDocPtr) node);
2419 htmlNodeDumpFile(ctxt->output, ctxt->doc, node);
2421 if (node->type == XML_DOCUMENT_NODE)
2422 xmlDocDump(ctxt->output, (xmlDocPtr) node);
2424 xmlElemDump(ctxt->output, ctxt->doc, node);
2427 if (node->type == XML_DOCUMENT_NODE)
2428 xmlDocDump(ctxt->output, (xmlDocPtr) node);
2430 xmlElemDump(ctxt->output, ctxt->doc, node);
2441 * @node: unused
2451 xmlNodePtr node ATTRIBUTE_UNUSED,
2481 ctxt->node = (xmlNodePtr) doc;
2496 * @node: a node in the tree
2500 * Write the current node to the filename, it saves the serialization
2501 * of the subtree under the @node specified
2506 xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
2509 if (node == NULL)
2521 switch (node->type) {
2553 xmlElemDump(f, ctxt->doc, node);
2564 * @node: unused
2574 xmlNodePtr node ATTRIBUTE_UNUSED,
2625 * @node: unused
2636 xmlNodePtr node ATTRIBUTE_UNUSED,
2667 * @tree: a node defining a subtree
2671 * show the structure of the subtree under node @tree
2672 * If @tree is null, the command works on the current node.
2681 xmlNodePtr node;
2689 node = tree;
2690 while (node != NULL) {
2691 if ((node->type == XML_DOCUMENT_NODE) ||
2692 (node->type == XML_HTML_DOCUMENT_NODE)) {
2694 } else if (node->type == XML_ELEMENT_NODE) {
2697 fprintf(ctxt->output, "%s\n", node->name);
2705 if ((node->type == XML_DOCUMENT_NODE) ||
2706 (node->type == XML_HTML_DOCUMENT_NODE)) {
2707 node = ((xmlDocPtr) node)->children;
2708 } else if ((node->children != NULL)
2709 && (node->type != XML_ENTITY_REF_NODE)) {
2711 node = node->children;
2713 } else if ((node != tree) && (node->next != NULL)) {
2715 node = node->next;
2716 } else if (node != tree) {
2718 while (node != tree) {
2719 if (node->parent != NULL) {
2720 node = node->parent;
2723 if ((node != tree) && (node->next != NULL)) {
2724 node = node->next;
2727 if (node->parent == NULL) {
2728 node = NULL;
2731 if (node == tree) {
2732 node = NULL;
2737 if (node == tree)
2738 node = NULL;
2740 node = NULL;
2749 * @node: a node
2753 * Show the full path from the root to the node, if needed building
2761 xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2765 if ((node == NULL) || (buffer == NULL))
2768 path = xmlGetNodePath(node);
2827 ctxt->node = (xmlNodePtr) ctxt->doc;
2837 if (ctxt->node == (xmlNodePtr) ctxt->doc)
2839 else if ((ctxt->node != NULL) && (ctxt->node->name))
2840 snprintf(prompt, sizeof(prompt), "%s > ", ctxt->node->name);
2896 fprintf(ctxt->output, "\tbase display XML base of the node\n");
2897 fprintf(ctxt->output, "\tsetbase URI change the XML base of the node\n");
2899 fprintf(ctxt->output, "\tcat [node] display node or current node\n");
2901 fprintf(ctxt->output, "\tdir [path] dumps informations about the node (namespace, attributes, content)\n");
2902 fprintf(ctxt->output, "\tdu [path] show the structure of the subtree under path or the current node\n");
2908 fprintf(ctxt->output, "\tset xml_fragment replace the current node content with the fragment parsed in context\n");
2920 fprintf(ctxt->output, "\twrite [name] write the current node to the filename\n");
2950 xmlShellGrep(ctxt, arg, ctxt->node, NULL);
2963 if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL))
2966 xmlShellDu(ctxt, NULL, ctxt->node, NULL);
2968 xmlShellBase(ctxt, NULL, ctxt->node, NULL);
2970 xmlShellSetContent(ctxt, arg, ctxt->node, NULL);
2989 ctxt->pctxt->node = ctxt->node;
2997 xmlShellSetBase(ctxt, arg, ctxt->node, NULL);
3004 xmlShellDir(ctxt, NULL, ctxt->node, NULL);
3006 xmlShellList(ctxt, NULL, ctxt->node, NULL);
3008 ctxt->pctxt->node = ctxt->node;
3010 ctxt->pctxt->node = ctxt->node;
3019 "%s: no such node\n", arg);
3080 "%s: no such node\n", arg);
3082 ctxt->pctxt->node = NULL;
3086 ctxt->node = (xmlNodePtr) ctxt->doc;
3089 ctxt->pctxt->node = ctxt->node;
3098 "%s: no such node\n", arg);
3103 ctxt->node = list->nodesetval->nodeTab[0];
3104 if ((ctxt->node != NULL) &&
3105 (ctxt->node->type ==
3109 ctxt->node = NULL;
3113 "%s is a %d Node Set\n",
3118 "%s is an empty Node Set\n",
3160 "%s: no such node\n", arg);
3162 ctxt->pctxt->node = NULL;
3167 xmlShellCat(ctxt, NULL, ctxt->node, NULL);
3169 ctxt->pctxt->node = ctxt->node;
3171 ctxt->pctxt->node = ctxt->node;
3180 "%s: no such node\n", arg);
3238 "%s: no such node\n", arg);
3240 ctxt->pctxt->node = NULL;