Skip to main content

string_decode_entities

Function string_decode_entities 

Source
pub unsafe fn string_decode_entities(
    doc: *mut _xmlDoc,
    input: *const xmlChar,
    what: c_int,
    end: xmlChar,
    end2: xmlChar,
    end3: xmlChar,
) -> *mut xmlChar
Expand description

Decode entity references in a string.

§UPSTREAM-PARITY

xmlChar *xmlStringDecodeEntities(xmlDocPtr doc, const xmlChar *input,
                                 int what, int end, int end2, int end3);

Replaces entity references (&name;) with their content from the document’s entity declarations. Also handles numeric character references (&#NNN; and &#xHHH;).

The what parameter specifies which entities to substitute:

  • 0: substitute all
  • 1: substitute only predefined
  • 2: substitute only general

end, end2, end3 specify terminating characters (0 if none).

Returns the decoded string (must be freed with xmlFree), or NULL on error.

§SAFETY

  • doc may be NULL (no entity lookup, only numeric refs).
  • input must be a valid null-terminated xmlChar string, or NULL.