Blame doc/html/libxml-xmlstring.html

Packit 423ecb
Packit 423ecb
Packit 423ecb
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="SHORTCUT ICON" href="/favicon.ico" /><style type="text/css">
Packit 423ecb
TD {font-family: Verdana,Arial,Helvetica}
Packit 423ecb
BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
Packit 423ecb
H1 {font-family: Verdana,Arial,Helvetica}
Packit 423ecb
H2 {font-family: Verdana,Arial,Helvetica}
Packit 423ecb
H3 {font-family: Verdana,Arial,Helvetica}
Packit 423ecb
A:link, A:visited, A:active { text-decoration: underline }
Packit 423ecb
</style><style type="text/css">
Packit 423ecb
      div.deprecated pre.programlisting {border-style: double;border-color:red}
Packit 423ecb
      pre.programlisting {border-style: double;background: #EECFA1}
Packit 423ecb
    </style><title>Module xmlstring from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000">
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Module xmlstring from libxml2

<center>API Menu</center>
<form action="../search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form>
<center>API Indexes</center>
<center>Related links</center>

type and interfaces needed for the internal string handling of the library, especially UTF8 processing.

Table of Contents

#define BAD_CAST
Typedef unsigned char xmlChar
Packit 423ecb
xmlChar *	xmlCharStrdup		(const char * cur)
Packit 423ecb
xmlChar *	xmlCharStrndup		(const char * cur, 
int len)
Packit 423ecb
int	xmlCheckUTF8			(const unsigned char * utf)
Packit 423ecb
int	xmlGetUTF8Char			(const unsigned char * utf, 
int * len)
Packit 423ecb
int	xmlStrEqual			(const xmlChar * str1, 
const xmlChar * str2)
Packit 423ecb
int	xmlStrPrintf			(xmlChar * buf, 
int len,
const char * msg,
... ...)
Packit 423ecb
int	xmlStrQEqual			(const xmlChar * pref, 
const xmlChar * name,
const xmlChar * str)
Packit 423ecb
int	xmlStrVPrintf			(xmlChar * buf, 
int len,
const char * msg,
va_list ap)
Packit 423ecb
int	xmlStrcasecmp			(const xmlChar * str1, 
const xmlChar * str2)
Packit 423ecb
const xmlChar *	xmlStrcasestr		(const xmlChar * str, 
const xmlChar * val)
Packit 423ecb
xmlChar *	xmlStrcat		(xmlChar * cur, 
const xmlChar * add)
Packit 423ecb
const xmlChar *	xmlStrchr		(const xmlChar * str, 
xmlChar val)
Packit 423ecb
int	xmlStrcmp			(const xmlChar * str1, 
const xmlChar * str2)
Packit 423ecb
xmlChar *	xmlStrdup		(const xmlChar * cur)
Packit 423ecb
int	xmlStrlen			(const xmlChar * str)
Packit 423ecb
int	xmlStrncasecmp			(const xmlChar * str1, 
const xmlChar * str2,
int len)
Packit 423ecb
xmlChar *	xmlStrncat		(xmlChar * cur, 
const xmlChar * add,
int len)
Packit 423ecb
xmlChar *	xmlStrncatNew		(const xmlChar * str1, 
const xmlChar * str2,
int len)
Packit 423ecb
int	xmlStrncmp			(const xmlChar * str1, 
const xmlChar * str2,
int len)
Packit 423ecb
xmlChar *	xmlStrndup		(const xmlChar * cur, 
int len)
Packit 423ecb
const xmlChar *	xmlStrstr		(const xmlChar * str, 
const xmlChar * val)
Packit 423ecb
xmlChar *	xmlStrsub		(const xmlChar * str, 
int start,
int len)
Packit 423ecb
int	xmlUTF8Charcmp			(const xmlChar * utf1, 
const xmlChar * utf2)
Packit 423ecb
int	xmlUTF8Size			(const xmlChar * utf)
Packit 423ecb
int	xmlUTF8Strlen			(const xmlChar * utf)
Packit 423ecb
int	xmlUTF8Strloc			(const xmlChar * utf, 
const xmlChar * utfchar)
Packit 423ecb
xmlChar *	xmlUTF8Strndup		(const xmlChar * utf, 
int len)
Packit 423ecb
const xmlChar *	xmlUTF8Strpos		(const xmlChar * utf, 
int pos)
Packit 423ecb
int	xmlUTF8Strsize			(const xmlChar * utf, 
int len)
Packit 423ecb
xmlChar *	xmlUTF8Strsub		(const xmlChar * utf, 
int start,
int len)
Packit 423ecb

Description

Packit 423ecb

Macro: BAD_CAST

#define BAD_CAST

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

Packit 423ecb
Packit 423ecb
      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).
