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

Function xmlNodeAddContentLen

ThirdParty/libxml2/vtklibxml2/tree.c:5817–5851  ·  view source on GitHub ↗

* xmlNodeAddContentLen: * @cur: the node being modified * @content: extra content * @len: the size of @content * * Append the extra substring to the node content. * NOTE: In contrast to xmlNodeSetContentLen(), @content is supposed to be * raw text, so unescaped XML special chars are allowed, entity * references are not supported. * * Returns 0 on success, 1 on error, -1 if

Source from the content-addressed store, hash-verified

5815 * Returns 0 on success, 1 on error, -1 if a memory allocation failed.
5816 */
5817int
5818xmlNodeAddContentLen(xmlNodePtr cur, const xmlChar *content, int len) {
5819 if (cur == NULL)
5820 return(1);
5821 if ((content == NULL) || (len <= 0))
5822 return(0);
5823
5824 switch (cur->type) {
5825 case XML_DOCUMENT_FRAG_NODE:
5826 case XML_ELEMENT_NODE: {
5827 xmlNodePtr newNode, tmp;
5828
5829 newNode = xmlNewDocTextLen(cur->doc, content, len);
5830 if (newNode == NULL)
5831 return(-1);
5832 tmp = xmlAddChild(cur, newNode);
5833 if (tmp == NULL) {
5834 xmlFreeNode(newNode);
5835 return(-1);
5836 }
5837 break;
5838 }
5839 case XML_ATTRIBUTE_NODE:
5840 break;
5841 case XML_TEXT_NODE:
5842 case XML_CDATA_SECTION_NODE:
5843 case XML_PI_NODE:
5844 case XML_COMMENT_NODE:
5845 return(xmlTextAddContent(cur, content, len));
5846 default:
5847 break;
5848 }
5849
5850 return(0);
5851}
5852
5853/**
5854 * xmlNodeAddContent:

Callers 2

xmlNodeAddContentFunction · 0.85
xmlXIncludeLoadTxtFunction · 0.85

Calls 4

xmlNewDocTextLenFunction · 0.85
xmlAddChildFunction · 0.85
xmlFreeNodeFunction · 0.85
xmlTextAddContentFunction · 0.85

Tested by

no test coverage detected