* xmlNewCDataBlock: * @doc: the target document (optional) * @content: raw text content (optional) * @len: size of text content * * Create a CDATA section node. * * Returns a pointer to the new node object or NULL if a memory * allocation failed. */
| 2648 | * allocation failed. |
| 2649 | */ |
| 2650 | xmlNodePtr |
| 2651 | xmlNewCDataBlock(xmlDocPtr doc, const xmlChar *content, int len) { |
| 2652 | xmlNodePtr cur; |
| 2653 | |
| 2654 | /* |
| 2655 | * Allocate a new node and fill the fields. |
| 2656 | */ |
| 2657 | cur = (xmlNodePtr) xmlMalloc(sizeof(xmlNode)); |
| 2658 | if (cur == NULL) |
| 2659 | return(NULL); |
| 2660 | memset(cur, 0, sizeof(xmlNode)); |
| 2661 | cur->type = XML_CDATA_SECTION_NODE; |
| 2662 | cur->doc = doc; |
| 2663 | |
| 2664 | if (content != NULL) { |
| 2665 | cur->content = xmlStrndup(content, len); |
| 2666 | if (cur->content == NULL) { |
| 2667 | xmlFree(cur); |
| 2668 | return(NULL); |
| 2669 | } |
| 2670 | } |
| 2671 | |
| 2672 | if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) |
| 2673 | xmlRegisterNodeDefaultValue(cur); |
| 2674 | return(cur); |
| 2675 | } |
| 2676 | |
| 2677 | /** |
| 2678 | * xmlNewDocComment: |
no test coverage detected