* xmlNodeGetSpacePreserve: * @cur: the node being checked * * Searches the space preserving behaviour of a node, i.e. the values * of the xml:space attribute or the one carried by the nearest * ancestor. * * Returns -1 if xml:space is not inherited, 0 if "default", 1 if "preserve" */
| 5227 | * Returns -1 if xml:space is not inherited, 0 if "default", 1 if "preserve" |
| 5228 | */ |
| 5229 | int |
| 5230 | xmlNodeGetSpacePreserve(const xmlNode *cur) { |
| 5231 | xmlChar *space; |
| 5232 | int res; |
| 5233 | |
| 5234 | if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE)) |
| 5235 | return(-1); |
| 5236 | |
| 5237 | while (cur != NULL) { |
| 5238 | res = xmlNodeGetAttrValue(cur, BAD_CAST "space", XML_XML_NAMESPACE, |
| 5239 | &space); |
| 5240 | if (res < 0) |
| 5241 | return(-1); |
| 5242 | if (space != NULL) { |
| 5243 | if (xmlStrEqual(space, BAD_CAST "preserve")) { |
| 5244 | xmlFree(space); |
| 5245 | return(1); |
| 5246 | } |
| 5247 | if (xmlStrEqual(space, BAD_CAST "default")) { |
| 5248 | xmlFree(space); |
| 5249 | return(0); |
| 5250 | } |
| 5251 | xmlFree(space); |
| 5252 | } |
| 5253 | |
| 5254 | cur = cur->parent; |
| 5255 | } |
| 5256 | |
| 5257 | return(-1); |
| 5258 | } |
| 5259 | |
| 5260 | #ifdef LIBXML_TREE_ENABLED |
| 5261 | /** |
no test coverage detected