* xmlNodeSetLang: * @cur: the node being changed * @lang: the language description * * Set the language of a node, i.e. the values of the xml:lang * attribute. * * Return 0 on success, 1 if arguments are invalid, -1 if a * memory allocation failed. */
| 5125 | * memory allocation failed. |
| 5126 | */ |
| 5127 | int |
| 5128 | xmlNodeSetLang(xmlNodePtr cur, const xmlChar *lang) { |
| 5129 | xmlNsPtr ns; |
| 5130 | xmlAttrPtr attr; |
| 5131 | int res; |
| 5132 | |
| 5133 | if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE)) |
| 5134 | return(1); |
| 5135 | |
| 5136 | res = xmlSearchNsByHrefSafe(cur, XML_XML_NAMESPACE, &ns); |
| 5137 | if (res != 0) |
| 5138 | return(res); |
| 5139 | attr = xmlSetNsProp(cur, ns, BAD_CAST "lang", lang); |
| 5140 | if (attr == NULL) |
| 5141 | return(-1); |
| 5142 | |
| 5143 | return(0); |
| 5144 | } |
| 5145 | #endif /* LIBXML_TREE_ENABLED */ |
| 5146 | |
| 5147 | /** |
nothing calls this directly
no test coverage detected