Lines Matching refs:cur
77 static void xmlC14NVisibleNsStackDestroy (xmlC14NVisibleNsStackPtr cur);
78 static void xmlC14NVisibleNsStackAdd (xmlC14NVisibleNsStackPtr cur,
81 static void xmlC14NVisibleNsStackSave (xmlC14NVisibleNsStackPtr cur,
83 static void xmlC14NVisibleNsStackRestore (xmlC14NVisibleNsStackPtr cur,
85 static void xmlC14NVisibleNsStackShift (xmlC14NVisibleNsStackPtr cur);
86 static int xmlC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur,
88 static int xmlExcC14NVisibleNsStackFind (xmlC14NVisibleNsStackPtr cur,
98 static int xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur);
99 static int xmlC14NProcessNodeList(xmlC14NCtxPtr ctx, xmlNodePtr cur);
295 xmlC14NVisibleNsStackDestroy(xmlC14NVisibleNsStackPtr cur) {
296 if(cur == NULL) {
300 if(cur->nsTab != NULL) {
301 memset(cur->nsTab, 0, cur->nsMax * sizeof(xmlNsPtr));
302 xmlFree(cur->nsTab);
304 if(cur->nodeTab != NULL) {
305 memset(cur->nodeTab, 0, cur->nsMax * sizeof(xmlNodePtr));
306 xmlFree(cur->nodeTab);
308 memset(cur, 0, sizeof(xmlC14NVisibleNsStack));
309 xmlFree(cur);
314 xmlC14NVisibleNsStackAdd(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlNodePtr node) {
315 if((cur == NULL) ||
316 ((cur->nsTab == NULL) && (cur->nodeTab != NULL)) ||
317 ((cur->nsTab != NULL) && (cur->nodeTab == NULL))) {
322 if ((cur->nsTab == NULL) && (cur->nodeTab == NULL)) {
323 cur->nsTab = (xmlNsPtr*) xmlMalloc(XML_NAMESPACES_DEFAULT * sizeof(xmlNsPtr));
324 cur->nodeTab = (xmlNodePtr*) xmlMalloc(XML_NAMESPACES_DEFAULT * sizeof(xmlNodePtr));
325 if ((cur->nsTab == NULL) || (cur->nodeTab == NULL)) {
329 memset(cur->nsTab, 0 , XML_NAMESPACES_DEFAULT * sizeof(xmlNsPtr));
330 memset(cur->nodeTab, 0 , XML_NAMESPACES_DEFAULT * sizeof(xmlNodePtr));
331 cur->nsMax = XML_NAMESPACES_DEFAULT;
332 } else if(cur->nsMax == cur->nsCurEnd) {
336 tmpSize = 2 * cur->nsMax;
337 tmp = xmlRealloc(cur->nsTab, tmpSize * sizeof(xmlNsPtr));
342 cur->nsTab = (xmlNsPtr*)tmp;
344 tmp = xmlRealloc(cur->nodeTab, tmpSize * sizeof(xmlNodePtr));
349 cur->nodeTab = (xmlNodePtr*)tmp;
351 cur->nsMax = tmpSize;
353 cur->nsTab[cur->nsCurEnd] = ns;
354 cur->nodeTab[cur->nsCurEnd] = node;
356 ++cur->nsCurEnd;
360 xmlC14NVisibleNsStackSave(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr state) {
361 if((cur == NULL) || (state == NULL)) {
366 state->nsCurEnd = cur->nsCurEnd;
367 state->nsPrevStart = cur->nsPrevStart;
368 state->nsPrevEnd = cur->nsPrevEnd;
372 xmlC14NVisibleNsStackRestore(xmlC14NVisibleNsStackPtr cur, xmlC14NVisibleNsStackPtr state) {
373 if((cur == NULL) || (state == NULL)) {
377 cur->nsCurEnd = state->nsCurEnd;
378 cur->nsPrevStart = state->nsPrevStart;
379 cur->nsPrevEnd = state->nsPrevEnd;
383 xmlC14NVisibleNsStackShift(xmlC14NVisibleNsStackPtr cur) {
384 if(cur == NULL) {
388 cur->nsPrevStart = cur->nsPrevEnd;
389 cur->nsPrevEnd = cur->nsCurEnd;
413 xmlC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns)
420 if(cur == NULL) {
433 if (cur->nsTab != NULL) {
434 int start = (has_empty_ns) ? 0 : cur->nsPrevStart;
435 for (i = cur->nsCurEnd - 1; i >= start; --i) {
436 xmlNsPtr ns1 = cur->nsTab[i];
447 xmlExcC14NVisibleNsStackFind(xmlC14NVisibleNsStackPtr cur, xmlNsPtr ns, xmlC14NCtxPtr ctx) {
453 if(cur == NULL) {
466 if (cur->nsTab != NULL) {
468 for (i = cur->nsCurEnd - 1; i >= start; --i) {
469 xmlNsPtr ns1 = cur->nsTab[i];
473 return(xmlC14NIsVisible(ctx, ns1, cur->nodeTab[i]));
602 xmlC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
610 if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
625 for(n = cur; n != NULL; n = n->parent) {
627 tmp = xmlSearchNs(cur->doc, cur, ns->prefix);
629 if((tmp == ns) && !xmlC14NIsXmlNs(ns) && xmlC14NIsVisible(ctx, ns, cur)) {
632 xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur);
707 xmlExcC14NProcessNamespacesAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
717 if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
757 ns = xmlSearchNs(cur->doc, cur, prefix);
758 if((ns != NULL) && !xmlC14NIsXmlNs(ns) && xmlC14NIsVisible(ctx, ns, cur)) {
761 xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur);
774 if(cur->ns != NULL) {
775 ns = cur->ns;
777 ns = xmlSearchNs(cur->doc, cur, NULL);
781 if(visible && xmlC14NIsVisible(ctx, ns, cur)) {
787 xmlC14NVisibleNsStackAdd(ctx->ns_rendered, ns, cur);
796 for(attr = cur->properties; attr != NULL; attr = attr->next) {
802 if((attr->ns != NULL) && !xmlC14NIsXmlNs(attr->ns) && xmlC14NIsVisible(ctx, attr, cur)) {
804 xmlC14NVisibleNsStackAdd(ctx->ns_rendered, attr->ns, cur);
978 xmlC14NFindHiddenParentAttr(xmlC14NCtxPtr ctx, xmlNodePtr cur, const xmlChar * name, const xmlChar * ns)
981 while((cur != NULL) && (!xmlC14NIsVisible(ctx, cur, cur->parent))) {
982 res = xmlHasNsProp(cur, name, ns);
987 cur = cur->parent;
1004 xmlNodePtr cur;
1023 cur = xml_base_attr->parent->parent;
1024 while((cur != NULL) && (!xmlC14NIsVisible(ctx, cur, cur->parent))) {
1025 attr = xmlHasNsProp(cur, BAD_CAST "base", XML_XML_NAMESPACE);
1069 cur = cur->parent;
1095 * @cur: the current node
1126 xmlC14NProcessAttrsAxis(xmlC14NCtxPtr ctx, xmlNodePtr cur, int parent_visible)
1137 if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
1167 attr = cur->properties;
1170 if (xmlC14NIsVisible(ctx, attr, cur)) {
1179 if (parent_visible && (cur->parent != NULL) &&
1180 (!xmlC14NIsVisible(ctx, cur->parent, cur->parent->parent)))
1188 tmp = cur->parent;
1213 attr = cur->properties;
1216 if (xmlC14NIsVisible(ctx, attr, cur)) {
1256 attr = cur->properties;
1261 if (xmlC14NIsVisible(ctx, attr, cur)) {
1284 if((!matched) && xmlC14NIsVisible(ctx, attr, cur)) {
1298 xml_lang_attr = xmlC14NFindHiddenParentAttr(ctx, cur->parent, BAD_CAST "lang", XML_XML_NAMESPACE);
1304 xml_space_attr = xmlC14NFindHiddenParentAttr(ctx, cur->parent, BAD_CAST "space", XML_XML_NAMESPACE);
1313 xml_base_attr = xmlC14NFindHiddenParentAttr(ctx, cur->parent, BAD_CAST "base", XML_XML_NAMESPACE);
1347 * @cur: the current element node
1354 xmlC14NCheckForRelativeNamespaces(xmlC14NCtxPtr ctx, xmlNodePtr cur)
1358 if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
1363 ns = cur->nsDef;
1395 * @cur: the node to process
1416 xmlC14NProcessElementNode(xmlC14NCtxPtr ctx, xmlNodePtr cur, int visible)
1422 if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
1432 if (xmlC14NCheckForRelativeNamespaces(ctx, cur) < 0) {
1453 if ((cur->ns != NULL) && (xmlStrlen(cur->ns->prefix) > 0)) {
1455 (const char *) cur->ns->prefix);
1458 xmlOutputBufferWriteString(ctx->buf, (const char *) cur->name);
1462 ret = xmlC14NProcessNamespacesAxis(ctx, cur, visible);
1464 ret = xmlExcC14NProcessNamespacesAxis(ctx, cur, visible);
1475 ret = xmlC14NProcessAttrsAxis(ctx, cur, visible);
1484 if (cur->children != NULL) {
1485 ret = xmlC14NProcessNodeList(ctx, cur->children);
1493 if ((cur->ns != NULL) && (xmlStrlen(cur->ns->prefix) > 0)) {
1495 (const char *) cur->ns->prefix);
1498 xmlOutputBufferWriteString(ctx->buf, (const char *) cur->name);
1517 * @cur: the node to process
1524 xmlC14NProcessNode(xmlC14NCtxPtr ctx, xmlNodePtr cur)
1529 if ((ctx == NULL) || (cur == NULL)) {
1534 visible = xmlC14NIsVisible(ctx, cur, cur->parent);
1535 switch (cur->type) {
1537 ret = xmlC14NProcessElementNode(ctx, cur, visible);
1550 if ((visible) && (cur->content != NULL)) {
1553 buffer = xmlC11NNormalizeText(cur->content);
1585 (const char *) cur->name);
1586 if ((cur->content != NULL) && (*(cur->content) != '\0')) {
1592 buffer = xmlC11NNormalizePI(cur->content);
1633 if (cur->content != NULL) {
1637 buffer = xmlC11NNormalizeComment(cur->content);
1663 if (cur->children != NULL) {
1666 ret = xmlC14NProcessNodeList(ctx, cur->children);
1698 xmlC14NErrUnknownNode(cur->type, "processing node");
1708 * @cur: the node to start from
1710 * Processes all nodes in the row starting from cur.
1715 xmlC14NProcessNodeList(xmlC14NCtxPtr ctx, xmlNodePtr cur)
1724 for (ret = 0; cur != NULL && ret >= 0; cur = cur->next) {
1725 ret = xmlC14NProcessNode(ctx, cur);
2150 const xmlChar *cur = input;
2169 while (*cur != '\0') {
2177 if ((*cur == '<') && ((mode == XMLC14N_NORMALIZE_ATTR) ||
2183 } else if ((*cur == '>') && (mode == XMLC14N_NORMALIZE_TEXT)) {
2188 } else if ((*cur == '&') && ((mode == XMLC14N_NORMALIZE_ATTR) ||
2195 } else if ((*cur == '"') && (mode == XMLC14N_NORMALIZE_ATTR)) {
2202 } else if ((*cur == '\x09') && (mode == XMLC14N_NORMALIZE_ATTR)) {
2208 } else if ((*cur == '\x0A') && (mode == XMLC14N_NORMALIZE_ATTR)) {
2214 } else if ((*cur == '\x0D') && ((mode == XMLC14N_NORMALIZE_ATTR) ||
2228 *out++ = *cur;
2230 cur++;