Lines Matching refs: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);
273 xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) {
277 doc = node->doc;
279 if (node->parent == NULL)
282 if (node->doc == NULL) {
304 if ((node->parent != NULL) && (node->doc != node->parent->doc) &&
305 (!xmlStrEqual(node->name, BAD_CAST "pseudoroot")))
308 if (node->prev == NULL) {
309 if (node->type == XML_ATTRIBUTE_NODE) {
310 if ((node->parent != NULL) &&
311 (node != (xmlNodePtr) node->parent->properties))
315 } else if ((node->parent != NULL) && (node->parent->children != node))
319 if (node->prev->next != node)
323 if (node->next == NULL) {
324 if ((node->parent != NULL) && (node->type != XML_ATTRIBUTE_NODE) &&
325 (node->parent->last != node) &&
326 (node->parent->type == XML_ELEMENT_NODE))
330 if (node->next->prev != node)
333 if (node->next->parent != node->parent)
337 if (node->type == XML_ELEMENT_NODE) {
340 ns = node->nsDef;
342 xmlCtxtNsCheckScope(ctxt, node, ns);
345 if (node->ns != NULL)
346 xmlCtxtNsCheckScope(ctxt, node, node->ns);
347 } else if (node->type == XML_ATTRIBUTE_NODE) {
348 if (node->ns != NULL)
349 xmlCtxtNsCheckScope(ctxt, node, node->ns);
352 if ((node->type != XML_ELEMENT_NODE) &&
353 (node->type != XML_ATTRIBUTE_NODE) &&
354 (node->type != XML_ELEMENT_DECL) &&
355 (node->type != XML_ATTRIBUTE_DECL) &&
356 (node->type != XML_DTD_NODE) &&
357 (node->type != XML_HTML_DOCUMENT_NODE) &&
358 (node->type != XML_DOCUMENT_NODE)) {
359 if (node->content != NULL)
360 xmlCtxtCheckString(ctxt, (const xmlChar *) node->content);
362 switch (node->type) {
365 xmlCtxtCheckName(ctxt, node->name);
368 if ((node->name == xmlStringText) ||
369 (node->name == xmlStringTextNoenc))
373 (node->name == xmlDictLookup(ctxt->dict, BAD_CAST "nbktext",
378 "Text node has wrong name '%s'",
379 (const char *) node->name);
382 if (node->name == xmlStringComment)
385 "Comment node has wrong name '%s'",
386 (const char *) node->name);
389 xmlCtxtCheckName(ctxt, node->name);
392 if (node->name == NULL)
396 (const char *) node->name);
451 fprintf(ctxt->output, "DTD node is NULL\n");
721 fprintf(ctxt->output, "namespace node is NULL\n");
871 * @node: the node
874 * Dumps debug information for the element node, it is not recursive
877 xmlCtxtDumpOneNode(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
879 if (node == NULL) {
882 fprintf(ctxt->output, "node is NULL\n");
886 ctxt->node = node;
888 switch (node->type) {
893 if ((node->ns != NULL) && (node->ns->prefix != NULL)) {
894 xmlCtxtDumpString(ctxt, node->ns->prefix);
897 xmlCtxtDumpString(ctxt, node->name);
905 xmlCtxtGenericNodeCheck(ctxt, node);
910 if (node->name == (const xmlChar *) xmlStringTextNoenc)
915 if (node->content == (xmlChar *) &(node->properties))
917 else if (xmlDictOwns(ctxt->dict, node->content) == 1)
935 (char *) node->name);
947 fprintf(ctxt->output, "PI %s\n", (char *) node->name);
962 xmlCtxtGenericNodeCheck(ctxt, node);
983 xmlCtxtDumpDtdNode(ctxt, (xmlDtdPtr) node);
986 xmlCtxtDumpElemDecl(ctxt, (xmlElementPtr) node);
989 xmlCtxtDumpAttrDecl(ctxt, (xmlAttributePtr) node);
992 xmlCtxtDumpEntityDecl(ctxt, (xmlEntityPtr) node);
995 xmlCtxtDumpNamespace(ctxt, (xmlNsPtr) node);
1013 "Unknown node type %d\n", node->type);
1016 if (node->doc == NULL) {
1023 if ((node->type == XML_ELEMENT_NODE) && (node->nsDef != NULL))
1024 xmlCtxtDumpNamespaceList(ctxt, node->nsDef);
1025 if ((node->type == XML_ELEMENT_NODE) && (node->properties != NULL))
1026 xmlCtxtDumpAttrList(ctxt, node->properties);
1027 if (node->type != XML_ENTITY_REF_NODE) {
1028 if ((node->type != XML_ELEMENT_NODE) && (node->content != NULL)) {
1032 xmlCtxtDumpString(ctxt, node->content);
1039 ent = xmlGetDocEntity(node->doc, node->name);
1048 xmlCtxtGenericNodeCheck(ctxt, node);
1054 * @node: the node
1057 * Dumps debug information for the element node, it is recursive
1060 xmlCtxtDumpNode(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
1062 if (node == NULL) {
1065 fprintf(ctxt->output, "node is NULL\n");
1069 xmlCtxtDumpOneNode(ctxt, node);
1070 if ((node->type != XML_NAMESPACE_DECL) &&
1071 (node->children != NULL) && (node->type != XML_ENTITY_REF_NODE)) {
1073 xmlCtxtDumpNodeList(ctxt, node->children);
1081 * @node: the node list
1084 * Dumps debug information for the list of element node, it is recursive
1087 xmlCtxtDumpNodeList(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
1089 while (node != NULL) {
1090 xmlCtxtDumpNode(ctxt, node);
1091 node = node->next;
1103 ctxt->node = (xmlNodePtr) doc;
1108 "Misplaced ELEMENT node\n");
1112 "Misplaced ATTRIBUTE node\n");
1116 "Misplaced TEXT node\n");
1120 "Misplaced CDATA node\n");
1124 "Misplaced ENTITYREF node\n");
1128 "Misplaced ENTITY node\n");
1132 "Misplaced PI node\n");
1136 "Misplaced COMMENT node\n");
1148 "Misplaced DOCTYPE node\n");
1152 "Misplaced FRAGMENT node\n");
1156 "Misplaced NOTATION node\n");
1160 "Unknown node type %d\n", doc->type);
1431 * @node: the node
1434 * Dumps debug information for the element node, it is not recursive
1437 xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth)
1445 xmlCtxtDumpOneNode(&ctxt, node);
1452 * @node: the node
1455 * Dumps debug information for the element node, it is recursive
1458 xmlDebugDumpNode(FILE * output, xmlNodePtr node, int depth)
1467 xmlCtxtDumpNode(&ctxt, node);
1474 * @node: the node list
1477 * Dumps debug information for the list of element node, it is recursive
1480 xmlDebugDumpNodeList(FILE * output, xmlNodePtr node, int depth)
1489 xmlCtxtDumpNodeList(&ctxt, node);
1595 * @node: the node to count
1597 * Count the children of @node.
1599 * Returns the number of children of @node.
1602 xmlLsCountNode(xmlNodePtr node) {
1606 if (node == NULL)
1609 switch (node->type) {
1611 list = node->children;
1618 list = ((xmlDocPtr) node)->children;
1621 list = ((xmlAttrPtr) node)->children;
1627 if (node->content != NULL) {
1628 ret = xmlStrlen(node->content);
1654 * @node: the node to dump
1656 * Dump to @output the type and name of @node.
1659 xmlLsOneNode(FILE *output, xmlNodePtr node) {
1661 if (node == NULL) {
1665 switch (node->type) {
1711 if (node->type != XML_NAMESPACE_DECL) {
1712 if (node->properties != NULL)
1716 if (node->nsDef != NULL)
1722 fprintf(output, " %8d ", xmlLsCountNode(node));
1724 switch (node->type) {
1726 if (node->name != NULL)
1727 fprintf(output, "%s", (const char *) node->name);
1730 if (node->name != NULL)
1731 fprintf(output, "%s", (const char *) node->name);
1734 if (node->content != NULL) {
1735 xmlDebugDumpString(output, node->content);
1741 if (node->name != NULL)
1742 fprintf(output, "%s", (const char *) node->name);
1745 if (node->name != NULL)
1746 fprintf(output, "%s", (const char *) node->name);
1749 if (node->name != NULL)
1750 fprintf(output, "%s", (const char *) node->name);
1765 xmlNsPtr ns = (xmlNsPtr) node;
1775 if (node->name != NULL)
1776 fprintf(output, "%s", (const char *) node->name);
1832 "%s: no such node\n", arg);
1880 * @node : a non-null node to print to the output FILE
1882 * Print node to the output FILE
1885 xmlShellPrintNodeCtxt(xmlShellCtxtPtr ctxt,xmlNodePtr node)
1889 if (!node)
1896 if (node->type == XML_DOCUMENT_NODE)
1897 xmlDocDump(fp, (xmlDocPtr) node);
1898 else if (node->type == XML_ATTRIBUTE_NODE)
1899 xmlDebugDumpAttrList(fp, (xmlAttrPtr) node, 0);
1901 xmlElemDump(fp, node->doc, node);
1908 * @node : a non-null node to print to the output FILE
1910 * Print node to the output FILE
1913 xmlShellPrintNode(xmlNodePtr node)
1915 xmlShellPrintNodeCtxt(NULL, node);
1946 "Empty node set\n");
1990 * @node: a node
1994 * Does an Unix like listing of the given node (like a directory)
2000 char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
2006 if (node == NULL) {
2010 if ((node->type == XML_DOCUMENT_NODE) ||
2011 (node->type == XML_HTML_DOCUMENT_NODE)) {
2012 cur = ((xmlDocPtr) node)->children;
2013 } else if (node->type == XML_NAMESPACE_DECL) {
2014 xmlLsOneNode(ctxt->output, node);
2016 } else if (node->children != NULL) {
2017 cur = node->children;
2019 xmlLsOneNode(ctxt->output, node);
2033 * @node: a node
2037 * dumps the current XML base of the node
2043 char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
2049 if (node == NULL) {
2054 base = xmlNodeGetBase(node->doc, node);
2070 * @node: a node
2074 * change the current XML base of the node
2080 char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
2083 xmlNodeSetBase(node, (xmlChar*) arg);
2093 * @node: unused
2104 xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2150 * @node: the root element
2183 * @node: a node
2187 * dumps informations about the node (namespace, attributes, content).
2193 char *arg, xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2197 if (node == NULL)
2208 while (node != NULL) {
2209 if (node->type == XML_COMMENT_NODE) {
2210 if (xmlStrstr(node->content, (xmlChar *) arg)) {
2212 fprintf(ctxt->output, "%s : ", xmlGetNodePath(node));
2213 xmlShellList(ctxt, NULL, node, NULL);
2215 } else if (node->type == XML_TEXT_NODE) {
2216 if (xmlStrstr(node->content, (xmlChar *) arg)) {
2218 fprintf(ctxt->output, "%s : ", xmlGetNodePath(node->parent));
2219 xmlShellList(ctxt, NULL, node->parent, NULL);
2227 if ((node->type == XML_DOCUMENT_NODE) ||
2228 (node->type == XML_HTML_DOCUMENT_NODE)) {
2229 node = ((xmlDocPtr) node)->children;
2230 } else if ((node->children != NULL)
2231 && (node->type != XML_ENTITY_REF_NODE)) {
2233 node = node->children;
2234 } else if (node->next != NULL) {
2236 node = node->next;
2239 while (node != NULL) {
2240 if (node->parent != NULL) {
2241 node = node->parent;
2243 if (node->next != NULL) {
2244 node = node->next;
2247 if (node->parent == NULL) {
2248 node = NULL;
2261 * @node: a node
2265 * dumps informations about the node (namespace, attributes, content).
2271 char *arg ATTRIBUTE_UNUSED, xmlNodePtr node,
2276 if (node == NULL) {
2280 if ((node->type == XML_DOCUMENT_NODE) ||
2281 (node->type == XML_HTML_DOCUMENT_NODE)) {
2282 xmlDebugDumpDocumentHead(ctxt->output, (xmlDocPtr) node);
2283 } else if (node->type == XML_ATTRIBUTE_NODE) {
2284 xmlDebugDumpAttr(ctxt->output, (xmlAttrPtr) node, 0);
2286 xmlDebugDumpOneNode(ctxt->output, node, 0);
2295 * @node: a node
2299 * dumps informations about the node (namespace, attributes, content).
2305 char *value, xmlNodePtr node,
2313 if (node == NULL) {
2322 ret = xmlParseInNodeContext(node, value, strlen(value), 0, &results);
2324 if (node->children != NULL) {
2325 xmlFreeNodeList(node->children);
2326 node->children = NULL;
2327 node->last = NULL;
2329 xmlAddChildList(node, results);
2341 * @node: a node
2351 xmlNodePtr node ATTRIBUTE_UNUSED,
2397 * @node: a node
2401 * dumps the serialization node content (XML or HTML).
2407 xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2411 if (node == NULL) {
2417 if (node->type == XML_HTML_DOCUMENT_NODE)
2418 htmlDocDump(ctxt->output, (htmlDocPtr) node);
2420 htmlNodeDumpFile(ctxt->output, ctxt->doc, node);
2422 if (node->type == XML_DOCUMENT_NODE)
2423 xmlDocDump(ctxt->output, (xmlDocPtr) node);
2425 xmlElemDump(ctxt->output, ctxt->doc, node);
2428 if (node->type == XML_DOCUMENT_NODE)
2429 xmlDocDump(ctxt->output, (xmlDocPtr) node);
2431 xmlElemDump(ctxt->output, ctxt->doc, node);
2442 * @node: unused
2452 xmlNodePtr node ATTRIBUTE_UNUSED,
2482 ctxt->node = (xmlNodePtr) doc;
2497 * @node: a node in the tree
2501 * Write the current node to the filename, it saves the serialization
2502 * of the subtree under the @node specified
2507 xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node,
2510 if (node == NULL)
2522 switch (node->type) {
2554 xmlElemDump(f, ctxt->doc, node);
2565 * @node: unused
2575 xmlNodePtr node ATTRIBUTE_UNUSED,
2626 * @node: unused
2637 xmlNodePtr node ATTRIBUTE_UNUSED,
2668 * @tree: a node defining a subtree
2672 * show the structure of the subtree under node @tree
2673 * If @tree is null, the command works on the current node.
2682 xmlNodePtr node;
2690 node = tree;
2691 while (node != NULL) {
2692 if ((node->type == XML_DOCUMENT_NODE) ||
2693 (node->type == XML_HTML_DOCUMENT_NODE)) {
2695 } else if (node->type == XML_ELEMENT_NODE) {
2698 fprintf(ctxt->output, "%s\n", node->name);
2706 if ((node->type == XML_DOCUMENT_NODE) ||
2707 (node->type == XML_HTML_DOCUMENT_NODE)) {
2708 node = ((xmlDocPtr) node)->children;
2709 } else if ((node->children != NULL)
2710 && (node->type != XML_ENTITY_REF_NODE)) {
2712 node = node->children;
2714 } else if ((node != tree) && (node->next != NULL)) {
2716 node = node->next;
2717 } else if (node != tree) {
2719 while (node != tree) {
2720 if (node->parent != NULL) {
2721 node = node->parent;
2724 if ((node != tree) && (node->next != NULL)) {
2725 node = node->next;
2728 if (node->parent == NULL) {
2729 node = NULL;
2732 if (node == tree) {
2733 node = NULL;
2738 if (node == tree)
2739 node = NULL;
2741 node = NULL;
2750 * @node: a node
2754 * Show the full path from the root to the node, if needed building
2762 xmlNodePtr node, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2766 if ((node == NULL) || (buffer == NULL))
2769 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);
2892 fprintf(ctxt->output, "\tbase display XML base of the node\n");
2893 fprintf(ctxt->output, "\tsetbase URI change the XML base of the node\n");
2895 fprintf(ctxt->output, "\tcat [node] display node or current node\n");
2897 fprintf(ctxt->output, "\tdir [path] dumps informations about the node (namespace, attributes, content)\n");
2898 fprintf(ctxt->output, "\tdu [path] show the structure of the subtree under path or the current node\n");
2904 fprintf(ctxt->output, "\tset xml_fragment replace the current node content with the fragment parsed in context\n");
2916 fprintf(ctxt->output, "\twrite [name] write the current node to the filename\n");
2946 xmlShellGrep(ctxt, arg, ctxt->node, NULL);
2959 if (!xmlShellPwd(ctxt, dir, ctxt->node, NULL))
2962 xmlShellDu(ctxt, NULL, ctxt->node, NULL);
2964 xmlShellBase(ctxt, NULL, ctxt->node, NULL);
2966 xmlShellSetContent(ctxt, arg, ctxt->node, NULL);
2985 ctxt->pctxt->node = ctxt->node;
2993 xmlShellSetBase(ctxt, arg, ctxt->node, NULL);
3000 xmlShellDir(ctxt, NULL, ctxt->node, NULL);
3002 xmlShellList(ctxt, NULL, ctxt->node, NULL);
3004 ctxt->pctxt->node = ctxt->node;
3006 ctxt->pctxt->node = ctxt->node;
3015 "%s: no such node\n", arg);
3076 "%s: no such node\n", arg);
3078 ctxt->pctxt->node = NULL;
3082 ctxt->node = (xmlNodePtr) ctxt->doc;
3085 ctxt->pctxt->node = ctxt->node;
3094 "%s: no such node\n", arg);
3099 ctxt->node = list->nodesetval->nodeTab[0];
3100 if ((ctxt->node != NULL) &&
3101 (ctxt->node->type ==
3105 ctxt->node = NULL;
3156 "%s: no such node\n", arg);
3158 ctxt->pctxt->node = NULL;
3163 xmlShellCat(ctxt, NULL, ctxt->node, NULL);
3165 ctxt->pctxt->node = ctxt->node;
3167 ctxt->pctxt->node = ctxt->node;
3176 "%s: no such node\n", arg);
3234 "%s: no such node\n", arg);
3236 ctxt->pctxt->node = NULL;