Packit 423ecb
    

Function: xmlCharStrdup

xmlChar *	xmlCharStrdup		(const char * cur)
Packit 423ecb

a strdup for char's to xmlChar's

Packit 423ecb
<tt>cur</tt>:the input char *
<tt>Returns</tt>:a new xmlChar * or NULL

Function: xmlCharStrndup

xmlChar *	xmlCharStrndup		(const char * cur, 
int len)
Packit 423ecb

a strndup for char's to xmlChar's

Packit 423ecb
<tt>cur</tt>:the input char *
<tt>len</tt>:the len of @cur
<tt>Returns</tt>:a new xmlChar * or NULL

Function: xmlCheckUTF8

int	xmlCheckUTF8			(const unsigned char * utf)
Packit 423ecb

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.

Packit 423ecb
<tt>utf</tt>:Pointer to putative UTF-8 encoded string.
<tt>Returns</tt>:value: true if @utf is valid.

Function: xmlGetUTF8Char

int	xmlGetUTF8Char			(const unsigned char * utf, 
int * len)
Packit 423ecb

Read the first UTF8 character from @utf

Packit 423ecb
<tt>utf</tt>:a sequence of UTF-8 encoded bytes
<tt>len</tt>: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.
<tt>Returns</tt>:the char value or -1 in case of error, and sets *len to the actual number of bytes consumed (0 in case of error)

Function: xmlStrEqual

int	xmlStrEqual			(const xmlChar * str1, 
const xmlChar * str2)
Packit 423ecb

Check if both strings are equal of have same content. Should be a bit more readable and faster than xmlStrcmp()

Packit 423ecb
<tt>str1</tt>:the first xmlChar *
<tt>str2</tt>:the second xmlChar *
<tt>Returns</tt>:1 if they are equal, 0 if they are different

Function: xmlStrPrintf

int	xmlStrPrintf			(xmlChar * buf, 
int len,
const char * msg,
... ...)
Packit 423ecb

Formats @msg and places result into @buf.

Packit 423ecb
<tt>buf</tt>:the result buffer.
<tt>len</tt>:the result buffer length.
<tt>msg</tt>:the message with printf formatting.
<tt>...</tt>:extra parameters for the message.
<tt>Returns</tt>:the number of characters written to @buf or -1 if an error occurs.

Function: xmlStrQEqual

int	xmlStrQEqual			(const xmlChar * pref, 
const xmlChar * name,
const xmlChar * str)
Packit 423ecb

Check if a QName is Equal to a given string

Packit 423ecb
<tt>pref</tt>:the prefix of the QName
<tt>name</tt>:the localname of the QName
<tt>str</tt>:the second xmlChar *
<tt>Returns</tt>:1 if they are equal, 0 if they are different

Function: xmlStrVPrintf

int	xmlStrVPrintf			(xmlChar * buf, 
int len,
const char * msg,
va_list ap)
Packit 423ecb

Formats @msg and places result into @buf.

Packit 423ecb
<tt>buf</tt>:the result buffer.
<tt>len</tt>:the result buffer length.
<tt>msg</tt>:the message with printf formatting.
<tt>ap</tt>:extra parameters for the message.
<tt>Returns</tt>:the number of characters written to @buf or -1 if an error occurs.

Function: xmlStrcasecmp

int	xmlStrcasecmp			(const xmlChar * str1, 
const xmlChar * str2)
Packit 423ecb

a strcasecmp for xmlChar's

