libxml2_xmlstring.h File Reference

Typedef xmlChar

typedef unsigned charxmlChar

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).

BAD_CAST

BAD_CAST:

Macro to cast a string to an xmlChar * when one know its safe.

xmlStrdup ( const xmlChar * )

XMLPUBFUN xmlChar *XMLCALLxmlStrdup(const xmlChar *cur)

xmlStrdup: a strdup for array of xmlChar's. Since they are supposed to be encoded in UTF-8 or an encoding with 8bit based chars, we assume a termination mark of '0'.

Returns a new xmlChar * or NULL

OOM: possible --> returns NULL for cur!=NULL and sets OOM flag

Parameters
curthe input xmlChar *

xmlStrndup ( const xmlChar *, int )

XMLPUBFUN xmlChar *XMLCALLxmlStrndup(const xmlChar *cur,
intlen
)

xmlStrndup: a strndup for array of xmlChar's

Returns a new xmlChar* or NULL

OOM: possible --> returns NULL for (cup!=NULL && len>=0) and sets OOM flag

Parameters
curthe input xmlChar*
lenthe len of cur

xmlCharStrndup ( const char *, int )

XMLPUBFUN xmlChar *XMLCALLxmlCharStrndup(const char *cur,
intlen
)

xmlCharStrndup: a strndup for char's to xmlChar's

Returns a new xmlChar * or NULL

Parameters
curthe input char *
lenthe len of cur

xmlCharStrdup ( const char * )

XMLPUBFUN xmlChar *XMLCALLxmlCharStrdup(const char *cur)

xmlCharStrdup: a strdup for char's to xmlChar's

Returns a new xmlChar * or NULL

Parameters
curthe input char *

xmlStrsub ( const xmlChar *, int, int )

XMLPUBFUN xmlChar *XMLCALLxmlStrsub(const xmlChar *str,
intstart,
intlen
)

xmlStrsub: Extract a substring of a given string

Returns the xmlChar * for the first occurrence or NULL.

Parameters
strthe xmlChar * array (haystack)
startthe index of the first char (zero based)
lenthe length of the substring

xmlStrchr ( const xmlChar *, xmlChar )

XMLPUBFUN const xmlChar *XMLCALLxmlStrchr(const xmlChar *str,
xmlCharval
)

xmlStrchr: a strchr for xmlChar's

Returns the xmlChar* for the first occurrence or NULL.

Parameters
strthe xmlChar * array
valthe xmlChar to search

xmlStrstr ( const xmlChar *, const xmlChar * )

XMLPUBFUN const xmlChar *XMLCALLxmlStrstr(const xmlChar *str,
const xmlChar *val
)

xmlStrstr: a strstr for xmlChar's

Returns the xmlChar * for the first occurrence or NULL.

OOM: never

Parameters
strthe xmlChar * array (haystack)
valthe xmlChar to search (needle)

xmlStrcasestr ( const xmlChar *, xmlChar * )

XMLPUBFUN const xmlChar *XMLCALLxmlStrcasestr(const xmlChar *str,
xmlChar *val
)

xmlStrcasestr: a case-ignoring strstr for xmlChar's

Returns the xmlChar * for the first occurrence or NULL.

Parameters
strthe xmlChar * array (haystack)
valthe xmlChar to search (needle)

xmlStrcmp ( const xmlChar *, const xmlChar * )

XMLPUBFUN int XMLCALLxmlStrcmp(const xmlChar *str1,
const xmlChar *str2
)

xmlStrcmp: a strcmp for xmlChar's

Returns the integer result of the comparison

Parameters
str1the first xmlChar *
str2the second xmlChar *

xmlStrncmp ( const xmlChar *, const xmlChar *, int )

XMLPUBFUN int XMLCALLxmlStrncmp(const xmlChar *str1,
const xmlChar *str2,
intlen
)

xmlStrncmp: a strncmp for xmlChar's

Returns the integer result of the comparison

OOM: never

Parameters
str1the first xmlChar *
str2the second xmlChar *
lenthe max comparison length

xmlStrcasecmp ( const xmlChar *, const xmlChar * )

