MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlNodeSetSpacePreserve

Function xmlNodeSetSpacePreserve

ThirdParty/libxml2/vtklibxml2/tree.c:5192–5216  ·  view source on GitHub ↗

* xmlNodeSetSpacePreserve: * @cur: the node being changed * @val: the xml:space value ("0": default, 1: "preserve") * * Set (or reset) the space preserving behaviour of a node, i.e. the * value of the xml:space attribute. * * Return 0 on success, 1 if arguments are invalid, -1 if a * memory allocation failed. */

Source from the content-addressed store, hash-verified

5190 * memory allocation failed.
5191 */
5192int
5193xmlNodeSetSpacePreserve(xmlNodePtr cur, int val) {
5194 xmlNsPtr ns;
5195 xmlAttrPtr attr;
5196 const char *string;
5197 int res;
5198
5199 if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE))
5200 return(1);
5201
5202 res = xmlSearchNsByHrefSafe(cur, XML_XML_NAMESPACE, &ns);
5203 if (res != 0)
5204 return(res);
5205
5206 if (val == 0)
5207 string = "default";
5208 else
5209 string = "preserve";
5210
5211 attr = xmlSetNsProp(cur, ns, BAD_CAST "space", BAD_CAST string);
5212 if (attr == NULL)
5213 return(-1);
5214
5215 return(0);
5216}
5217#endif /* LIBXML_TREE_ENABLED */
5218
5219/**

Callers

nothing calls this directly

Calls 2

xmlSearchNsByHrefSafeFunction · 0.85
xmlSetNsPropFunction · 0.85

Tested by

no test coverage detected