Packit 423ecb
<tt>str1</tt>:the first xmlChar *
<tt>str2</tt>:the second xmlChar *
<tt>Returns</tt>:the integer result of the comparison

Function: xmlStrcasestr

const xmlChar *	xmlStrcasestr		(const xmlChar * str, 
const xmlChar * val)
Packit 423ecb

a case-ignoring strstr for xmlChar's

Packit 423ecb
<tt>str</tt>:the xmlChar * array (haystack)
<tt>val</tt>:the xmlChar to search (needle)
<tt>Returns</tt>:the xmlChar * for the first occurrence or NULL.

Function: xmlStrcat

xmlChar *	xmlStrcat		(xmlChar * cur, 
const xmlChar * add)
Packit 423ecb

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

Packit 423ecb
<tt>cur</tt>:the original xmlChar * array
<tt>add</tt>:the xmlChar * array added
<tt>Returns</tt>:a new xmlChar * containing the concatenated string. The original @cur is reallocated and should not be freed.

Function: xmlStrchr

const xmlChar *	xmlStrchr		(const xmlChar * str, 
xmlChar val)
Packit 423ecb

a strchr for xmlChar's

Packit 423ecb
<tt>str</tt>:the xmlChar * array
<tt>val</tt>:the xmlChar to search
<tt>Returns</tt>:the xmlChar * for the first occurrence or NULL.

Function: xmlStrcmp

int	xmlStrcmp			(const xmlChar * str1, 
const xmlChar * str2)
Packit 423ecb

a strcmp for xmlChar's

Packit 423ecb
<tt>str1</tt>:the first xmlChar *
<tt>str2</tt>:the second xmlChar *
<tt>Returns</tt>:the integer result of the comparison

Function: xmlStrdup

xmlChar *	xmlStrdup		(const xmlChar * cur)
Packit 423ecb

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

Packit 423ecb
<tt>cur</tt>:the input xmlChar *
<tt>Returns</tt>:a new xmlChar * or NULL

Function: xmlStrlen

int	xmlStrlen			(const xmlChar * str)
Packit 423ecb

length of a xmlChar's string

Packit 423ecb
<tt>str</tt>:the xmlChar * array
<tt>Returns</tt>:the number of xmlChar contained in the ARRAY.

Function: xmlStrncasecmp

int	xmlStrncasecmp			(const xmlChar * str1, 
const xmlChar * str2,
int len)
Packit 423ecb

a strncasecmp for xmlChar's

Packit 423ecb
<tt>str1</tt>:the first xmlChar *
<tt>str2</tt>:the second xmlChar *
<tt>len</tt>:the max comparison length
<tt>Returns</tt>:the integer result of the comparison

Function: xmlStrncat

xmlChar *	xmlStrncat		(xmlChar * cur, 
const xmlChar * add,
int len)
Packit 423ecb

a strncat for array of xmlChar's, it will extend @cur with the len first bytes of @add. Note that if @len < 0 then this is an API error and NULL will be returned.

Packit 423ecb
<tt>cur</tt>:the original xmlChar * array
<tt>add</tt>:the xmlChar * array added
<tt>len</tt>:the length of @add
<tt>Returns</tt>:a new xmlChar *, the original @cur is reallocated and should not be freed.

Function: xmlStrncatNew

xmlChar *	xmlStrncatNew		(const xmlChar * str1, 
const xmlChar * str2,
int len)
Packit 423ecb

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.

Packit 423ecb
<tt>str1</tt>:first xmlChar string
<tt>str2</tt>:second xmlChar string
<tt>len</tt>:the len of @str2 or < 0
<tt>Returns</tt>:a new xmlChar * or NULL

Function: xmlStrncmp

int	xmlStrncmp			(const xmlChar * str1, 
const xmlChar * str2,
int len)
Packit 423ecb

a strncmp for xmlChar's

Packit 423ecb
<tt>str1</tt>:the first xmlChar *
<tt>str2</tt>:the second xmlChar *
<tt>len</tt>:the max comparison length
<tt>Returns</tt>:the integer result of the comparison

Function: xmlStrndup

xmlChar *	xmlStrndup		(const xmlChar * cur, 
int len)
Packit 423ecb