XMLPUBFUN int XMLCALLxmlStrcasecmp(const xmlChar *str1,
const xmlChar *str2
)

xmlStrcasecmp: a strcasecmp for xmlChar's

Returns the integer result of the comparison

Parameters
str1the first xmlChar *
str2the second xmlChar *

xmlStrncasecmp ( const xmlChar *, const xmlChar *, int )

XMLPUBFUN int XMLCALLxmlStrncasecmp(const xmlChar *str1,
const xmlChar *str2,
intlen
)

xmlStrncasecmp: a strncasecmp for xmlChar's

Returns the integer result of the comparison

Parameters
str1the first xmlChar *
str2the second xmlChar *
lenthe max comparison length

xmlStrEqual ( const xmlChar *, const xmlChar * )

XMLPUBFUN int XMLCALLxmlStrEqual(const xmlChar *str1,
const xmlChar *str2
)

xmlStrEqual: Check if both string are equal of have same content Should be a bit more readable and faster than xmlStrEqual()

Returns 1 if they are equal, 0 if they are different

OOM: never

Parameters
str1the first xmlChar *
str2the second xmlChar *

xmlStrQEqual ( const xmlChar *, const xmlChar *, const xmlChar * )

XMLPUBFUN int XMLCALLxmlStrQEqual(const xmlChar *pref,
const xmlChar *name,
const xmlChar *str
)

xmlStrQEqual: Check if a QName is Equal to a given string

Returns 1 if they are equal, 0 if they are different

Parameters
prefthe prefix of the QName
namethe localname of the QName
strthe second xmlChar *

xmlStrlen ( const xmlChar * )

XMLPUBFUN int XMLCALLxmlStrlen(const xmlChar *str)

xmlStrlen: length of a xmlChar's string

Returns the number of xmlChar contained in the ARRAY.

Parameters
strthe xmlChar * array

xmlStrcat ( xmlChar *, const xmlChar * )

XMLPUBFUN xmlChar *XMLCALLxmlStrcat(xmlChar *cur,
const xmlChar *add
)

xmlStrcat: a strcat for array of xmlChar's. Since they are supposed to be encoded in UTF-8 or an encoding with 8bit based chars, we assume a termination mark of '0'.

Returns a new xmlChar* containing the concatenated string.

OOM: possible --> OOM flag is set

Parameters
curthe original xmlChar* array
addthe xmlChar* array added

xmlStrncat ( xmlChar *, const xmlChar *, int )

XMLPUBFUN xmlChar *XMLCALLxmlStrncat(xmlChar *cur,
const xmlChar *add,
intlen
)

xmlStrncat: a strncat for array of xmlChar's, it will extend cur with the len first bytes of add.

Returns a new xmlChar*, the original cur is reallocated if needed and should not be freed

OOM: possible --> OOM flag is set

Parameters
curthe original xmlChar* array
addthe xmlChar* array added
lenthe length of add

xmlStrncatNew ( const xmlChar *, const xmlChar *, int )

XMLPUBFUN xmlChar *XMLCALLxmlStrncatNew(const xmlChar *str1,
const xmlChar *str2,
intlen
)

xmlStrncatNew: same as xmlStrncat, but creates a new string. The original two strings are not freed.

Returns a new xmlChar* or NULL

OOM: possible --> returns NULL, sets OOM flag

Parameters
str1first xmlChar string
str2second xmlChar string
lenthe len of str2

xmlStrPrintf ( xmlChar *, int, const xmlChar *, ... )

XMLPUBFUN int XMLCALLxmlStrPrintf(xmlChar *buf,
intlen,
const xmlChar *msg,
...
)

xmlStrPrintf: Formats msg and places result into buf.

Returns the number of characters written to buf or -1 if an error occurs.

Parameters
bufthe result buffer.
lenthe result buffer length.
msgthe message with printf formatting.
extra parameters for the message.

xmlStrVPrintf ( xmlChar *, int, const xmlChar *, va_list )

XMLPUBFUN int XMLCALLxmlStrVPrintf(xmlChar *buf,
intlen,
const xmlChar *msg,
va_listap
)

