libxml2
|
set of routines to process strings More...
Macros | |
#define | BAD_CAST (xmlChar *) |
Macro to cast a string to an xmlChar * when one know its safe. |
Typedefs | |
typedef unsigned char | xmlChar |
This is a basic byte in an UTF-8 encoded string. |
Functions | |
xmlChar * | xmlStrdup (const xmlChar *cur) |
a strdup for array of xmlChar's. | |
xmlChar * | xmlStrndup (const xmlChar *cur, int len) |
a strndup for array of xmlChar's | |
xmlChar * | xmlCharStrndup (const char *cur, int len) |
a strndup for char's to xmlChar's | |
xmlChar * | xmlCharStrdup (const char *cur) |
a strdup for char's to xmlChar's | |
xmlChar * | xmlStrsub (const xmlChar *str, int start, int len) |
Extract a substring of a given string. | |
const xmlChar * | xmlStrchr (const xmlChar *str, xmlChar val) |
a strchr for xmlChar's | |
const xmlChar * | xmlStrstr (const xmlChar *str, const xmlChar *val) |
a strstr for xmlChar's | |
const xmlChar * | xmlStrcasestr (const xmlChar *str, const xmlChar *val) |
a case-ignoring strstr for xmlChar's | |
int | xmlStrcmp (const xmlChar *str1, const xmlChar *str2) |
a strcmp for xmlChar's | |
int | xmlStrncmp (const xmlChar *str1, const xmlChar *str2, int len) |
a strncmp for xmlChar's | |
int | xmlStrcasecmp (const xmlChar *str1, const xmlChar *str2) |
a strcasecmp for xmlChar's | |
int | xmlStrncasecmp (const xmlChar *str1, const xmlChar *str2, int len) |
a strncasecmp for xmlChar's | |
int | xmlStrEqual (const xmlChar *str1, const xmlChar *str2) |
Check if both strings are equal of have same content. | |
int | xmlStrQEqual (const xmlChar *pref, const xmlChar *name, const xmlChar *str) |
Check if a QName is Equal to a given string. | |
int | xmlStrlen (const xmlChar *str) |
length of a xmlChar's string | |
xmlChar * | xmlStrcat (xmlChar *cur, const xmlChar *add) |
a strcat for array of xmlChar's. | |
xmlChar * | xmlStrncat (xmlChar *cur, const xmlChar *add, int len) |
a strncat for array of xmlChar's, it will extend cur with the len first bytes of add. | |
xmlChar * | xmlStrncatNew (const xmlChar *str1, const xmlChar *str2, int len) |
same as xmlStrncat, but creates a new string. | |
int | xmlStrPrintf (xmlChar *buf, int len, const char *msg,...) |
Formats msg and places result into buf. | |
int | xmlStrVPrintf (xmlChar *buf, int len, const char *msg, va_list ap) |
Formats msg and places result into buf. | |
int | xmlGetUTF8Char (const unsigned char *utf, int *len) |
Read the first UTF8 character from utf | |
int | xmlCheckUTF8 (const unsigned char *utf) |
Checks utf for being valid UTF-8. | |
int | xmlUTF8Strsize (const xmlChar *utf, int len) |
storage size of an UTF8 string the behaviour is not guaranteed if the input string is not UTF-8 | |
xmlChar * | xmlUTF8Strndup (const xmlChar *utf, int len) |
a strndup for array of UTF8's | |
const xmlChar * | xmlUTF8Strpos (const xmlChar *utf, int pos) |
a function to provide the equivalent of fetching a character from a string array | |
int | xmlUTF8Strloc (const xmlChar *utf, const xmlChar *utfchar) |
a function to provide the relative location of a UTF8 char | |
xmlChar * | xmlUTF8Strsub (const xmlChar *utf, int start, int len) |
Create a substring from a given UTF-8 string Note: positions are given in units of UTF-8 chars. | |
int | xmlUTF8Strlen (const xmlChar *utf) |
compute the length of an UTF8 string, it doesn't do a full UTF8 checking of the content of the string. | |
int | xmlUTF8Size (const xmlChar *utf) |
calculates the internal size of a UTF8 character | |
int | xmlUTF8Charcmp (const xmlChar *utf1, const xmlChar *utf2) |
compares the two UCS4 values |
set of routines to process strings
type and interfaces needed for the internal string handling of the library, especially UTF8 processing.
typedef unsigned char xmlChar |
This is a basic byte in an UTF-8 encoded string.
It's unsigned allowing to pinpoint case where char * are assigned to xmlChar * (possibly making serialization back impossible).
xmlChar * xmlCharStrdup | ( | const char * | cur | ) |
xmlChar * xmlCharStrndup | ( | const char * | cur, |
int | len ) |
int xmlCheckUTF8 | ( | const unsigned char * | utf | ) |
Checks utf for being valid UTF-8.
utf is assumed to be null-terminated. This function is not super-strict, as it will allow longer UTF-8 sequences than necessary. Note that Java is capable of producing these sequences if provoked. Also note, this routine checks for the 4-byte maximum size, but does not check for 0x10ffff maximum value.
utf | Pointer to putative UTF-8 encoded string. |
int xmlGetUTF8Char | ( | const unsigned char * | utf, |
int * | len ) |
Read the first UTF8 character from utf
utf | a sequence of UTF-8 encoded bytes |
len | a pointer to the minimum number of bytes present in the sequence. This is used to assure the next character is completely contained within the sequence. |
int xmlStrlen | ( | const xmlChar * | str | ) |
same as xmlStrncat, but creates a new string.
The original two strings are not freed. If len is < 0 then the length will be calculated automatically.
int xmlStrPrintf | ( | xmlChar * | buf, |
int | len, | ||
const char * | msg, | ||
... ) |
Formats msg and places result into buf.
buf | the result buffer. |
len | the result buffer length. |
msg | the message with printf formatting. |
... | extra parameters for the message. |
Check if a QName is Equal to a given string.
pref | the prefix of the QName |
name | the localname of the QName |
str | the second xmlChar * |
int xmlStrVPrintf | ( | xmlChar * | buf, |
int | len, | ||
const char * | msg, | ||
va_list | ap ) |
Formats msg and places result into buf.
buf | the result buffer. |
len | the result buffer length. |
msg | the message with printf formatting. |
ap | extra parameters for the message. |
compares the two UCS4 values
utf1 | pointer to first UTF8 char |
utf2 | pointer to second UTF8 char |
int xmlUTF8Size | ( | const xmlChar * | utf | ) |
calculates the internal size of a UTF8 character
utf | pointer to the UTF8 character |
int xmlUTF8Strlen | ( | const xmlChar * | utf | ) |
compute the length of an UTF8 string, it doesn't do a full UTF8 checking of the content of the string.
utf | a sequence of UTF-8 encoded bytes |
a function to provide the relative location of a UTF8 char
utf | the input UTF8 * |
utfchar | the UTF8 character to be found |
a strndup for array of UTF8's
utf | the input UTF8 * |
len | the len of utf (in chars) |
a function to provide the equivalent of fetching a character from a string array
utf | the input UTF8 * |
pos | the position of the desired UTF8 char (in chars) |
int xmlUTF8Strsize | ( | const xmlChar * | utf, |
int | len ) |
storage size of an UTF8 string the behaviour is not guaranteed if the input string is not UTF-8
utf | a sequence of UTF-8 encoded bytes |
len | the number of characters in the array |
Create a substring from a given UTF-8 string Note: positions are given in units of UTF-8 chars.
utf | a sequence of UTF-8 encoded bytes |
start | relative pos of first char |
len | total number to copy |