a strndup for array of xmlChar's

Packit 423ecb
<tt>cur</tt>:the input xmlChar *
<tt>len</tt>:the len of @cur
<tt>Returns</tt>:a new xmlChar * or NULL

Function: xmlStrstr

const xmlChar *	xmlStrstr		(const xmlChar * str, 
const xmlChar * val)
Packit 423ecb

a strstr for xmlChar's

Packit 423ecb
<tt>str</tt>:the xmlChar * array (haystack)
<tt>val</tt>:the xmlChar to search (needle)
<tt>Returns</tt>:the xmlChar * for the first occurrence or NULL.

Function: xmlStrsub

xmlChar *	xmlStrsub		(const xmlChar * str, 
int start,
int len)
Packit 423ecb

Extract a substring of a given string

Packit 423ecb
<tt>str</tt>:the xmlChar * array (haystack)
<tt>start</tt>:the index of the first char (zero based)
<tt>len</tt>:the length of the substring
<tt>Returns</tt>:the xmlChar * for the first occurrence or NULL.

Function: xmlUTF8Charcmp

int	xmlUTF8Charcmp			(const xmlChar * utf1, 
const xmlChar * utf2)
Packit 423ecb

compares the two UCS4 values

Packit 423ecb
<tt>utf1</tt>:pointer to first UTF8 char
<tt>utf2</tt>:pointer to second UTF8 char
<tt>Returns</tt>:result of the compare as with xmlStrncmp

Function: xmlUTF8Size

int	xmlUTF8Size			(const xmlChar * utf)
Packit 423ecb

calculates the internal size of a UTF8 character

Packit 423ecb
<tt>utf</tt>:pointer to the UTF8 character
<tt>Returns</tt>:the numbers of bytes in the character, -1 on format error

Function: xmlUTF8Strlen

int	xmlUTF8Strlen			(const xmlChar * utf)
Packit 423ecb

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

Packit 423ecb
<tt>utf</tt>:a sequence of UTF-8 encoded bytes
<tt>Returns</tt>:the number of characters in the string or -1 in case of error

Function: xmlUTF8Strloc

int	xmlUTF8Strloc			(const xmlChar * utf, 
const xmlChar * utfchar)
Packit 423ecb

a function to provide the relative location of a UTF8 char

Packit 423ecb
<tt>utf</tt>:the input UTF8 *
<tt>utfchar</tt>:the UTF8 character to be found
<tt>Returns</tt>:the relative character position of the desired char or -1 if not found

Function: xmlUTF8Strndup

xmlChar *	xmlUTF8Strndup		(const xmlChar * utf, 
int len)
Packit 423ecb

a strndup for array of UTF8's

Packit 423ecb
<tt>utf</tt>:the input UTF8 *
<tt>len</tt>:the len of @utf (in chars)
<tt>Returns</tt>:a new UTF8 * or NULL

Function: xmlUTF8Strpos

const xmlChar *	xmlUTF8Strpos		(const xmlChar * utf, 
int pos)
Packit 423ecb

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

Packit 423ecb
<tt>utf</tt>:the input UTF8 *
<tt>pos</tt>:the position of the desired UTF8 char (in chars)
<tt>Returns</tt>:a pointer to the UTF8 character or NULL

Function: xmlUTF8Strsize

int	xmlUTF8Strsize			(const xmlChar * utf, 
int len)
Packit 423ecb

storage size of an UTF8 string the behaviour is not guaranteed if the input string is not UTF-8

Packit 423ecb
<tt>utf</tt>:a sequence of UTF-8 encoded bytes
<tt>len</tt>:the number of characters in the array
<tt>Returns</tt>:the storage size of the first 'len' characters of ARRAY

Function: xmlUTF8Strsub

xmlChar *	xmlUTF8Strsub		(const xmlChar * utf, 
int start,
int len)
Packit 423ecb

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

Packit 423ecb
<tt>utf</tt>:a sequence of UTF-8 encoded bytes
<tt>start</tt>:relative pos of first char
<tt>len</tt>:total number to copy
<tt>Returns</tt>:a pointer to a newly created string or NULL if any problem

Daniel Veillard

</body></html>