* xmlBufGetNodeContent: * @buf: a buffer xmlBufPtr * @cur: the node being read * * Read the value of a node @cur, this can be either the text carried * directly by this node if it's a TEXT node or the aggregate string * of the values carried by this node child's (TEXT and ENTITY_REF). * Entity references are substituted. * Fills up the buffer @buf with this value * * Returns 0 in case
| 5606 | * Returns 0 in case of success and -1 in case of error. |
| 5607 | */ |
| 5608 | int |
| 5609 | xmlBufGetNodeContent(xmlBufPtr buf, const xmlNode *cur) |
| 5610 | { |
| 5611 | if ((cur == NULL) || (buf == NULL)) |
| 5612 | return(-1); |
| 5613 | |
| 5614 | switch (cur->type) { |
| 5615 | case XML_DOCUMENT_NODE: |
| 5616 | case XML_HTML_DOCUMENT_NODE: |
| 5617 | case XML_DOCUMENT_FRAG_NODE: |
| 5618 | case XML_ELEMENT_NODE: |
| 5619 | case XML_ATTRIBUTE_NODE: |
| 5620 | case XML_ENTITY_DECL: |
| 5621 | xmlBufGetChildContent(buf, cur); |
| 5622 | break; |
| 5623 | |
| 5624 | case XML_CDATA_SECTION_NODE: |
| 5625 | case XML_TEXT_NODE: |
| 5626 | case XML_COMMENT_NODE: |
| 5627 | case XML_PI_NODE: |
| 5628 | xmlBufCat(buf, cur->content); |
| 5629 | break; |
| 5630 | |
| 5631 | case XML_ENTITY_REF_NODE: |
| 5632 | xmlBufGetEntityRefContent(buf, cur); |
| 5633 | break; |
| 5634 | |
| 5635 | case XML_NAMESPACE_DECL: |
| 5636 | xmlBufCat(buf, ((xmlNsPtr) cur)->href); |
| 5637 | break; |
| 5638 | |
| 5639 | default: |
| 5640 | break; |
| 5641 | } |
| 5642 | |
| 5643 | return(0); |
| 5644 | } |
| 5645 | |
| 5646 | /** |
| 5647 | * xmlNodeGetContent: |
no test coverage detected