Skip to main content

node_get_content

Function node_get_content 

Source
pub unsafe fn node_get_content(node: *mut _xmlNode) -> *mut xmlChar
Expand description

Get the content of a node, recursively concatenating child text.

§UPSTREAM-PARITY

xmlChar *xmlNodeGetContent(const xmlNode *cur);

Oracle behavior (tree.c xmlNodeGetContent):

  • For text/CDATA nodes: returns the content directly.
  • For element nodes: recursively concatenates the string values of children (text and CDATA; entity references are expanded via their content when available).
  • For attribute nodes: returns the attribute value (first child).
  • For comments/PIs: returns the content field.
  • For documents: returns content of the root element.
  • Returns NULL on error, empty string for empty nodes.

Returns a newly allocated string; caller frees with xmlFree.

§SAFETY

  • node must be valid pointers (or NULL where the upstream C contract allows), obtained from the matching constructor/owner and not yet freed; the callee may take or keep ownership exactly as the C API specifies.

The caller must not race this call with concurrent mutation of the same objects from other threads (per-object state is not internally synchronized). Violating any of the above is undefined behavior.

Exercised by the C-API differential courts (courts/suites/data-abi/*-family-probe.c) and the CLI differential courts; those pass byte-for-byte against the upstream oracle.