xmlStrVPrintf: Formats msg and places result into buf.

Returns the number of characters written to buf or -1 if an error occurs.

Parameters
bufthe result buffer.
lenthe result buffer length.
msgthe message with printf formatting.
apextra parameters for the message.

xmlGetUTF8Char ( const unsigned char *, int * )

XMLPUBFUN int XMLCALLxmlGetUTF8Char(const unsigned char *utf,
int *len
)

xmlGetUTF8Char: Read one UTF8 Char from utf

Returns the char value or -1 in case of error, and updates *len with the number of bytes consumed

Parameters
utfa sequence of UTF-8 encoded bytes
lena pointer to bytes len

xmlCheckUTF8 ( const unsigned char * )

XMLPUBFUN int XMLCALLxmlCheckUTF8(const unsigned char *utf)

xmlCheckUTF8: 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.

Return value: true if utf is valid.

Parameters
utfPointer to putative UTF-8 encoded string.

xmlUTF8Strsize ( const xmlChar *, int )

XMLPUBFUN int XMLCALLxmlUTF8Strsize(const xmlChar *utf,
intlen
)

xmlUTF8Strsize: storage size of an UTF8 string

Returns the storage size of the first 'len' characters of ARRAY

Parameters
utfa sequence of UTF-8 encoded bytes
lenthe number of characters in the array

xmlUTF8Strndup ( const xmlChar *, int )

XMLPUBFUN xmlChar *XMLCALLxmlUTF8Strndup(const xmlChar *utf,
intlen
)

xmlUTF8Strndup: a strndup for array of UTF8's

Returns a new UTF8 * or NULL

Parameters
utfthe input UTF8 *
lenthe len of utf (in chars)

xmlUTF8Strpos ( const xmlChar *, int )

XMLPUBFUN xmlChar *XMLCALLxmlUTF8Strpos(const xmlChar *utf,
intpos
)

xmlUTF8Strpos: a function to provide the equivalent of fetching a character from a string array

Returns a pointer to the UTF8 character or NULL

Parameters
utfthe input UTF8 *
posthe position of the desired UTF8 char (in chars)

xmlUTF8Strloc ( const xmlChar *, const xmlChar * )

XMLPUBFUN int XMLCALLxmlUTF8Strloc(const xmlChar *utf,
const xmlChar *utfchar
)

xmlUTF8Strloc: a function to provide the relative location of a UTF8 char

Returns the relative character position of the desired char or -1 if not found

Parameters
utfthe input UTF8 *
utfcharthe UTF8 character to be found

xmlUTF8Strsub ( const xmlChar *, int, int )

XMLPUBFUN xmlChar *XMLCALLxmlUTF8Strsub(const xmlChar *utf,
intstart,
intlen
)

xmlUTF8Strsub: Create a substring from a given UTF-8 string Note: positions are given in units of UTF-8 chars

Returns a pointer to a newly created string or NULL if any problem

Parameters
utfa sequence of UTF-8 encoded bytes
startrelative pos of first char
lentotal number to copy

xmlUTF8Strlen ( const xmlChar * )

XMLPUBFUN int XMLCALLxmlUTF8Strlen(const xmlChar *utf)

xmlUTF8Strlen: compute the length of an UTF8 string, it doesn't do a full UTF8 checking of the content of the string.

Returns the number of characters in the string or -1 in case of error

OOM: never

Parameters
utfa sequence of UTF-8 encoded bytes

xmlUTF8Size ( const xmlChar * )

XMLPUBFUN int XMLCALLxmlUTF8Size(const xmlChar *utf)

xmlUTF8Size: calculates the internal size of a UTF8 character

returns the numbers of bytes in the character, -1 on format error

Parameters
utfpointer to the UTF8 character

xmlUTF8Charcmp ( const xmlChar *, const xmlChar * )

XMLPUBFUN int XMLCALLxmlUTF8Charcmp(const xmlChar *utf1,
const xmlChar *utf2
)

xmlUTF8Charcmp: compares the two UCS4 values

returns result of the compare as with xmlStrncmp

Parameters
utf1pointer to first UTF8 char
utf2pointer to second UTF8 char