Skip to main content

Module string

Module string 

Source
Expand description

String utility functions for libxml-rs.

Provides operations on xmlChar* (i.e. *mut u8) strings compatible with upstream libxml2’s string handling.

Functions§

build_qname
Build a QName prefix:local (upstream tree.c xmlBuildQName): writes into memory when it is large enough, otherwise allocates. Returns the resulting string (allocator-owned when not memory), or NULL on error. A NULL prefix returns ncname unchanged.
check_utf8
Check that a byte string is valid UTF-8 (upstream xmlCheckUTF8): returns 1 when valid, 0 otherwise.
split_qname2
Split a QName into prefix and local part (upstream tree.c xmlSplitQName2): returns NULL when the name has no prefix (or starts with ‘:’), otherwise allocates *prefix with the prefix and returns the local part.
split_qname3
Split a QName returning the prefix length (upstream tree.c xmlSplitQName3): returns the length of the prefix (before ‘:’), or 0 when there is no prefix. name must not start with ‘:’.
utf8_size
Size in bytes of the UTF-8 sequence starting at utf (upstream xmlUTF8Size): returns the sequence length, or -1 on invalid leading byte, 0 on NUL.
utf8_strlen
Return the number of UTF-8 characters in a string (upstream xmlUTF8Strlen).